Advertisement
Guest User

Untitled

a guest
May 18th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 174.03 KB | None | 0 0
  1. /*
  2. * Class Player
  3. *
  4. * Version 1.0
  5. *
  6. * Thursday, August 14, 2008
  7. *
  8. * Created by Berkies
  9. */
  10.  
  11. package net.com.codeusa.model;
  12.  
  13. import java.util.*;
  14. import java.lang.*;
  15. import java.io.FileWriter;
  16. import java.io.BufferedReader;
  17. import java.io.BufferedWriter;
  18. import java.io.FileReader;
  19. import java.io.IOException;
  20. import java.net.Socket;
  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.model.skills.*;
  25. import net.com.codeusa.model.combat.*;
  26. import net.com.codeusa.model.quest.*;
  27. import net.com.codeusa.*;
  28. import net.com.codeusa.io.*;
  29. import net.com.codeusa.net.PlayerSocket;
  30. import net.com.codeusa.net.IOHostList;
  31. import net.com.codeusa.util.ByteVector;
  32. import net.com.codeusa.util.Misc;
  33. import net.com.codeusa.util.UserInput;
  34. import net.com.codeusa.npcs.NPC;
  35. import net.com.codeusa.model.items.*;
  36. import net.com.codeusa.model.items.PlayerWeapon;
  37. import net.com.codeusa.model.ptrade.PTrade;
  38.  
  39. public class Player implements Entity {
  40.  
  41. public UserInput input = new UserInput(this);
  42. public int[] ultrarares = {1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,2422,13531,13532,13533,13534,13535,13536,1053,1054,1055,1056,1057,1058,13538,13539,13540,2572,2573};
  43. public int[] donarIDs = {11858, 11859, 11860, 11861, 11862, 11863, 10330, 10331, 10332, 10333, 10334, 10335, 10336, 10337, 10338, 10339, 10340, 10341, 10342, 10343, 10344, 10345, 10346, 10347, 10348, 10349, 10350, 10351, 10352, 10353, 13544, 13545, 13546, 13547, 13548, 13549, 13550, 13551, 13552, 13553, 13554, 13555, 1050, 1051, 13537, 14595, 14600, 14601, 14602, 14603, 14604, 14605, 13884, 13885, 13886, 13890, 13891, 13892, 13896, 13897, 13898, 13902, 13903, 13904, 13908, 13909, 13910, 13914, 13915, 13916, 13920, 13921, 13922, 13926, 13927, 13928, 13887, 13888, 13889, 13893, 13894, 13895, 13899, 13900, 13901, 13905, 13906, 13907, 13911, 13912, 13913, 13917, 13918, 13919, 13923, 13924, 13925, 13929, 13930, 13931, 13870, 13871, 13872, 13873, 13874, 13875, 13876, 13877, 13878, 13879, 13880, 13881, 13882, 13883, 13944, 13945, 13946, 13947, 13948, 13949, 13950, 13951, 13952, 13953, 13954, 13955, 13956, 13957, 13858, 13859, 13860, 13861, 13862, 13863, 13864, 13865, 13866, 13867, 13868, 13869, 13932, 13933, 13934, 13935, 13936, 13937, 13938, 13939, 13940, 13941, 13942, 13943, 13734, 13735, 13736, 13737, 13738, 13739, 13740, 13741, 13742, 13743, 13744, 13745};
  44.  
  45. public int spawnX = 3087;
  46. public int spawnY = 3491;
  47.  
  48. public boolean isShopping;
  49. public int ditchDelay;
  50. public boolean ditchUpdateReq = false;
  51.  
  52. public boolean inLowBounty = false;
  53. public boolean inMedBounty = false;
  54. public boolean inHighBounty = false;
  55. public int bountyMaxPlayers = 100;
  56. public boolean bountyInterface = false;
  57.  
  58. public boolean swapAsNote = false;
  59. public boolean DFSSpecial;
  60. public long lastDFS;
  61. public int DFSDelay = -1;
  62.  
  63. public boolean quickTeles = false;
  64. public boolean quickItems = false;
  65.  
  66. public boolean dungeonTimer = false;
  67. public boolean dungeonTimer2 = false;
  68.  
  69. public boolean wildWarned = false;
  70.  
  71. public boolean xLogged = false;
  72. public boolean xLogged2 = false;
  73. public boolean overlayDisplayed = false;
  74.  
  75. public int recievedBook = 0;
  76. public int killedInPkArena = 0;
  77. public int timeInArena = 0;
  78. public boolean gaveTime = false;
  79.  
  80. public boolean initialAttack;
  81. public boolean boltSpecial;
  82. public String nameSet;
  83. public int setDrop;
  84. //The player you are fol
  85.  
  86. public int stunned;{
  87. if (stunned > 0) {
  88. stunned--;
  89. }
  90. }
  91. public int followId;
  92. public int followPlayer = 0;
  93. public boolean followingPlayer = false;
  94.  
  95. public int KC;
  96. public int DC;
  97.  
  98. public String clanRoom = "";
  99. public String chatName;
  100. public final String ACTIVE_CHAT_DEFAULT = "Runery";
  101. public String activeChat = ACTIVE_CHAT_DEFAULT;
  102. public final String ACTIVE_CHAT_OWNER_DEFAULT = "Public Channel";
  103. public String activeChatOwner = ACTIVE_CHAT_OWNER_DEFAULT;
  104.  
  105. String[][] itemPrices = {{"Warrior helm", "536"}, {"Purple sweets", "12"}, {"Armadyl godsword", "750000"}, {"Statius's warhammer", "620000"}, {"Dragon med helm", "605"}, {"Statius's platelegs", "500000"}, {"Statius's full helm", "200000"}, {"Statius's platebody", "550000"}, {"Black dragonhide", "33"}, {"Dragon med helm", "605"}, {"Vesta's longsword", "620000"}, {"Dragon bones", "30"}, {"Enchanted robe", "495"}, {"Dragonfire shield", "212000"}, {"Mystic robe top", "720"}, {"Enchanted top", "741"}, {"Enchanted hat", "89"}, {"Adamant knife", "2"}, {"Adamant knife(p)", "4"}, {"Draconic visage", "217000"}, {"Mystic hat", "92"},{"Mystic robe bottom", "480"}, {"Mystic boots", "59"}, {"Mystic gloves", "59"}, {"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", "16"}, {"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", "63180"}};
  106.  
  107. String[][] killPrices = {{"Void knight top", "15"}, {"Void knight robe", "10"}, {"Void knight mace", "5"}, {"Void knight gloves", "5"}, {"Void mage helm", "8"}, {"Void ranger helm", "8"}, {"Void melee helm", "8"}, {"Runner hat", "3"}, {"Healer hat", "3"}, {"Ranger hat", "3"}, {"Runner boots", "5"}, {"Penance gloves", "5"}, {"Penance skirt", "10"}, {"Fighter torso", "12"}, {"Fire cape", "22"}};
  108.  
  109. int[][] otherPrices = {{6572, 20000}, {1632, 2500}, {1624, 120}, {1622, 250}, {1620, 400}, {1618, 550}, {6571, 20000}, {1631, 2500}, {1623, 120}, {1621, 250}, {1619, 400}, {1617, 550}, {13744, 9500000}, {13745, 950000}, {13742, 3816000}, {13743, 3816000}, {13736, 35000}, {13737, 35000}, {13740, 3816000}, {13741, 3816000}, {13738, 1168008}, {13739, 1168008}, {13734, 1000}, {13735, 1000}, {7456, 3}, {7457, 5}, {7458, 10}, {7459, 15}, {7460, 20}, {7461, 1000}, {7462, 1000}};
  110.  
  111. int[][] killRequirments = {{8844, 0}, {8845, 0}, {8846,0}, {8847, 14}, {8848, 0}, {8849, 20}, {8850, 0}, {10887, 5}, {4214, 10}, {4225, 10}, {2412, 0}, {2413, 0}, {2414, 0}, {2415, 5}, {2416, 5}, {2417, 5}, {7453, 0}, {7454, 0}, {7455, 1}, {7456, 0}, {7457, 0}, {7458, 0}, {7459, 0}, {7460, 0}, {7461, 0}, {7462, 0}};
  112.  
  113.  
  114. public int getItemValue(int item) {
  115. if (item == 995) {
  116. return 1;
  117. }
  118. int value = 0;
  119. for (String[] s : itemPrices) {
  120. String name = Engine.items.getItemName(item);
  121. if (name.equals(s[0])) {
  122. value = 100 * Integer.parseInt(s[1]);
  123. }
  124. }
  125. for (int[] i : otherPrices) {
  126. if (item == i[0]) {
  127. value = 100 * i[1];
  128. }
  129. }
  130. if (Engine.items.stackable(item) && value == 0) {
  131. value = 1;
  132. }
  133. return value;
  134. }
  135. public int getKillRequirment(int item) {
  136. int requirment = 0;
  137. for (int[] i : killRequirments) {
  138. if (item == i[0]) {
  139. requirment = i[1];
  140. }
  141. }
  142. return requirment;
  143. }
  144.  
  145. public int getKillCost(int item) {
  146. int cost = 0;
  147. for (String[] s : killPrices) {
  148. String name = Engine.items.getItemName(item);
  149. if (name.equals(s[0])) {
  150. cost = Integer.parseInt(s[1]);
  151. }
  152. }
  153. return cost;
  154. }
  155.  
  156. public double PVPPotential;
  157.  
  158. public int totalKills;
  159. public int kills;
  160.  
  161. public void message(String message) {
  162. getActionSender().sendMessage(this, message);
  163. }
  164.  
  165. public int OverTimer = -1;
  166.  
  167. public boolean teleblocked;
  168. public int teleblockTimer = 500;
  169.  
  170. public boolean teletab;
  171. public int leverTeleportX;
  172. public int leverTeleportY;
  173. public int leverTeleportH;
  174. public int leverTeleportDelay = -1;
  175.  
  176. public boolean hitOne;
  177. public boolean hitTwo;
  178. public boolean hitThree;
  179. public boolean hitFour;
  180. public double hit1;
  181. public double hit2;
  182. public double hit3;
  183. public double hit4;
  184.  
  185. public int specials;
  186. public boolean splitChat = false;
  187. public int spendingExperience = 15000000;
  188.  
  189. public int degrade = 6000;
  190. public boolean degrades = degrade < 6000;
  191. public int degrade2 = 6000;
  192. public boolean degrades2 = degrade2 < 6000;
  193. public int degradeCorrupt1;
  194. public int degradeCorrupt2;
  195. public int degradeCorrupt3;
  196. public int degradeCorrupt4;
  197. public int degradeCorrupt5;
  198. public int degradeCorrupt6;
  199. public int degradeCorrupt7;
  200. public int degradeCorrupt8;
  201. public boolean degradesCor1 = false;
  202. public boolean degradesCor2 = degradeCorrupt2 < 900;
  203. public boolean degradesCor3 = degradeCorrupt3 < 900;
  204. public boolean degradesCor4 = degradeCorrupt4 < 900;
  205. public boolean degradesCor5 = degradeCorrupt5 < 900;
  206. public boolean degradesCor6 = degradeCorrupt6 < 900;
  207. public boolean degradesCor7 = degradeCorrupt7 < 900;
  208. public boolean degradesCor8 = degradeCorrupt8 < 900;
  209.  
  210. public boolean mageSpellInterface1 = false;
  211. public boolean fightingCorp = false;
  212. public int mobdamage = 0;
  213. public int OOTimer = 0;
  214. public boolean onlyOnce = false;
  215.  
  216. //Combat variables
  217.  
  218. public double rangedMax;
  219.  
  220. public int attackedByCount;
  221. public String attacking;
  222. public String attackedBy;
  223.  
  224. public int spell;
  225. public int spell2;
  226. public int cuedSpell;
  227. public int cuedSpells;
  228. public int magicOppIndex;
  229. public int graphicMSDelay;
  230. public int magicGraphicDelay = -1;
  231. public int magicDamageDelay = -1;
  232. public int magicAffectDelay = -1;
  233. public boolean successfulCast;
  234. public boolean usingMage;
  235. public boolean orb;
  236.  
  237. public int weapon;
  238. public int strengthBonus;
  239. public int oppIndex;
  240. public int hitIndex;
  241.  
  242. public int cblvl = this.combatLevel;
  243.  
  244. public boolean getExperience = true;
  245. public boolean toggleChat= false;
  246.  
  247. public PTrade pTrade;
  248.  
  249. public void statSpy(Player other) {
  250. 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};
  251. getActionSender().setString(this, other.username.substring(0, 1).toUpperCase() + other.username.substring(1), 523, 99);
  252. for (int i = 0; i < strings.length; i++) {
  253. getActionSender().setString(this, ""+other.skillLvl[i], 523, strings[i]);
  254. getActionSender().setString(this, ""+other.getLevelForXP(i), 523, strings[i] + 1);
  255. }
  256. getActionSender().setTab(this, 79, 523);
  257. }
  258.  
  259. /**
  260. * Testing an interface
  261. */
  262. public void testInterface(int id, int max) {
  263. getActionSender().showInterface(this, id);
  264. for(int i=0; i < max; i++) {
  265. getActionSender().setString(this, "" + i, id, i);
  266. }
  267. }
  268.  
  269. public void clearItem(int item) {
  270. for (int i = 0; i < bankItems.length; i++) {
  271. if (item == bankItems[i]) {
  272. bankItems[i] = -1;
  273. bankItemsN[i] = 0;
  274. }
  275. }
  276. for (int i = 0; i < equipment.length; i++) {
  277. if (item == equipment[i]) {
  278. equipment[i] = -1;
  279. equipmentN[i] = 0;
  280. }
  281. }
  282. for (int i = 0; i < items.length; i++) {
  283. if (item == items[i]) {
  284. items[i] = -1;
  285. itemsN[i] = 0;
  286. }
  287. }
  288. }
  289.  
  290. public void clearItem(String item) {
  291. String name = item;
  292. for (int i = 0; i < bankItems.length; i++) {
  293. if (name.equals(Engine.items.getItemName(bankItems[i]))) {
  294. bankItems[i] = -1;
  295. bankItemsN[i] = 0;
  296. }
  297. }
  298. for (int i = 0; i < equipment.length; i++) {
  299. if (name.equals(Engine.items.getItemName(equipment[i]))) {
  300. equipment[i] = -1;
  301. equipmentN[i] = 0;
  302. }
  303. }
  304. for (int i = 0; i < items.length; i++) {
  305. if (name.equals(Engine.items.getItemName(items[i]))) {
  306. items[i] = -1;
  307. itemsN[i] = 0;
  308. }
  309. }
  310. }
  311.  
  312. //====================================FIGHT PITS===================================================
  313. public int FightEnemys = 0;
  314. public int FightEnemys2 = 0;
  315. public int PitGame = -1;
  316. public int[] FightPeople = new int[500];
  317. public int[] FightPeople2 = new int[500];
  318. public static int rewards[] = {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,13899};
  319.  
  320. public static int winnerReward() {
  321. return rewards[(int)(Math.random()*rewards.length)];
  322. }
  323.  
  324. public boolean GameStarted = false;
  325. public boolean AtWaitRoom()
  326. {
  327. if(absX >= 2394 && absY >= 5169 && absX <= 2404 && absY <= 5175)
  328. {
  329. return true;
  330. }
  331. else
  332. {
  333. return false;
  334. }
  335. }
  336.  
  337. public boolean AtPits()
  338. {
  339. if(absX >= 2368 && absY >= 5129 && absX <= 2421 && absY <= 5168)
  340. {
  341. return true;
  342. }
  343. else
  344. {
  345. return false;
  346. }
  347. }
  348.  
  349. public boolean Safezon()
  350. {
  351. if(absX >= 2995 && absY >= 3397 && absX <= 2969 && absY <= 2651)
  352. {
  353. return true;
  354. }
  355. else
  356. {
  357. return false;
  358. }
  359. }
  360. //====================================END OF FIGHT PITS===================================================
  361.  
  362. //===================================CLAN WARS==================================================
  363.  
  364.  
  365. public void ResetClanWars()
  366. {
  367. ClanTimer = -1;
  368. ClanReady = false;
  369. ClanPartner = 0;
  370. ClanSide = 0;
  371. clanheight = 0;
  372. ClanBattle = false;
  373. ClanCount = 1;
  374. clanKills = 0;
  375. Opposing = 0;
  376. GotThere = 0;
  377. }
  378.  
  379. public int GotThere = 0;
  380.  
  381. public int ClanTele = -1;
  382.  
  383. public int[] ClanMember = new int[50];
  384. public int clanchat = 0;
  385. public int clanchannel = 0;
  386. public String clanname = "";
  387. public int ClanTimer = -1;
  388. public boolean ClanReady = false;
  389. public int ClanPartner = 0;
  390. public int ClanSide = 0;
  391. public int clanKills = 0;
  392. public int clanheight = 0;
  393. public int Opposing = 0;
  394. public boolean ClanBattle = false;
  395. public int ClanCount = 1;
  396. public boolean AtClanLobby()
  397. {
  398. if(absX >= 3264 && absY >= 3672 && absX <= 3279 && absY <= 3695)
  399. {
  400. return true;
  401. }
  402. else
  403. {
  404. return false;
  405. }
  406. }
  407.  
  408. public boolean AtClanField()
  409. {
  410. if(absX >= 3263 && absY >= 3713 && absX <= 3329 && absY <= 3841)
  411. {
  412. return true;
  413. }
  414. else
  415. {
  416. return false;
  417. }
  418. }
  419.  
  420.  
  421. public boolean AtJail()
  422. {
  423. if(absX >= 3318 && absY >= 3762 && absX <= 3322 && absY <= 3789)
  424. {
  425. return true;
  426. }
  427. else
  428. {
  429. return false;
  430. }
  431. }
  432.  
  433.  
  434.  
  435. //==================================END OF CLAN WARS=============================================
  436.  
  437. public boolean lever;
  438. public void leverTeleport(String location) {
  439. if (teleblocked) {
  440. getActionSender().sendMessage(this, "You are teleport blocked!");
  441. return;
  442. }
  443. int x = absX;
  444. int y = absY;
  445. int h = heightLevel;
  446. if (location != null) {
  447. if (location.equals("Deep Wilderness")) {
  448. x = 3153;
  449. y = 3923;
  450. }
  451. if (location.equals("Ardougne Lever")) {
  452. x = 2561;
  453. y = 3311;
  454. }
  455. if (location.equals("Mage Bank (Inside)")) {
  456. x = 2539;
  457. y = 4712;
  458. }
  459. if (location.equals("Mage Bank (Outside)")) {
  460. x = 3090;
  461. y = 3956;
  462. }
  463. }
  464. getActionSender().removeShownInterface(this);
  465. requestAnim(2140, 0);
  466. leverTeleportX = x;
  467. leverTeleportY = y;
  468. leverTeleportH = h;
  469. leverTeleportDelay = 2;
  470. lever = true;
  471. }
  472.  
  473. public void teletab(String city) {
  474. int x = absX;
  475. int y = absY;
  476. int h = heightLevel;
  477. int r = 0;
  478. teletab = true;
  479. if (city != null) {
  480. if (city.equals("Varrock")) {
  481. x = 3210;
  482. y = 3421;
  483. r = 4;
  484. }
  485. if (city.equals("Lumbridge")) {
  486. x = 3221;
  487. y = 3218;
  488. r = 2;
  489. }
  490. if (city.equals("Falador")) {
  491. x = 2964;
  492. y = 3378;
  493. r = 3;
  494. }
  495. if (city.equals("Camelot")) {
  496. x = 2756;
  497. y = 3476;
  498. r = 3;
  499. }
  500. if (city.equals("Ardougne")) {
  501. x = 2660;
  502. y = 3301;
  503. r = 4;
  504. }
  505. }
  506. getActionSender().removeShownInterface(this);
  507. x += getRandom(r);
  508. y += getRandom(r);
  509. teleportTo(x, y, h, 3, 0, 9597, 4071, 1680, 0, 678, 0);
  510. }
  511.  
  512.  
  513. public void cityTeleport(String city) {
  514. int x = absX;
  515. int y = absY;
  516. int h = heightLevel;
  517. int r = 0;
  518. if (city != null) {
  519. if (city.equals("Varrock")) {
  520. x = 3210;
  521. y = 3421;
  522. r = 4;
  523. }
  524. if (city.equals("Lumbridge")) {
  525. x = 3221;
  526. y = 3218;
  527. r = 2;
  528. }
  529. if (city.equals("Falador")) {
  530. x = 2964;
  531. y = 3378;
  532. r = 3;
  533. }
  534. if (city.equals("Camelot")) {
  535. x = 2756;
  536. y = 3476;
  537. r = 3;
  538. }
  539. if (city.equals("Ardougne")) {
  540. x = 2660;
  541. y = 3301;
  542. r = 4;
  543. }
  544. }
  545. getActionSender().removeShownInterface(this);
  546. x += getRandom(r);
  547. y += getRandom(r);
  548. teleportTo(x, y, h, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
  549. }
  550.  
  551. public boolean isPVP() {
  552. return heightLevel == 4;
  553. }
  554. public boolean hotZone(int x, int y) {
  555. if ((x >= 3205 && x <= 3222 && y >= 3420 && y <= 3438) || //Varrock
  556. (x >= 3231 && x <= 3238 && y >= 3212 && y <= 3225) || //Lumbridge
  557. (x >= 2949 && x <= 2978 && y >= 3367 && y <= 3391) || //Falador
  558. (x >= 2741 && x <= 2774 && y >= 3464 && y <= 3481) || //Camelot
  559. (x >= 2652 && x <= 2672 && y >= 3294 && y <= 3318)) { //Ardougne
  560. return true;
  561. }
  562. return false;
  563. }
  564.  
  565. public void Welcome() {
  566. if (this == null || this.disconnected[0]) {
  567. return;
  568. }
  569. requestAnim(7392, 0);
  570. requestGFX(1844, 0);
  571. clearItem("null");
  572. getActionSender().setWindowPane(this, 549);
  573. getActionSender().setInterface(this, 1, 549, 2, 378);
  574. getActionSender().setInterface(this, 1, 549, 3, 17);
  575. getActionSender().setString(this, "Message of the Week", 17, 0);
  576. getActionSender().setString(this, "Please donate to help pay for Runery server fees, ::donatorbenefits", 17, 3);
  577. getActionSender().setString(this, "0 unread messages", 378, 37);
  578. getActionSender().setString(this, "0", 378, 39);
  579. getActionSender().setString(this, "Click here to Play Runery", 378, 45);
  580. getActionSender().setString(this, "Donate", 378, 7);
  581. if (donator == 0) {
  582. getActionSender().setString(this, "You are NOT a donator", 378, 94);
  583. getActionSender().setString(this, "Donate today to help out Runery Type ::donatorbenefits to see the benefits.", 378, 93);
  584. getActionSender().setString(this, "0", 378, 96);
  585. } else if (donator == 1) {
  586. getActionSender().setString(this, "You are a donator", 378, 94);
  587. getActionSender().setString(this, "Thanks for helping out Runery by donating!", 378, 93);
  588. getActionSender().setString(this, "1", 378, 96);
  589. }
  590. getActionSender().setString(this, "Welcome to Runery", 378, 115);
  591. getActionSender().setString(this, "You last logged in yesterday from: " + Server.socketListener.getAddress(socket.socket) + "", 378, 116);
  592. }
  593.  
  594. public String getKillMessage(String player) {
  595. String[][] selection = {{"It's official: you are far more awesome than ", " is."},
  596. {"Let all warriors learn from the fate of ", " and fear you."},
  597. {"Well done, you've pwned ", "."},
  598. {"You rock, ", " clearly does not."},
  599. {"", " was clearly no match for you."},
  600. {"You have wiped the floor with ", "."},
  601. {"Ooh, ", " just dropped dead, and it's all thanks to you!"},
  602. {"", " has fallen before your mighty mightiness."},
  603. {"You have proven your superiority over ", "."}
  604. };
  605. int index = (int)Math.floor(Math.random() * 9);
  606. return selection[index][0] + player + selection[index][1];
  607. }
  608.  
  609. public boolean multiwayCombatZone(int x, int y) {
  610. if ((x > 3072 && x < 3107 && y > 3401 && y < 3448) ||
  611. (x > 2946 && x < 3004 && y > 3333 && y < 3424) ||
  612. (x > 3193 && x < 3332 && y > 3665 && y < 3752) ||
  613. (x > 3203 && x < 3331 && y > 3519 && y < 3666) ||
  614. (x > 3134 && x < 3328 && y > 3519 && y < 3658) ||
  615. (x > 2945 && x < 2961 && y > 3812 && y < 3828) ||
  616. (x > 2982 && x < 3010 && y > 3913 && y < 3929) ||
  617. (x > 3203 && x < 3392 && y > 3904 && y < 4031) ||
  618. (x > 3149 && x < 3331 && y > 3799 && y < 3850) ||
  619. (x > 3064 && x < 3391 && y > 3864 && y < 3903) ||
  620. (x > 2370 && x < 2426 && y > 5128 && y < 5167) ||
  621. (pkArena()) ||
  622. (x > 3006 && x < 3072 && y > 3601 && y < 3713)) {
  623. return true;
  624. }
  625. return false;
  626. }
  627.  
  628. public boolean timerStarted;
  629. public long PVPTimer;
  630.  
  631. public boolean wildernessZone(int x, int y) {
  632. if (!isPVP()) {
  633. return (x >= 3042 && x <= 3395 && y >= 3523 && y <= 4000) || bountyArea() || pkArena();
  634. //return bountyArea() || pkArena();
  635. }
  636. if (isPVP()) {
  637. if ((x >= 3091 && x <= 3098 && y >= 3488 && y <= 3499) ||
  638. (x >= 3135 && x <= 3192 && y >= 3652 && y <= 3702) ||
  639. (x >= 3179 && x <= 3194 && y >= 3432 && y <= 3446) ||
  640. (x >= 3250 && x <= 3257 && y >= 3416 && y <= 3423) ||
  641. (x >= 2943 && x <= 2947 && y >= 2946 && y <= 3373) ||
  642. (x >= 2943 && x <= 2949 && y >= 3368 && y <= 3368) ||
  643. (x >= 3009 && x <= 3018 && y >= 3353 && y <= 3358) ||
  644. (x >= 3009 && x <= 3022 && y >= 3353 && y <= 3356) ||
  645. (x >= 2721 && x <= 2730 && y >= 3490 && y <= 3493) ||
  646. (x >= 2724 && x <= 2727 && y >= 3487 && y <= 3489) ||
  647. (x >= 2649 && x <= 2658 && y >= 3280 && y <= 3287) ||
  648. (x >= 2612 && x <= 2621 && y >= 3330 && y <= 3335) ||
  649. (x >= 3201 && x <= 3229 && y >= 3217 && y <= 3220) ||
  650. (x >= 3201 && x <= 3226 && y >= 3209 && y <= 3228) ||
  651. (x >= 3201 && x <= 3225 && y >= 3208 && y <= 3229) ||
  652. (x >= 3201 && x <= 3224 && y >= 3207 && y <= 3230) ||
  653. (x >= 3201 && x <= 3223 && y >= 3206 && y <= 3231) ||
  654. (x >= 3201 && x <= 3222 && y >= 3205 && y <= 3232) ||
  655. (x >= 3201 && x <= 3221 && y >= 3204 && y <= 3233) ||
  656. (x >= 3201 && x <= 3220 && y >= 3203 && y <= 3234) ||
  657. (x >= 3201 && x <= 3213 && y >= 3202 && y <= 3235) ||
  658. (x >= 3201 && x <= 3212 && y >= 3201 && y <= 3236) ||
  659. (x >= 3201 && x <= 3203 && y >= 3202 && y <= 3235) ||
  660. (x >= 3201 && x <= 3202 && y >= 3203 && y <= 3234) ||
  661. (x >= 3265 && x <= 3272 && y >= 3161 && y <= 3173) ||
  662. (x >= 3201 && x <= 3201 && y >= 3204 && y <= 3233)) {
  663. //if ((attacking == null && attackedBy == null) || (timerStarted && System.currentTimeMillis() - PVPTimer >= 10000)) {
  664. // if (timerStarted) {
  665. // removeWilderness();
  666. // timerStarted = false;
  667. // }
  668. return false;
  669. //} else if (!timerStarted && (attacking == null || attackedBy != null)) {
  670. // PVPTimer = System.currentTimeMillis();
  671. // timerStarted = true;
  672. //}
  673.  
  674. }
  675. return true;
  676. }
  677. return false;
  678. }
  679. public int getWildernessLevel() {
  680. int level = 0;
  681. if (absY >= 3525 && absY <= 3527) {
  682. level = 1;
  683. } else if (absY >= 3526 && absY <= 3535) {
  684. level = 2;
  685. } else {
  686. level = 3 + (int)Math.ceil((absY - 3536) / 8);
  687. }
  688. if (level < 0 || absY < 3525) {
  689. level = 0;
  690. }
  691. if (level < 0 || absX < 2945) {
  692. level = 0;
  693. }
  694. if (level < 0 || absY > 4000) {
  695. level = 0;
  696. }
  697. if (level < 0 || absX > 3390) {
  698. level = 0;
  699. }
  700.  
  701. if (isPVP()) {
  702. double base = 5 + (combatLevel * 0.10);
  703. int total = (int)Math.round(base) + level;
  704. if (wildernessZone(absX, absY)) {
  705. return total;
  706. } else {
  707. return 0;
  708. }
  709. }
  710. return level;
  711. }
  712.  
  713.  
  714. /*public int getWildernessLevel() {
  715. int level = 0;
  716. if (absY >= 3525 && absY <= 3527) {
  717. level = 1;
  718. } else if (absY >= 3526 && absY <= 3535) {
  719. level = 2;
  720. } else {
  721. level = 3 + (int)Math.ceil((absY - 3536) / 8);
  722. }
  723. if (level < 0 || absY < 3525) {
  724. level = 0;
  725. }
  726. if (!isPVP()) {
  727. return level;
  728. }
  729. if (isPVP()) {
  730. double base = 5 + (combatLevel * 0.10);
  731. int total = (int)Math.round(base) + level;
  732. if (wildernessZone(absX, absY)) {
  733. return total;
  734. } else {
  735. return 0;
  736. }
  737. }
  738. return level;
  739. }*/
  740.  
  741. public boolean properWildernessLevel(int thisCombat, int opponentCombat) {
  742. int difference = thisCombat >= opponentCombat ? thisCombat - opponentCombat : opponentCombat - thisCombat;
  743. return getWildernessLevel() >= difference;
  744. }
  745.  
  746. public void restoreTabs(Player p) {
  747. for (int b = 16; b <= 21; b++) {
  748. p.getActionSender().setInterfaceConfig(p, 548, b, false);
  749. }
  750.  
  751. for (int a = 32; a <= 38; a++) {
  752. p.getActionSender().setInterfaceConfig(p, 548, a, false);
  753. }
  754. p.calculateEquipmentBonus();
  755.  
  756. p.getActionSender().setInterfaceConfig(p, 548, 14, false);
  757. p.getActionSender().setInterfaceConfig(p, 548, 31, false);
  758. p.getActionSender().setInterfaceConfig(p, 548, 63, false);
  759.  
  760. p.getActionSender().setInterfaceConfig(p, 548, 72, false);
  761. }
  762. public void hideTabs(Player p) {
  763. for (int b = 16; b <= 21; b++) {
  764. p.getActionSender().setInterfaceConfig(p, 548, b, true);
  765. }
  766.  
  767. for (int a = 32; a <= 38; a++) {
  768. p.getActionSender().setInterfaceConfig(p, 548, a, true);
  769. }
  770. p.calculateEquipmentBonus();
  771.  
  772. p.getActionSender().setInterfaceConfig(p, 548, 14, true);
  773. p.getActionSender().setInterfaceConfig(p, 548, 31, true);
  774. p.getActionSender().setInterfaceConfig(p, 548, 63, true);
  775.  
  776. p.getActionSender().setInterfaceConfig(p, 548, 72, true);
  777. }
  778.  
  779. /**
  780. * Player count in clan.
  781. */
  782. public static int blackCount, whiteCount;
  783. /**
  784. * Clan wars teams
  785. */
  786. public static boolean blackTeam, whiteTeam;
  787. /**
  788. * Clan wars handler
  789. */
  790. public ClanWars clanWars = Engine.clanWars;
  791. /**
  792. * Wilderness level
  793. */
  794. public int wildLevel;
  795. /**
  796. * Options interface
  797. */
  798. public int Choice = 0;
  799. /**
  800. * If player updated the Wilderness level.
  801. */
  802. public boolean updatedLevel;
  803. public int savedLevel;
  804. /**
  805. * Thieving.
  806. */
  807. public int[] thievingArray = new int[4];
  808. public int maxArrays = 10;
  809. public boolean[] optionArray = new boolean[maxArrays];
  810. public TestWorldLoader worldLoader = new TestWorldLoader(this);
  811. /**
  812. * Quest variables
  813. */
  814. public int questId;
  815. public int questStage;
  816. public QuestDevelopment quest = new QuestDevelopment(this);
  817. /**
  818. * Has entered defence room Warrior guild.
  819. */
  820. public boolean enteredDefenceRoom;
  821. /**
  822. * Prevents XLogging.
  823. */
  824. public int combatType;
  825. /**
  826. * The delay for making a fire.
  827. */
  828. public int[] firemaking = new int[4];
  829. /**
  830. * Next graphic creating delay for MSB Special attack
  831. */
  832. public int nextDamageDelay = -1;
  833. public int nextGraphicDelay = -1;
  834. /**
  835. * Item ids of which are not spawnable.
  836. */
  837. public int[] economyItems = {
  838. 11696, 11698, 11700, 11694, 11730, 3140, 11718, 11720, 11722, 11724, 11726, 11728,
  839. 11690, 11702, 11704, 11706, 11708, 10581, 10566, 10637, 385, 391, 2440, 2434, 6685,
  840. 11235, 4151, 12670, 12671, 4153
  841. };
  842. /**
  843. * Option variable
  844. */
  845. public int optionId;
  846. /**
  847. * Call Warrior guild class
  848. */
  849. public WarriorGuild warriorGuild = new WarriorGuild(this);
  850. /**
  851. * Defender dropping types variable
  852. */
  853. public int defenderId;
  854.  
  855. /**
  856. * Wilderness Levels
  857. */
  858. public int wildernessLevel;
  859.  
  860. /**
  861. * Summoning variables
  862. */
  863. public int summonTeleDelay = -1;
  864. public int summonDrainDelay = -1;
  865. public boolean callFamiliar;
  866. public boolean familiarDissMiss;
  867. public boolean summonedFamiliar;
  868.  
  869. /**
  870. * Warrior Guild variables
  871. */
  872. public int[] randomItemIds = {
  873. 8843, 8844, 8845, 8846, 8847, 8848, 8849, 8850
  874. };
  875. public String warriorArmour;
  876.  
  877. /**
  878. * autoCast Variables
  879. */
  880. public int[] regularStaffs = {
  881. 1381, 8841, 1383, 1385, 1387
  882. };
  883. public int[] otherStaffs = {
  884. 4675, 13867, 13869, 4675
  885. };
  886. public int autoCastDmgDelay = -1;
  887. public int autoCastDelay;
  888. public int autocastSpellbook = -1;
  889. public int[] autoCast = new int[3];
  890. public int autocastSpell = -1;
  891. public boolean castAuto;
  892. public boolean autocast;
  893. public boolean usingAutoCast;
  894. /**
  895. * If player is disturbing commander zilyana.
  896. */
  897. public boolean disturbSara;
  898. /**
  899. * Death Delays
  900. */
  901. public int deathEmoteDelay = -1;
  902. /**
  903. * Yell delay
  904. */
  905. public int massYellDelay = 0;
  906.  
  907. /**
  908. * Crystal bow shots.
  909. */
  910. public int crystalShots;
  911.  
  912. /**
  913. * Fight Cave variables
  914. */
  915. public int neededKills;
  916. public int[] waveType = new int[5];
  917. public int waveCount;
  918. public int waveDelay = -1;
  919. public FightCave fCave = new FightCave(this);
  920.  
  921. /**
  922. * Fletching variables
  923. */
  924. public int deletedItem, addedItem;
  925. public int fletchAmt;
  926. public boolean isFletching;
  927. public int[] fletching;
  928. public int fletchDelay;
  929. public int fletchType, fletchExp;
  930. PlayerFletching fletchingClass = new PlayerFletching(this);
  931.  
  932. public int equipSpecDelay;
  933. public int[] miningAxes = {
  934. 1265, 1267, 1269, 1271, 1273, 1275
  935. };
  936. public boolean isBanking;
  937.  
  938. /**
  939. * Dueling variables
  940. */
  941. public int countDelay = -1;
  942. public int countType = -1;
  943. public boolean duelDeath;
  944. public boolean acceptDuel;
  945. public boolean acceptScreen1, acceptScreen2;
  946. public DuelArena duelArena = new DuelArena(this);
  947. public int duelFriend;
  948. public boolean duelScreen1, duelScreen2;
  949.  
  950. public int explodeType;
  951. public int explodeDelay = -1;
  952.  
  953. public int[] godWarsKills = new int[5];
  954. public int outLawKills = 0;
  955. public int watchId = -1;
  956.  
  957. public int spellType;
  958.  
  959. public int playerStart;
  960.  
  961. public boolean muteExpect, muteExpect2;
  962. public int muteType;
  963. public int[] hugeNpcs = {
  964. 50, 1155, 1157, 1158, 1160, 2745, 6222, 6203
  965. };
  966.  
  967. /**
  968. * Woodcutting variables
  969. */
  970. public int cutDelay;
  971. public boolean isWoodcutting;
  972.  
  973. /**
  974. * Dueling variables
  975. */
  976. public boolean isBusy;
  977. public int duelEnemy;
  978. public boolean inDuelFight;
  979.  
  980. /**
  981. * Pet variables
  982. */
  983. public int petKeeper;
  984. public boolean summonedPet;
  985.  
  986. /**
  987. * Mage Arena variables
  988. */
  989. public int kolodionDelay;
  990. public boolean arenaActive;
  991.  
  992. /**
  993. * Slayer variables
  994. */
  995. public int slayerAmount1;
  996. public int slayerType1;
  997. public int[] slayerType = {
  998. 1615, 5363, 55, 54
  999. };
  1000. public boolean slayerTask;
  1001. public int[] slayerArray = {
  1002. 1, 2, 3, 4
  1003. };
  1004. public int slayerAmount;
  1005.  
  1006. /**
  1007. * Pvn variables
  1008. */
  1009. public int damageSpecDelay = -1;
  1010. public boolean enableSpecDamage;
  1011. public int damageDelay1 = -1;
  1012. public boolean enableDamage;
  1013. public int atkDelay;
  1014. public boolean attackingNpc;
  1015. public int attackNpc;
  1016.  
  1017. /**
  1018. * Clan wars variables.
  1019. */
  1020. public boolean blackClan;
  1021. public boolean whiteClan;
  1022.  
  1023. /**
  1024. * Thieving variables.
  1025. */
  1026. public int pickPocketDelay;
  1027.  
  1028. /**
  1029. * This variable is added to add facing if player is gonna pickpocket.
  1030. */
  1031. public int npcClick2;
  1032.  
  1033. /**
  1034. * Mining variables.
  1035. */
  1036. public int rockId;
  1037. public boolean isMining;
  1038. public int receiveOreDelay;
  1039. public int miningDelay;
  1040.  
  1041. /**
  1042. * Wilderness variables.
  1043. */
  1044. public int wildyLevel;
  1045.  
  1046. public int statDelay = 100; //Stat update delay
  1047. public int hpDelay = 100; //HP update delay
  1048.  
  1049. /**
  1050. * Emote clicking delay.
  1051. */
  1052. public int animClickDelay;
  1053. public boolean usingPrayer;
  1054. public int buryDelay;
  1055. public int drainDelay;
  1056. public boolean rangedPrayer;
  1057. public boolean meleePrayer;
  1058. public boolean magicPrayer;
  1059. public boolean retriPrayer;
  1060. public boolean redempPrayer;
  1061.  
  1062. //Prayer
  1063.  
  1064. 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}};
  1065. public int headIconPrayer = -1;
  1066. public double drainCount = 0;
  1067.  
  1068. public boolean canPray(int prayer) {
  1069. if (skillLvl[5] > 0 && getLevelForXP(5) >= prayers[prayer][0]) {
  1070. return true;
  1071. }
  1072. return false;
  1073. }
  1074.  
  1075. public boolean usingPrayer(int prayer) {
  1076. return prayers[prayer][1] == 1;
  1077. }
  1078.  
  1079. public boolean usingPrayer() {
  1080. int i = 0;
  1081. while (i <= 26) {
  1082. if (prayers[i][1] == 1) return true;
  1083. i++;
  1084. }
  1085. return false;
  1086. }
  1087.  
  1088. public void togglePrayer(int prayer, int toggle) {
  1089. 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};
  1090. prayers[prayer][1] = toggle;
  1091. getActionSender().setConfig(this, configuration[prayer], toggle);
  1092. }
  1093.  
  1094. public double prayerDrain() {
  1095. int i = 0;
  1096. double drainPerMinute = 0;
  1097. while (i <= 26) {
  1098. if (usingPrayer(i)) drainPerMinute += prayers[i][2];
  1099. i++;
  1100. }
  1101. drainPerMinute *= 1 + (equipmentBonus[11] / 30);
  1102. return drainPerMinute / 100;
  1103. }
  1104.  
  1105. public void switchPrayers(int[] prayers, int prayer) {
  1106. if (!canPray(prayer)) {
  1107. return;
  1108. }
  1109. for (int i : prayers) {
  1110. if (usingPrayer(i)) {
  1111. togglePrayer(i, 0);
  1112. }
  1113. }
  1114. }
  1115.  
  1116. /**
  1117. *Pm void
  1118. */
  1119. public void friendsLoggedIn() {
  1120. for(Long friend : friends) {
  1121. getActionSender().sendFriend(this, friend, getWorld(friend));
  1122. }
  1123. long[] array = new long[ignores.size()];
  1124. int i = 0;
  1125. for(Long ignore : ignores) {
  1126. if(ignore != null)
  1127. array[i++] = ignore;
  1128. }
  1129. getActionSender().sendIgnores(this, array);
  1130. long me = Misc.stringToLong(username);
  1131. for(Player p : Engine.players) {
  1132. if(p == null) continue;
  1133. if(p.friends.contains(me)) {
  1134. p.getActionSender().sendFriend(p, me, 66);
  1135. }
  1136. }
  1137. }
  1138. public int getWorld(long friend) {
  1139. for(Player p : Engine.players) {
  1140. if(p != null && p.online) {
  1141. if(Misc.stringToLong(p.username) == friend) {
  1142. return 66;
  1143. }
  1144. }
  1145. }
  1146. return 0;
  1147. }
  1148. public void reqWalkQueue(int x, int y) {
  1149. int firstX = x - (mapRegionX - 6) * 8;
  1150. int firstY = y - (mapRegionY - 6) * 8;
  1151. Engine.playerMovement.resetWalkingQueue(this);
  1152. Engine.playerMovement.addStepToWalkingQueue(firstX, firstY, this);
  1153. Engine.playerMovement.addStepToWalkingQueue(firstX, firstY+1, this);
  1154. Engine.playerMovement.addStepToWalkingQueue(firstX, firstY+2, this);
  1155. }
  1156.  
  1157. public void reqWalkQueueBack(int x, int y) {
  1158. int firstX = x - (mapRegionX - 6) * 8;
  1159. int firstY = y - (mapRegionY - 6) * 8;
  1160. Engine.playerMovement.resetWalkingQueue(this);
  1161. Engine.playerMovement.addStepToWalkingQueue(firstX, firstY, this);
  1162. Engine.playerMovement.addStepToWalkingQueue(firstX, firstY-1, this);
  1163. Engine.playerMovement.addStepToWalkingQueue(firstX, firstY-2, this);
  1164. }
  1165.  
  1166. public void prayerSounds(int prayer) {
  1167. int sound = 0;
  1168. switch (prayer) {
  1169. case 0: sound = 2690; break;
  1170. case 1: sound = 2688; break;
  1171. case 2: sound = 2664; break;
  1172. case 3: sound = 2685; break;
  1173. case 4: sound = 2668; break;
  1174. case 5: sound = 2684; break;
  1175. case 6: sound = 2689; break;
  1176. case 7: sound = 2662; break;
  1177. case 8: sound = 2679; break;
  1178. case 9: sound = 2678; break;
  1179. case 10: sound = 0; break;
  1180. case 11: sound = 2666; break;
  1181. case 12: sound = 2670; break;
  1182. case 13: sound = 2687; break;
  1183. case 14: sound = 2691; break;
  1184. case 15: sound = 2667; break;
  1185. case 16: sound = 0; break;
  1186. case 17: sound = 2675; break;
  1187. case 18: sound = 2677; break;
  1188. case 19: sound = 2676; break;
  1189. case 20: sound = 2665; break;
  1190. case 21: sound = 2669; break;
  1191. case 22: sound = 2682; break;
  1192. case 23: sound = 2680; break;
  1193. case 24: sound = 2686; break;
  1194. case 25: sound = 3826; break;
  1195. case 26: sound = 3825; break;
  1196. }
  1197. if (sound != 0) {
  1198. getActionSender().addSoundEffect(this, sound, 1, 0, 0);
  1199. }
  1200. }
  1201.  
  1202. public void resetPrayer() {
  1203. int i = 0;
  1204. while (i <= 26) {
  1205. togglePrayer(i, 0);
  1206. i++;
  1207. }
  1208. drainCount = 0;
  1209. headIconPrayer = -1;
  1210. updateReq = true;
  1211. appearanceUpdateReq = true;
  1212. }
  1213. public void resetHp() {
  1214. for (int i = 0; i < skillLvl.length; i++) {
  1215. skillLvl[i] = getLevelForXP(i);
  1216. getActionSender().setSkillLvl(this, i);
  1217. }
  1218. }
  1219. public void resetSpecial() {
  1220. specAmount = 1000;
  1221. getActionSender().setConfig2(this, 300, 1000);
  1222. }
  1223. /**
  1224. * Magic combat variables
  1225. */
  1226. public int freezeDelay;
  1227. public int vengeanceDelay;
  1228. public boolean vengeance;
  1229. public int spellbookSwapTimer;
  1230. public boolean spellbookSwap;
  1231. public boolean usedSpellbookSwap;
  1232. public int mageDelay;
  1233.  
  1234. /**
  1235. * Agility Variables
  1236. */
  1237. public int[] agilityX = {
  1238. 2476, 2475, 2474, 2473, 2472, 2471
  1239. };
  1240. public int[] agilityY = {
  1241. 3426
  1242. };
  1243. public boolean agilityPerforming;
  1244. public int agilityDelay;
  1245. public int agilityType;
  1246.  
  1247. /**
  1248. * Combat variables
  1249. */
  1250. public boolean fadeAway;
  1251. public int enemyFadeAwayDelay = -1;
  1252. public int fightStyle = 1;
  1253. public int[] strangeItems = {
  1254. 6570
  1255. };
  1256. public int battleCDelay;
  1257. public int battleCount;
  1258. public int poisonDelay;
  1259. public int poisonHitCount;
  1260. public boolean isPoisoned;
  1261. public int headIconSkull = -1;
  1262. public boolean isSkulled;
  1263. public int skullVanishDelay;
  1264. public int rangeDmgDelay = -1;
  1265. public int rangeDmgDelay2 = -1;
  1266.  
  1267. public int[] rangeBows = {
  1268. 841, 843, 845, 847, 849, 851, 853,
  1269. 855, 857, 859, 861, 9174, 9176, 9177,
  1270. 9179, 9181, 9183, 9185
  1271. };
  1272. public int[] rangeArrows = {
  1273. 882, 884, 886, 888, 890, 892
  1274. };
  1275. public int[] godSwords = {
  1276. 11694, 11696, 11698, 11700
  1277. };
  1278. public int myBonus;
  1279. public int meleeDef;
  1280. public int waitDeathDelay = -1;
  1281. public boolean randomVariable;
  1282. public int deathDelay = -1;
  1283. public boolean isDead;
  1284. public int specDelay = -1;
  1285. public int secondSpecDelay = -1;
  1286. public int delayedDamageDelay = -1;
  1287. public int delayedDamageHit = -1;
  1288. public boolean expectSpec;
  1289. public boolean autoRetaliate = true;
  1290. public int specFillDelay = 50;
  1291. public boolean usingSpecial;
  1292. public int specAmount;
  1293. public int xLogCheck = 30;
  1294. public int damageDelay;
  1295. public boolean damagePending;
  1296. public int combatDelay;
  1297. public int enemyIndex;
  1298. public boolean attackingPlayer;
  1299.  
  1300. /**
  1301. * Player's index.
  1302. */
  1303. public int playerId = 0;
  1304. /**
  1305. * Class for storing and converting bytes.
  1306. */
  1307. public int Overlay = 0;
  1308. /**
  1309. * Overlay int
  1310. */
  1311. public ByteVector stream = new ByteVector(500, 5000);
  1312. /**
  1313. * Player's socket for handling most io operations.
  1314. */
  1315. public PlayerSocket socket;
  1316. /**
  1317. * Set to true if the player has finished the login stage.
  1318. */
  1319. public boolean online = false;
  1320. /**
  1321. * Player's username.
  1322. */
  1323. public String username = "null";
  1324. /**
  1325. * Player's password.
  1326. */
  1327. public String password = "";
  1328. /**
  1329. * Player's rights.
  1330. */
  1331. public int rights = 0;
  1332. /**
  1333. * Player's donator rights.
  1334. */
  1335. public int donator = 0;
  1336. /**
  1337. * Player's genie lamp.
  1338. */
  1339. public int lamp1Skill = -1;
  1340. /**
  1341. * Player's pvp interface.
  1342. */
  1343. public int pvpArmorInterface = -1;
  1344. /**
  1345. * Player's pvp interface2.
  1346. */
  1347. public int pvpShop = 0;
  1348. /**
  1349. * Player's starter.
  1350. */
  1351. public int starter = 0;
  1352. /**
  1353. * Player's dialogue.
  1354. */
  1355. public int npcDialogue = 0;
  1356. /**
  1357. * Player's first time logging in.
  1358. */
  1359. public int firstLog = 0;
  1360. /**
  1361. * 1 set to true means socket disconnected but logged in, both for removing the player.
  1362. */
  1363. public boolean[] disconnected = new boolean[2];
  1364. /**
  1365. * The region this player is in.
  1366. */
  1367. public int mapRegionX = 0;
  1368. public int mapRegionY = 0;
  1369. /**
  1370. * The position this player is at in the map region.
  1371. */
  1372. public int currentX = 0;
  1373. public int currentY = 0;
  1374. /**
  1375. * Absolute coordinates this player is at.
  1376. */
  1377. public int absX = 0;
  1378. public int absY = 0;
  1379. /**
  1380. * The height level this player is at.
  1381. */
  1382. public int heightLevel = 0;
  1383. /**
  1384. * Storing players spellbook
  1385. */
  1386. public int spellbook = 192;
  1387. /**
  1388. * If either are above -1 then the player is in motion.
  1389. */
  1390. public int walkDir = -1;
  1391. public int runDir = -1;
  1392. /**
  1393. * True if the player is running, false if it isn't.
  1394. */
  1395. public boolean isRunning = false;
  1396. /**
  1397. * True if the player X-Logged.
  1398. */
  1399. public boolean isXlogged = false;
  1400. /**
  1401. * Set to true if the player has entered a new map region.
  1402. */
  1403. public boolean mapRegionDidChange = false;
  1404. /**
  1405. * Set to true if teleported.
  1406. */
  1407. public boolean didTeleport = false;
  1408. /**
  1409. * Set Absolute coordinates to these.
  1410. */
  1411. public int teleportToX = -1;
  1412. public int teleportToY = -1;
  1413. /**
  1414. * True if the player is Reqing an update.
  1415. */
  1416. public boolean updateReq = false;
  1417. /**
  1418. * Max number of steps this player can have pending.
  1419. */
  1420. public int walkingQueueSize = 50;
  1421. public int wQueueReadPtr = 0;
  1422. public int wQueueWritePtr = 0;
  1423. /**
  1424. * Positions the player is Reqing to walk to.
  1425. */
  1426. public int[] walkingQueueX = new int[walkingQueueSize];
  1427. public int[] walkingQueueY = new int[walkingQueueSize];
  1428. public int[] walkingQueue = new int[walkingQueueSize];
  1429. /**
  1430. * All the players within distance.
  1431. */
  1432. public Player[] playerList = new Player[Engine.players.length];
  1433. /**
  1434. * All the players stored in distance.
  1435. */
  1436. public byte[] playersInList = new byte[Engine.players.length];
  1437. public int playerListSize = 0;
  1438. /**
  1439. * True if chatting is Reqing to be sent.
  1440. */
  1441. public boolean chatTextUpdateReq = false;
  1442. public String chatText = "";
  1443. public int chatTextEffects = 0;
  1444. /**
  1445. * True if an appearance update is needed.
  1446. */
  1447. public boolean appearanceUpdateReq = false;
  1448. /**
  1449. * Animation data.
  1450. */
  1451. public boolean animUpdateReq = false;
  1452. public int animReq = -1;
  1453. public int animDelay = 0;
  1454. /**
  1455. * GFX data.
  1456. */
  1457. public boolean gfxUpdateReq = false;
  1458. public int gfxReq = -1;
  1459. public int gfxDelay = 0;
  1460. /**
  1461. * Player and NPC facing data.
  1462. */
  1463. public boolean faceToUpdateReq = false;
  1464. public int faceToReq = -1;
  1465. /**
  1466. * Facing request.
  1467. */
  1468. public boolean faceCoordsUpdateReq = false;
  1469. public int faceCoordsX = -1;
  1470. public int faceCoordsY = -1;
  1471. /**
  1472. * Damage data.
  1473. */
  1474. public boolean hit1UpdateReq = false;
  1475. public boolean hit2UpdateReq = false;
  1476. public int hitDiff1 = 0;
  1477. public int hitDiff2 = 0;
  1478. public int poisonHit1 = 0;
  1479. public int poisonHit2 = 0;
  1480. /**
  1481. * Skill level data.
  1482. */
  1483. public int[] skillLvl = new int[25];
  1484. public int[] skillXP = new int[25];
  1485. public int combatLevel = 0;
  1486. /**
  1487. * Equipment data.
  1488. */
  1489. public int[] equipment = new int[14];
  1490. public int[] equipmentN = new int[14];
  1491. public int[] equipmentBonus = new int[12];
  1492. /**
  1493. * Player appearance.
  1494. */
  1495. public int[] color = new int[5];
  1496. public int[] look = new int[7];
  1497. public int npcType = -1;
  1498. public int gender = 0;
  1499. /**
  1500. * Player emotes.
  1501. */
  1502. public int runEmote = 0x338;
  1503. public int walkEmote = 0x333;
  1504. public int standEmote = 0x328;
  1505. /**
  1506. * All the NPCs within distance.
  1507. */
  1508. public NPC[] npcList = new NPC[Engine.npcs.length];
  1509. /**
  1510. * All the npcs stored in distance.
  1511. */
  1512. public byte[] npcsInList = new byte[Engine.npcs.length];
  1513. public int npcListSize = 0;
  1514. /**
  1515. * Rebuild the entire NPC list.
  1516. */
  1517. public boolean rebuildNPCList = false;
  1518. /**
  1519. * An array storing all the players items.
  1520. */
  1521. public int[] items = new int[28];
  1522. public int[] itemsN = new int[28];
  1523. /**
  1524. * Open interfaces, use these to confirm an interface is open when trying to use one.
  1525. */
  1526. public int interfaceId = -1;
  1527. public int chatboxInterfaceId = -1;
  1528. /**
  1529. * The current position in the login stage.
  1530. */
  1531. public int loginStage = 0;
  1532. /**
  1533. * Click x position.
  1534. */
  1535. public int clickX = 0;
  1536. /**
  1537. * Click y position.
  1538. */
  1539. public int clickY = 0;
  1540. /**
  1541. * Click id.
  1542. */
  1543. public int clickId = 0;
  1544. /**
  1545. * Eat delay.
  1546. */
  1547. public int eatDelay;
  1548. public int drinkDelay;
  1549. /**
  1550. * True if the player is trying to pickup an item.
  1551. */
  1552. public boolean itemPickup = false;
  1553. /**
  1554. * Set run energy.
  1555. */
  1556. public boolean runEnergyUpdateReq = false;
  1557. /**
  1558. * Amount of current run energy.
  1559. */
  1560. public int runEnergy = 100;
  1561. /**
  1562. * Delay before run energy can increase.
  1563. */
  1564. public int runEnergyDelay = 0;
  1565. /**
  1566. * Clicked the first option on a player.
  1567. */
  1568. public boolean playerOption1 = false;
  1569. /**
  1570. * Clicked the second option on a player.
  1571. */
  1572. public boolean playerOption2 = false;
  1573. /**
  1574. * Clicked the third option on a player.
  1575. */
  1576. public boolean playerOption3 = false;
  1577. /**
  1578. * Clicked the first option on a NPC.
  1579. */
  1580. public boolean npcOption1 = false;
  1581. /**
  1582. * Clicked the first option on an object.
  1583. */
  1584. public boolean objectOption1 = false;
  1585. /**
  1586. * Setting the prayer system effects.
  1587. */
  1588. public PrayerSystem prayerSystem = new PrayerSystem(this);
  1589. /**
  1590. * Setting the players weapon.
  1591. */
  1592. public PlayerWeapon playerWeapon = new PlayerWeapon(this);
  1593. /**
  1594. * Clicked the second option on an object.
  1595. */
  1596. public boolean objectOption2 = false;
  1597. /**
  1598. * Clicked the second option on a NPC.
  1599. */
  1600. public boolean npcOption2 = false;
  1601. /**
  1602. * Clicked the third option on a NPC.
  1603. */
  1604. public boolean npcOption3 = false;
  1605. /**
  1606. * Forced chat.
  1607. */
  1608. public String forceChat = "";
  1609. public boolean forceChatUpdateReq = false;
  1610. /**
  1611. * Teleporting variables.
  1612. */
  1613. public int teleX = -1;
  1614. public int teleY = -1;
  1615. public int teleH = -1;
  1616. public int teleDelay = -1;
  1617. public int teleFinishGFX = 0;
  1618. public int teleFinishGFXHeight = 0;
  1619. public int teleFinishAnim = 0;
  1620. /**
  1621. * Delay before recieving packets.
  1622. */
  1623. public int clickDelay = -1;
  1624. public long loginTimeout = System.currentTimeMillis();
  1625. /**
  1626. * Arrays holding the items + their amounts of your bank
  1627. */
  1628. public int[] bankItems = new int[Engine.playerBank.SIZE];
  1629. public int[] bankItemsN = new int[Engine.playerBank.SIZE];
  1630. /**
  1631. * The slot at which each bank tab starts at
  1632. */
  1633. public int[] tabStartSlot = new int[11];
  1634. /**
  1635. * The amount of items that you have last withrawn/deposited with the X function
  1636. */
  1637. public int bankX = 50;
  1638. /**
  1639. * The tab you are viewing, used to store items in it when depositing
  1640. */
  1641. public int viewingBankTab = 10;
  1642. /**
  1643. * If you are withrawing items as a note
  1644. */
  1645. public boolean withdrawNote;
  1646. /**
  1647. * If you are using insert mode
  1648. */
  1649. public boolean insertMode;
  1650.  
  1651. /**
  1652. * Constructs a new Player.
  1653. * @param socket The socket this Player belongs to.
  1654. * @param id The index this player is at.
  1655. */
  1656. public Player(Socket socket, int id) {
  1657. this.socket = new PlayerSocket(this, socket);
  1658. playerId = id;
  1659. look[0] = 0;
  1660. look[1] = 10;
  1661. look[2] = 18;
  1662. look[3] = 26;
  1663. look[4] = 33;
  1664. look[5] = 36;
  1665. look[6] = 42;
  1666. for (int i = 0; i < skillLvl.length; i++) {
  1667. skillLvl[i] = 1;
  1668. skillXP[i] = 0;
  1669. skillLvl[3] = 10;
  1670. skillXP[3] = 1155;
  1671. }
  1672. for (int i = 0; i < items.length; i++) {
  1673. items[i] = -1;
  1674. itemsN[i] = 0;
  1675. }
  1676. for (int i = 0; i < equipment.length; i++) {
  1677. equipment[i] = -1;
  1678. }
  1679. for (int i = 0; i < bankItems.length; i++) {
  1680. bankItems[i] = -1;
  1681. }
  1682. pTrade = new PTrade(this);
  1683. }
  1684.  
  1685. public boolean skillCapeEquiped() {
  1686. for (int i = 10639; i < 10663; i++) {
  1687. for (int j = 9747; j < 9812; j++) {
  1688. if (equipment[1] == i || equipment[1] == j || equipment[1] == 12169 || equipment[1] == 12170) {
  1689. return true;
  1690. }
  1691. }
  1692. }
  1693. return false;
  1694. }
  1695.  
  1696. public int logoutTimer;
  1697. public int BhTimer;
  1698. public int PickupTimer;
  1699. public int BhEntrance;
  1700. public int XLogTimer;
  1701. public int LampTimer;
  1702. public int spearWall;
  1703. public int miasmicSpell;
  1704. public int BhExit;
  1705. public int mageSpellInterface;
  1706. public int restoreSpecialTimer;
  1707. public int delayToWalk = 0;
  1708. public int delayToEntrance = 0;
  1709.  
  1710.  
  1711.  
  1712.  
  1713. public void processTimers() { //Processes evenly at 1000 milliseconds
  1714. if (freezeDelay > 0) {
  1715. freezeDelay--;
  1716. }
  1717. if (vengeanceDelay > 0) {
  1718. vengeanceDelay--;
  1719. }
  1720. /*if (spellbookSwapTimer > 0) {
  1721. spellbookSwapTimer--;
  1722. } else if (spellbookSwap) {
  1723. getActionSender().setTab(this, 79, spellbook);
  1724. spellbookSwap = false;
  1725. usedSpellbookSwap = false;
  1726. }*/
  1727. if (attackedBy != null) {
  1728. count++;
  1729. if (count == 6) {
  1730. attackedBy = null;
  1731. attackedByCount--;
  1732. count = 0;
  1733. }
  1734. }
  1735. if (logoutTimer > 0) {
  1736. logoutTimer--;
  1737. }
  1738. /* if (mageSpellInterface > 0) {
  1739. mageSpellInterface--;
  1740. }
  1741.  
  1742. if (timeInArena > 0) {
  1743. timeInArena--;
  1744. }
  1745. if (delayToEntrance > 0) {
  1746. delayToEntrance--;
  1747. }
  1748. if (delayToEntrance == 0 && xLogged2 == true) {
  1749. this.getActionSender().removeShownInterface(this);
  1750. xLogged2 = false;
  1751. requestFaceCoords(2912, 9909);
  1752. getActionSender().dialogue(this, 2253, 9844, "Wise Old Man", 3, "Nice nerd, you X-Logged. Too bad you got caught.", "Go kill 150 Out Laws and then come back", "and talk to me. I will tele you out after.", "");
  1753. resetHp();
  1754. }
  1755. if (delayToWalk > 0) {
  1756. delayToWalk--;
  1757. }
  1758. if (delayToWalk == 0 && xLogged == true) {
  1759. delayToEntrance = 5;
  1760. playerWalk(2909, 9909, 6132, 0);
  1761. appearanceUpdateReq = true;
  1762. updateReq = true;
  1763. xLogged = false;
  1764. xLogged2 = true;
  1765. */
  1766. if (BhEntrance > 0) {
  1767. BhEntrance--;
  1768. }
  1769. /* if (degradeCorrupt1 > 0) {
  1770. degradeCorrupt1--;
  1771. }
  1772. if (degradeCorrupt2 > 0) {
  1773. degradeCorrupt2--;
  1774. }
  1775. if (degradeCorrupt3 > 0) {
  1776. degradeCorrupt3--;
  1777. }
  1778. if (degradeCorrupt4 > 0) {
  1779. degradeCorrupt4--;
  1780. }
  1781. if (degradeCorrupt5 > 0) {
  1782. degradeCorrupt5--;
  1783. }
  1784. if (degradeCorrupt6 > 0) {
  1785. degradeCorrupt6--;
  1786. }
  1787. if (degradeCorrupt7 > 0) {
  1788. degradeCorrupt7--;
  1789. }
  1790. if (degradeCorrupt8 > 0) {
  1791. degradeCorrupt8--;
  1792. */
  1793. if (BhExit > 0) {
  1794. BhExit--;
  1795. }
  1796. // if (LampTimer > 0) {
  1797. // LampTimer--;
  1798. //}
  1799. //if (spearWall > 0) {
  1800. //spearWall--;
  1801. // }
  1802. //if (miasmicSpell > 0) {
  1803. //miasmicSpell--;
  1804. //}
  1805. //if (XLogTimer > 0) {
  1806. //XLogTimer--;
  1807. //}
  1808. if (BhTimer > 0) {
  1809. BhTimer--;
  1810. this.getActionSender().setString(this, + BhTimer +" seconds", 653, 11);
  1811. }
  1812. if (PickupTimer > 0) {
  1813. PickupTimer--;
  1814. this.getActionSender().setString(this, + PickupTimer +" seconds", 653, 11);
  1815. }
  1816. if (restoreSpecialTimer > 0) {
  1817. restoreSpecialTimer--;
  1818. }
  1819. }
  1820.  
  1821. public boolean onQuestTab = true;
  1822.  
  1823. public List<Long> friends = new ArrayList<Long>(200);
  1824. public List<Long> ignores = new ArrayList<Long>(100);
  1825.  
  1826.  
  1827. /**
  1828. * This method is called every 600 milliseconds.
  1829. * <p>While this is good for for changing integers, this
  1830. * should not be abused. Things that can be handled else where should
  1831. * be done in that way, such as clicking the accept button in trade
  1832. * should update in the ActionsButton class rather than Reqing
  1833. * an update for the process to handle.
  1834. */
  1835.  
  1836. public void attackPlayer() {
  1837. PlayerCombat pc = new PlayerCombat(this);
  1838. pc.attackPlayer();
  1839. }
  1840.  
  1841. public Player target;
  1842.  
  1843. public void getBHTarget() {
  1844. //getActionSender().sendMessage(this, "DEBUG: started to look for a target.");
  1845. int lowestDiff = 100000;
  1846. Player temp = null;
  1847. if (bountyArea() && Overlay == 1) {
  1848. for(Player opp : Engine.bountyHunterPlayers) {
  1849. if(opp != null && opp != this) {
  1850. //getActionSender().sendMessage(this, "DEBUG: found a player that is not me");
  1851. int levelDiff = (opp.combatLevel-this.combatLevel)*(opp.combatLevel-this.combatLevel);//Made it multiply so it cant be negative
  1852. if(lowestDiff > levelDiff) {
  1853. lowestDiff = levelDiff;
  1854. temp = opp;
  1855. }
  1856. }
  1857. }
  1858. target = temp;
  1859. if(temp != null) {
  1860. Engine.bountyHunterPlayers.remove(temp);
  1861. getActionSender().sendMessage(this, "A target has been found, username: "+temp.username);
  1862. getActionSender().setString(this, temp.username, 653, 8);
  1863. }
  1864. }
  1865. }
  1866. public int count;
  1867. public boolean usedLogout;
  1868.  
  1869. // public int incomeCounter = 0;
  1870. // public int backupCounter = 0;
  1871.  
  1872. public void process() {
  1873. if (xLogCheck > 0) {
  1874. xLogCheck--;
  1875. }
  1876.  
  1877. if (ditchDelay > 0) {
  1878. ditchDelay--;
  1879. ditchUpdateReq = true;
  1880. }
  1881. if (ditchUpdateReq) {
  1882. if (ditchDelay >= 1) {
  1883. updateReq = appearanceUpdateReq = true;
  1884. }
  1885. if (ditchDelay <= 0) {
  1886. playerWeapon.setWeapon();
  1887. ditchDelay = 0;
  1888. updateReq = appearanceUpdateReq = true;
  1889. }
  1890. ditchUpdateReq = false;
  1891. }
  1892. if (!onQuestTab) {
  1893. return;
  1894. } else {
  1895. getActionSender().setString(this, "<col=1C39BB>Players Online: " + Engine.getPlayerCount(), 274, 12);
  1896. }
  1897.  
  1898. if (DFSDelay > 0) {
  1899. DFSDelay--;
  1900. } else if (DFSDelay == 0) {
  1901. append1Hit((int)Math.round(Math.random() * 25), 0);
  1902. DFSDelay = -1;
  1903. }
  1904.  
  1905. if (leverTeleportDelay > 0) {
  1906. leverTeleportDelay--;
  1907. } else if (leverTeleportDelay == 0) {
  1908. teleportTo(leverTeleportX, leverTeleportY, leverTeleportH, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
  1909. lever = false;
  1910. leverTeleportDelay--;
  1911. }
  1912.  
  1913. if (mageSpellInterface1 == true && mageSpellInterface == 0) {
  1914. mageSpellInterface1 = false;
  1915. getActionSender().removeShownInterface(this);
  1916. }
  1917. if (bountyArea()) {
  1918. if (teleblocked = true) {
  1919. teleblocked = false;
  1920. }
  1921. if (bhValue() >= 20000000) {
  1922. headIconSkull = 2;
  1923. skullVanishDelay = 1000000;
  1924. isSkulled = true;
  1925. updateReq = appearanceUpdateReq = true;
  1926. }
  1927. if (bhValue() >= 10000000 && bhValue() <= 19999999) {
  1928. headIconSkull = 3;
  1929. skullVanishDelay = 1000000;
  1930. isSkulled = true;
  1931. updateReq = appearanceUpdateReq = true;
  1932. }
  1933. if (bhValue() >= 1000000 && bhValue() <= 9999999) {
  1934. headIconSkull = 4;
  1935. skullVanishDelay = 1000000;
  1936. isSkulled = true;
  1937. updateReq = appearanceUpdateReq = true;
  1938. }
  1939. if (bhValue() >= 500000 && bhValue() <= 999999) {
  1940. headIconSkull = 5;
  1941. skullVanishDelay = 1000000;
  1942. isSkulled = true;
  1943. updateReq = appearanceUpdateReq = true;
  1944. }
  1945. if (bhValue() <= 499999) {
  1946. headIconSkull = 6;
  1947. skullVanishDelay = 1000000;
  1948. isSkulled = true;
  1949. updateReq = appearanceUpdateReq = true;
  1950. }
  1951. if (target != null) {
  1952. getActionSender().setHintIcon(this, 10, target.playerId, 1, 40497);
  1953. }
  1954. }
  1955.  
  1956. if (headIconSkull >= 2 && !bountyArea()) {
  1957. headIconSkull = -1;
  1958. updateReq = appearanceUpdateReq = true;
  1959. }
  1960. if (!bountyArea()) {
  1961. getActionSender().setHintIcon(this, 10, 0, 0, 40497);
  1962. }
  1963. if (teleblocked && teleblockTimer > 0) {
  1964. if (teleblockTimer == 500) {
  1965. getActionSender().sendMessage(this, "You have been teleport blocked!");
  1966. if (usingPrayer(17)) {
  1967. teleblockTimer = 250;
  1968. }
  1969. }
  1970. teleblockTimer--;
  1971. }
  1972. if (teleblockTimer == 0) {
  1973. teleblocked = false;
  1974. teleblockTimer = 500;
  1975. getActionSender().sendMessage(this, "The teleport block has worn off.");
  1976. }
  1977.  
  1978. /* if (LampTimer == 0 && dungeonTimer == true) {
  1979. Choice = 2;
  1980. dungeonTimer = false;
  1981. getActionSender().showChatboxInterface(this, 458);
  1982. getActionSender().setString(this, "Kalphite Queen Lair", 458, 1);
  1983. getActionSender().setString(this, "Corporal Beast", 458, 2);
  1984. getActionSender().setString(this, "Back", 458, 3);
  1985. }
  1986.  
  1987. if (LampTimer == 0 && dungeonTimer2 == true) {
  1988. Choice = 1;
  1989. dungeonTimer2 = false;
  1990. getActionSender().setString(this, "God Wars Dungeon", 458, 1);
  1991. getActionSender().setString(this, "King Black Dragon Lair", 458, 2);
  1992. getActionSender().setString(this, "Next Page", 458, 3);
  1993. getActionSender().showChatboxInterface(this, 458);
  1994. }
  1995.  
  1996. if (degrades && equipment[3] == 13901) {
  1997. degrade--;
  1998. if (degrade == 0) {
  1999. boolean deleted = false;
  2000. PlayerItems playerItems = new PlayerItems();
  2001. for (int i = 0; i < equipment.length; i++) {
  2002. if (equipment[i] == 13901) {
  2003. equipment[i] = -1;
  2004. equipmentN[i] = 0;
  2005. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  2006. getActionSender().sendMessage(this, "Your Vesta's longsword has degraded into nothing.");
  2007. deleted = true;
  2008. break;
  2009. }
  2010. }
  2011. if (!deleted) {
  2012. for (int i = 0; i < items.length; i++) {
  2013. if (items[i] == 13901) {
  2014. playerItems.deleteItem(this, 13901, playerItems.getItemSlot(this, 13901), 1);
  2015. getActionSender().sendMessage(this, "Your Vesta's longsword has degraded into nothing.");
  2016. deleted = true;
  2017. break;
  2018. }
  2019. }
  2020. }
  2021. if (!deleted) {
  2022. for (int i = 0; i < bankItems.length; i++) {
  2023. if (bankItems[i] == 13901) {
  2024. bankItemsN[i]--;
  2025. if (bankItemsN[i] <= 0) {
  2026. bankItems[i] = -1;
  2027. }
  2028. getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
  2029. getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
  2030. getActionSender().setItems(this, 149, 0, 93, items, itemsN);
  2031. getActionSender().sendMessage(this, "Your Vesta's longsword has degraded into nothing.");
  2032. break;
  2033. }
  2034. }
  2035. }
  2036. degrade = 6000;
  2037. degrades = false;
  2038. }
  2039. }
  2040.  
  2041. if (degrades2 && equipment[3] == 13904) {
  2042. degrade2--;
  2043. if (degrade2 == 0) {
  2044. boolean deleted = false;
  2045. PlayerItems playerItems = new PlayerItems();
  2046. for (int i = 0; i < equipment.length; i++) {
  2047. if (equipment[i] == 13904) {
  2048. equipment[i] = -1;
  2049. equipmentN[i] = 0;
  2050. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  2051. getActionSender().sendMessage(this, "Your Statius warhammer has degraded into nothing.");
  2052. deleted = true;
  2053. break;
  2054. }
  2055. }
  2056. if (!deleted) {
  2057. for (int i = 0; i < items.length; i++) {
  2058. if (items[i] == 13904) {
  2059. playerItems.deleteItem(this, 13904, playerItems.getItemSlot(this, 13904), 1);
  2060. getActionSender().sendMessage(this, "Your Statius warhammer has degraded into nothing.");
  2061. deleted = true;
  2062. break;
  2063. }
  2064. }
  2065. }
  2066. if (!deleted) {
  2067. for (int i = 0; i < bankItems.length; i++) {
  2068. if (bankItems[i] == 13904) {
  2069. bankItemsN[i]--;
  2070. if (bankItemsN[i] <= 0) {
  2071. bankItems[i] = -1;
  2072. }
  2073. getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
  2074. getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
  2075. getActionSender().setItems(this, 149, 0, 93, items, itemsN);
  2076. getActionSender().sendMessage(this, "Your Statius warhammer has degraded into nothing.");
  2077. break;
  2078. }
  2079. }
  2080. }
  2081. degrade2 = 6000;
  2082. degrades2 = false;
  2083. }
  2084. }
  2085.  
  2086. if (degradeCorrupt1 < 900) {
  2087. degradesCor1 = true;
  2088. }
  2089.  
  2090. if (degradesCor1 == true && equipment[4] == 13908) {
  2091. if (degradeCorrupt1 == 0) {
  2092. boolean deleted = false;
  2093. PlayerItems playerItems = new PlayerItems();
  2094. for (int i = 0; i < equipment.length; i++) {
  2095. if (equipment[i] == 13908) {
  2096. equipment[i] = -1;
  2097. equipmentN[i] = 0;
  2098. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  2099. getActionSender().sendMessage(this, "Your Statius's PlateBody has degraded into nothing.");
  2100. deleted = true;
  2101. break;
  2102. }
  2103. }
  2104. if (!deleted) {
  2105. for (int i = 0; i < items.length; i++) {
  2106. if (items[i] == 13908) {
  2107. playerItems.deleteItem(this, 13908, playerItems.getItemSlot(this, 13908), 1);
  2108. getActionSender().sendMessage(this, "Your Statius's PlateBody has degraded into nothing.");
  2109. deleted = true;
  2110. break;
  2111. }
  2112. }
  2113. }
  2114. if (!deleted) {
  2115. for (int i = 0; i < bankItems.length; i++) {
  2116. if (bankItems[i] == 13908) {
  2117. bankItemsN[i]--;
  2118. if (bankItemsN[i] <= 0) {
  2119. bankItems[i] = -1;
  2120. }
  2121. getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
  2122. getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
  2123. getActionSender().setItems(this, 149, 0, 93, items, itemsN);
  2124. getActionSender().sendMessage(this, "Your Statius's PlateBody has degraded into nothing.");
  2125. break;
  2126. }
  2127. }
  2128. }
  2129. degradesCor1 = false;
  2130. }
  2131. }
  2132.  
  2133. if (degradesCor2 == true && equipment[4] == 13911) {
  2134. if (degradeCorrupt2 == 0) {
  2135. boolean deleted = false;
  2136. PlayerItems playerItems = new PlayerItems();
  2137. for (int i = 0; i < equipment.length; i++) {
  2138. if (equipment[i] == 13911) {
  2139. equipment[i] = -1;
  2140. equipmentN[i] = 0;
  2141. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  2142. getActionSender().sendMessage(this, "Your Vesta's ChainBody has degraded into nothing.");
  2143. deleted = true;
  2144. break;
  2145. }
  2146. }
  2147. if (!deleted) {
  2148. for (int i = 0; i < items.length; i++) {
  2149. if (items[i] == 13911) {
  2150. playerItems.deleteItem(this, 13911, playerItems.getItemSlot(this, 13911), 1);
  2151. getActionSender().sendMessage(this, "Your Vesta's ChainBody has degraded into nothing.");
  2152. deleted = true;
  2153. break;
  2154. }
  2155. }
  2156. }
  2157. if (!deleted) {
  2158. for (int i = 0; i < bankItems.length; i++) {
  2159. if (bankItems[i] == 13911) {
  2160. bankItemsN[i]--;
  2161. if (bankItemsN[i] <= 0) {
  2162. bankItems[i] = -1;
  2163. }
  2164. getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
  2165. getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
  2166. getActionSender().setItems(this, 149, 0, 93, items, itemsN);
  2167. getActionSender().sendMessage(this, "Your Vesta's ChainBody has degraded into nothing.");
  2168. break;
  2169. }
  2170. }
  2171. }
  2172. degradesCor2 = false;
  2173. }
  2174. }
  2175.  
  2176. if (degradesCor3 == true && equipment[7] == 13914) {
  2177. if (degradeCorrupt3 == 0) {
  2178. boolean deleted = false;
  2179. PlayerItems playerItems = new PlayerItems();
  2180. for (int i = 0; i < equipment.length; i++) {
  2181. if (equipment[i] == 13914) {
  2182. equipment[i] = -1;
  2183. equipmentN[i] = 0;
  2184. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  2185. getActionSender().sendMessage(this, "Your Statius's PlateLegs has degraded into nothing.");
  2186. deleted = true;
  2187. break;
  2188. }
  2189. }
  2190. if (!deleted) {
  2191. for (int i = 0; i < items.length; i++) {
  2192. if (items[i] == 13914) {
  2193. playerItems.deleteItem(this, 13914, playerItems.getItemSlot(this, 13914), 1);
  2194. getActionSender().sendMessage(this, "Your Statius's PlateLegs has degraded into nothing.");
  2195. deleted = true;
  2196. break;
  2197. }
  2198. }
  2199. }
  2200. if (!deleted) {
  2201. for (int i = 0; i < bankItems.length; i++) {
  2202. if (bankItems[i] == 13914) {
  2203. bankItemsN[i]--;
  2204. if (bankItemsN[i] <= 0) {
  2205. bankItems[i] = -1;
  2206. }
  2207. getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
  2208. getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
  2209. getActionSender().setItems(this, 149, 0, 93, items, itemsN);
  2210. getActionSender().sendMessage(this, "Your Statius's PlateLegs has degraded into nothing.");
  2211. break;
  2212. }
  2213. }
  2214. }
  2215. degradesCor3 = false;
  2216. }
  2217. }
  2218.  
  2219. if (degradesCor4 == true && equipment[7] == 13917) {
  2220. if (degradeCorrupt4 == 0) {
  2221. boolean deleted = false;
  2222. PlayerItems playerItems = new PlayerItems();
  2223. for (int i = 0; i < equipment.length; i++) {
  2224. if (equipment[i] == 13917) {
  2225. equipment[i] = -1;
  2226. equipmentN[i] = 0;
  2227. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  2228. getActionSender().sendMessage(this, "Your Vesta's PlateSkirt has degraded into nothing.");
  2229. deleted = true;
  2230. break;
  2231. }
  2232. }
  2233. if (!deleted) {
  2234. for (int i = 0; i < items.length; i++) {
  2235. if (items[i] == 13917) {
  2236. playerItems.deleteItem(this, 13917, playerItems.getItemSlot(this, 13917), 1);
  2237. getActionSender().sendMessage(this, "Your Vesta's PlateSkirt has degraded into nothing.");
  2238. deleted = true;
  2239. break;
  2240. }
  2241. }
  2242. }
  2243. if (!deleted) {
  2244. for (int i = 0; i < bankItems.length; i++) {
  2245. if (bankItems[i] == 13917) {
  2246. bankItemsN[i]--;
  2247. if (bankItemsN[i] <= 0) {
  2248. bankItems[i] = -1;
  2249. }
  2250. getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
  2251. getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
  2252. getActionSender().setItems(this, 149, 0, 93, items, itemsN);
  2253. getActionSender().sendMessage(this, "Your Vesta's PlateSkirt has degraded into nothing.");
  2254. break;
  2255. }
  2256. }
  2257. }
  2258. degradesCor4 = false;
  2259. }
  2260. }
  2261.  
  2262. if (degradesCor5 == true && equipment[7] == 13920) {
  2263. if (degradeCorrupt5 == 0) {
  2264. boolean deleted = false;
  2265. PlayerItems playerItems = new PlayerItems();
  2266. for (int i = 0; i < equipment.length; i++) {
  2267. if (equipment[i] == 13920) {
  2268. equipment[i] = -1;
  2269. equipmentN[i] = 0;
  2270. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  2271. getActionSender().sendMessage(this, "Your Statius's FullHelm has degraded into nothing.");
  2272. deleted = true;
  2273. break;
  2274. }
  2275. }
  2276. if (!deleted) {
  2277. for (int i = 0; i < items.length; i++) {
  2278. if (items[i] == 13920) {
  2279. playerItems.deleteItem(this, 13920, playerItems.getItemSlot(this, 13920), 1);
  2280. getActionSender().sendMessage(this, "Your Statius's FullHelm has degraded into nothing.");
  2281. deleted = true;
  2282. break;
  2283. }
  2284. }
  2285. }
  2286. if (!deleted) {
  2287. for (int i = 0; i < bankItems.length; i++) {
  2288. if (bankItems[i] == 13920) {
  2289. bankItemsN[i]--;
  2290. if (bankItemsN[i] <= 0) {
  2291. bankItems[i] = -1;
  2292. }
  2293. getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
  2294. getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
  2295. getActionSender().setItems(this, 149, 0, 93, items, itemsN);
  2296. getActionSender().sendMessage(this, "Your Statius's FullHelm has degraded into nothing.");
  2297. break;
  2298. }
  2299. }
  2300. }
  2301. degradesCor5 = false;
  2302. }
  2303. }
  2304.  
  2305. if (degradesCor6 == true && equipment[3] == 13923) {
  2306. if (degradeCorrupt6 == 0) {
  2307. boolean deleted = false;
  2308. PlayerItems playerItems = new PlayerItems();
  2309. for (int i = 0; i < equipment.length; i++) {
  2310. if (equipment[i] == 13923) {
  2311. equipment[i] = -1;
  2312. equipmentN[i] = 0;
  2313. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  2314. getActionSender().sendMessage(this, "Your Vesta's LongSword has degraded into nothing.");
  2315. deleted = true;
  2316. break;
  2317. }
  2318. }
  2319. if (!deleted) {
  2320. for (int i = 0; i < items.length; i++) {
  2321. if (items[i] == 13923) {
  2322. playerItems.deleteItem(this, 13923, playerItems.getItemSlot(this, 13923), 1);
  2323. getActionSender().sendMessage(this, "Your Vesta's LongSword has degraded into nothing.");
  2324. deleted = true;
  2325. break;
  2326. }
  2327. }
  2328. }
  2329. if (!deleted) {
  2330. for (int i = 0; i < bankItems.length; i++) {
  2331. if (bankItems[i] == 13923) {
  2332. bankItemsN[i]--;
  2333. if (bankItemsN[i] <= 0) {
  2334. bankItems[i] = -1;
  2335. }
  2336. getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
  2337. getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
  2338. getActionSender().setItems(this, 149, 0, 93, items, itemsN);
  2339. getActionSender().sendMessage(this, "Your Vesta's LongSword has degraded into nothing.");
  2340. break;
  2341. }
  2342. }
  2343. }
  2344. degradesCor6 = false;
  2345. }
  2346. }
  2347.  
  2348. if (degradesCor7 == true && equipment[3] == 13926) {
  2349. if (degradeCorrupt7 == 0) {
  2350. boolean deleted = false;
  2351. PlayerItems playerItems = new PlayerItems();
  2352. for (int i = 0; i < equipment.length; i++) {
  2353. if (equipment[i] == 13926) {
  2354. equipment[i] = -1;
  2355. equipmentN[i] = 0;
  2356. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  2357. getActionSender().sendMessage(this, "Your Statius's WarHammer has degraded into nothing.");
  2358. deleted = true;
  2359. break;
  2360. }
  2361. }
  2362. if (!deleted) {
  2363. for (int i = 0; i < items.length; i++) {
  2364. if (items[i] == 13926) {
  2365. playerItems.deleteItem(this, 13926, playerItems.getItemSlot(this, 13926), 1);
  2366. getActionSender().sendMessage(this, "Your Statius's WarHammer has degraded into nothing.");
  2367. deleted = true;
  2368. break;
  2369. }
  2370. }
  2371. }
  2372. if (!deleted) {
  2373. for (int i = 0; i < bankItems.length; i++) {
  2374. if (bankItems[i] == 13926) {
  2375. bankItemsN[i]--;
  2376. if (bankItemsN[i] <= 0) {
  2377. bankItems[i] = -1;
  2378. }
  2379. getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
  2380. getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
  2381. getActionSender().setItems(this, 149, 0, 93, items, itemsN);
  2382. getActionSender().sendMessage(this, "Your Statius's WarHammer has degraded into nothing.");
  2383. break;
  2384. }
  2385. }
  2386. }
  2387. degradesCor7 = false;
  2388. }
  2389. }
  2390.  
  2391. if (degradesCor8 == true && equipment[3] == 13929) {
  2392. if (degradeCorrupt8 == 0) {
  2393. boolean deleted = false;
  2394. PlayerItems playerItems = new PlayerItems();
  2395. for (int i = 0; i < equipment.length; i++) {
  2396. if (equipment[i] == 13929) {
  2397. equipment[i] = -1;
  2398. equipmentN[i] = 0;
  2399. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  2400. getActionSender().sendMessage(this, "Your Vesta's Spear has degraded into nothing.");
  2401. deleted = true;
  2402. break;
  2403. }
  2404. }
  2405. if (!deleted) {
  2406. for (int i = 0; i < items.length; i++) {
  2407. if (items[i] == 13929) {
  2408. playerItems.deleteItem(this, 13929, playerItems.getItemSlot(this, 13929), 1);
  2409. getActionSender().sendMessage(this, "Your Vesta's Spear has degraded into nothing.");
  2410. deleted = true;
  2411. break;
  2412. }
  2413. }
  2414. }
  2415. if (!deleted) {
  2416. for (int i = 0; i < bankItems.length; i++) {
  2417. if (bankItems[i] == 13929) {
  2418. bankItemsN[i]--;
  2419. if (bankItemsN[i] <= 0) {
  2420. bankItems[i] = -1;
  2421. }
  2422. getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
  2423. getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
  2424. getActionSender().setItems(this, 149, 0, 93, items, itemsN);
  2425. getActionSender().sendMessage(this, "Your Vesta's Spear has degraded into nothing.");
  2426. break;
  2427. }
  2428. }
  2429. }
  2430. degradesCor8 = false;
  2431. }*/
  2432.  
  2433.  
  2434. //====================================FIGHT PITS==========================================
  2435. if(PitGame > 0) PitGame -= 1;
  2436. if(OverTimer > 0) OverTimer -= 1;
  2437. if(OverTimer == 0)
  2438. {
  2439. OverTimer -= 1;
  2440. Overlay = 0;
  2441. }
  2442.  
  2443. if(!AtPits() && !AtWaitRoom() && !fullBounty() && Overlay == 1)
  2444. {
  2445. Overlay = 0;
  2446. getActionSender().removeOverlay(this);
  2447. }
  2448. if(PitGame == 0 && AtPits() && GameStarted == false)
  2449. {
  2450. if(FightEnemys > 1)
  2451. {
  2452. GameStarted = true;
  2453. getActionSender().sendMessage(this, "Game Begins!");
  2454. Overlay = 0;
  2455. }
  2456. else
  2457. {
  2458. GameStarted = false;
  2459. getActionSender().sendMessage(this, "No Enemy's to fight.");
  2460. Engine.FightPitTimer = 120;
  2461. setCoords(2395+Misc.random(8), 5170+Misc.random(4), 0);
  2462. Overlay = 0;
  2463. }
  2464. }
  2465.  
  2466. if(AtPits() && FightEnemys < 2 && GameStarted == true)
  2467. {
  2468. GameStarted = false;
  2469. setCoords(2395+Misc.random(8), 5170+Misc.random(4), 0);
  2470. getActionSender().sendMessage(this, "You are victorious!");
  2471. Engine.playerItems.addItem(this, winnerReward(), 1);
  2472. skillLvl[3] = getLevelForXP(3);
  2473. getActionSender().setSkillLvl(this, 3);
  2474. headIconSkull = 1;
  2475. skullVanishDelay = 120;
  2476. updateReq = appearanceUpdateReq = true;
  2477. Engine.FightPitTimer = 120;
  2478. Overlay = 0;
  2479. for(Player pe : Engine.players) {
  2480. if(pe != null)
  2481. {
  2482. getActionSender().sendMessage(pe, "<col=FF00FF>"+username+ " Level: " +combatLevel+" won fight pits!" );
  2483. }
  2484. }
  2485. }
  2486. if(AtPits())
  2487. {
  2488. getActionSender().setString(this, "Players:", 653, 7);
  2489. getActionSender().setString(this, FightEnemys+"", 653, 8);
  2490. if(Overlay == 0)
  2491. {
  2492. getActionSender().setOverlay(this, 653);
  2493. Overlay = 1;
  2494. }
  2495. }
  2496. else
  2497. if(AtWaitRoom())
  2498. {
  2499. if(Engine.FightPitTimer > 0)
  2500. {
  2501. getActionSender().setString(this, "Time till game starts:", 653, 7);
  2502. getActionSender().setString(this, (Engine.FightPitTimer/2)+"", 653, 8);
  2503. if(Overlay == 0)
  2504. {
  2505. getActionSender().setOverlay(this, 653);
  2506.  
  2507. Overlay = 1;
  2508. }
  2509. }
  2510. else
  2511. {
  2512. getActionSender().setString(this, "Game has started", 653, 7);
  2513. getActionSender().setString(this, "", 653, 8);
  2514. if(Overlay == 0)
  2515. {
  2516. Overlay = 1;
  2517. getActionSender().setOverlay(this, 653);
  2518. }
  2519. }
  2520. }
  2521.  
  2522. if(Engine.FightPitTimer >= 0 && Engine.FightPitTimer <= 2 && AtWaitRoom())
  2523. {
  2524. setCoords(2392+Misc.random(13), 5152+Misc.random(10), 0);
  2525. getActionSender().sendMessage(this, "20 Seconds till you can start attacking opponents.");
  2526. PitGame = 20;
  2527. Overlay = 0;
  2528. }
  2529.  
  2530. for(Player pe : Engine.players) {
  2531. if(pe != null)
  2532. {
  2533. Player pt = Engine.players[pe.playerId];
  2534. if(AtPits())
  2535. {
  2536. pe.FightPeople[playerId] = 1;
  2537. }
  2538. else
  2539. {
  2540. pe.FightPeople[playerId] = 0;
  2541. }
  2542.  
  2543. FightEnemys = FightPeople[1]+
  2544. FightPeople[2]+FightPeople[3]+FightPeople[4]+FightPeople[5]+
  2545. FightPeople[6]+FightPeople[7]+FightPeople[8]+FightPeople[9]+
  2546. FightPeople[10]+FightPeople[11]+FightPeople[12]+FightPeople[13]+
  2547. FightPeople[14]+FightPeople[15]+FightPeople[16]+FightPeople[17]+
  2548. FightPeople[18]+FightPeople[19]+FightPeople[20]+FightPeople[21]+
  2549. FightPeople[22]+FightPeople[23]+FightPeople[24]+FightPeople[25]+
  2550. FightPeople[26]+FightPeople[27]+FightPeople[28]+FightPeople[29]+
  2551. FightPeople[30]+FightPeople[31]+FightPeople[32]+FightPeople[33];
  2552.  
  2553. Engine.playersingame = FightEnemys;
  2554. }
  2555. }
  2556.  
  2557. //====================================END OF FIGHT PITS==========================================
  2558.  
  2559.  
  2560. /*for(Player pe : Engine.players) {
  2561. if(pe != null)
  2562. {
  2563. Player pt = Engine.players[pe.playerId];
  2564. if(pkArena())
  2565. {
  2566. pe.FightPeople2[playerId] = 1;
  2567. }
  2568. else
  2569. {
  2570. pe.FightPeople2[playerId] = 0;
  2571. }
  2572.  
  2573. FightEnemys2 = FightPeople2[1]+
  2574. FightPeople2[2]+FightPeople2[3]+FightPeople2[4]+FightPeople2[5]+
  2575. FightPeople2[6]+FightPeople2[7]+FightPeople2[8]+FightPeople2[9]+
  2576. FightPeople2[10]+FightPeople2[11]+FightPeople2[12]+FightPeople2[13]+
  2577. FightPeople2[14]+FightPeople2[15]+FightPeople2[16]+FightPeople2[17]+
  2578. FightPeople2[18]+FightPeople2[19]+FightPeople2[20]+FightPeople2[21]+
  2579. FightPeople2[22]+FightPeople2[23]+FightPeople2[24]+FightPeople2[25]+
  2580. FightPeople2[26]+FightPeople2[27]+FightPeople2[28]+FightPeople2[29]+
  2581. FightPeople2[30]+FightPeople2[31]+FightPeople2[32]+FightPeople2[33];
  2582.  
  2583. Engine.playersinarena = FightEnemys2;
  2584. }
  2585. }
  2586.  
  2587. if (pkArena() && gaveTime == false) {
  2588. timeInArena = 300;
  2589. gaveTime = true;
  2590. }*/
  2591.  
  2592. if (magicGraphicDelay > 0) {
  2593. magicGraphicDelay--;
  2594. } else if (magicGraphicDelay == 0) {
  2595. PlayerMagic playerMagic = new PlayerMagic(this);
  2596. playerMagic.appendGraphic(spellbook, spell);
  2597. magicGraphicDelay--;
  2598. }
  2599. if (magicDamageDelay > 0) {
  2600. magicDamageDelay--;
  2601. } else if (magicDamageDelay == 0) {
  2602. PlayerMagic playerMagic = new PlayerMagic(this);
  2603. playerMagic.appendDamage(spellbook, spell);
  2604. magicDamageDelay--;
  2605. }
  2606. if (magicAffectDelay > 0) {
  2607. magicAffectDelay--;
  2608. } else if (magicAffectDelay == 0) {
  2609. PlayerMagic playerMagic = new PlayerMagic(this);
  2610. playerMagic.appendAffect(spellbook, spell);
  2611. magicAffectDelay--;
  2612. }
  2613. if (cuedSpells > 0 && combatDelay == 0) {
  2614. try {
  2615. Player opp = Server.engine.players[magicOppIndex];
  2616. PlayerMagic playerMagic = new PlayerMagic(this);
  2617. playerMagic.combatMagic(opp, spellbook, cuedSpell);
  2618. cuedSpells = 0;
  2619. } catch (Exception e) {
  2620. }
  2621. }
  2622.  
  2623. if (usingPrayer()) {
  2624. drainCount += prayerDrain();
  2625. if (!isDead) {
  2626. if (drainCount >= 1) {
  2627. skillLvl[5]--;
  2628. getActionSender().setSkillLvl(this, 5);
  2629. drainCount--;
  2630. }
  2631. }
  2632. if (skillLvl[5] <= 0) {
  2633. skillLvl[5] = 0;
  2634. getActionSender().addSoundEffect(this, 2672, 1, 0, 0);
  2635. getActionSender().setSkillLvl(this, 5);
  2636. getActionSender().sendMessage(this, "You have run out of Prayer points; you must recharge at an altar.");
  2637. resetPrayer();
  2638. }
  2639. }
  2640.  
  2641. getDuelClass().process();
  2642. if (disconnected[1] && skillLvl[3] == 0) {
  2643. disconnected[0] = true;
  2644. XLogTimer = 30;
  2645. isXlogged = true;
  2646. }
  2647. if (XLogTimer == 0 && isXlogged == true) {
  2648. try {
  2649. if (heightLevel != 0) heightLevel = 0;
  2650. Engine.fileManager.saveCharacter(this);
  2651. isXlogged = false;
  2652. } catch (Exception e) {
  2653. }
  2654. disconnected[1] = true;
  2655. }
  2656. if (disconnected[0] && (usedLogout || attackedBy == null)) {
  2657. if(bountyArea()) {
  2658. Engine.bountyHunterPlayers.remove(this);
  2659. for(Player player : Engine.players) {
  2660. if(player != null && player.target == this) {
  2661. player.getActionSender().sendMessage(player, "Your target has logged off!");
  2662. player.getActionSender().setString(player, "None", 653, 8);
  2663. Engine.bountyHunterPlayers.add(player);
  2664. player.target = null;
  2665. }
  2666. }
  2667. }
  2668. try {
  2669. if (heightLevel != 0) heightLevel = 0;
  2670. Engine.fileManager.saveCharacter(this);
  2671. } catch (Exception e) {
  2672. }
  2673. if (pTrade.getPartner() != null) {
  2674. pTrade.declineTrade();
  2675. }
  2676. disconnected[1] = true;
  2677. }
  2678. /**
  2679. * Warrior Guild
  2680. */
  2681. if (!enteredDefenceRoom) {
  2682. if (absX == 2842 && absY == 3545 && heightLevel == 1)
  2683. getWarriorClass().addWarriorDefenceEvent();
  2684. enteredDefenceRoom = false;
  2685. }
  2686. if (thievingArray[0] > 0)
  2687. thievingArray[0]--;
  2688. if (thievingArray[0] == 0) {
  2689. PlayerThieving thievClass = new PlayerThieving(this);
  2690. thievClass.addStallThievingEvent();
  2691. }
  2692. if (thievingArray[3] > 0)
  2693. thievingArray[3]--;
  2694. if (nextGraphicDelay > 0)
  2695. nextGraphicDelay--;
  2696. if (nextGraphicDelay == 0) {
  2697. PlayerCombat playerAttacking = new PlayerCombat(this);
  2698. playerAttacking.addNextAttack();
  2699. }
  2700. if (nextDamageDelay > 0)
  2701. nextDamageDelay--;
  2702. if (nextDamageDelay == 0) {
  2703. PlayerCombat playerAttacking = new PlayerCombat(this);
  2704. playerAttacking.addNextDamage();
  2705. }
  2706. if (fletchDelay > 0)
  2707. fletchDelay--;
  2708.  
  2709. if (fletchDelay == 0 && isFletching)
  2710. getFletchingClass().appendFletchingEngine();
  2711.  
  2712. if (summonTeleDelay > 0) {
  2713. summonTeleDelay--;
  2714. }
  2715. if (summonTeleDelay == 0) {
  2716. setCoords(3069, 10257, 0);
  2717. summonTeleDelay = -1;
  2718. requestAnim(715, 0);
  2719. }
  2720. if (summonDrainDelay > 0) {
  2721. summonDrainDelay--;
  2722. }
  2723. if (summonDrainDelay == 0) {
  2724. if (skillLvl[23] > 0) {
  2725. skillLvl[23]--;
  2726. getActionSender().setSkillLvl(this, 23);
  2727. summonDrainDelay = 14;
  2728. } else {
  2729. familiarDissMiss = true;
  2730. summonedFamiliar = false;
  2731. summonDrainDelay = -1;
  2732. getActionSender().sendMessage(this, "You ran out of Summoning skill points, Please restore them.");
  2733. }
  2734. }
  2735. if (deathEmoteDelay > 0) {
  2736. deathEmoteDelay--;
  2737. }
  2738. if (deathEmoteDelay == 0) {
  2739. requestAnim(9055, 0); //836, 2261
  2740. Server.engine.newNPC(2862, this.absX-1, this.absY, this.heightLevel, 0, 0, 0, 0, false, 0);
  2741. if (usingPrayer(22)) {
  2742. requestGFX(437, 0);
  2743. if (multiwayCombatZone(absX, absY)) {
  2744. try {
  2745. for (Player player : Server.engine.players) {
  2746. if (Misc.getDistance(absX, absY, player.absX, player.absY) <= 1) {
  2747. player.append1Hit(getRandom((int)Math.floor(getLevelForXP(5) * 0.25)), 0);
  2748. }
  2749. }
  2750. } catch (Exception e) {
  2751. }
  2752. } else {
  2753. try {
  2754. Server.engine.players[hitIndex].append1Hit(getRandom((int)Math.floor(getLevelForXP(5) * 0.25)), 0);
  2755. } catch (Exception e) {
  2756. }
  2757. }
  2758. }
  2759.  
  2760. isDead = true;
  2761. deathDelay = 4;
  2762. deathEmoteDelay = -1;
  2763. }
  2764. if (massYellDelay > 0) {
  2765. massYellDelay--;
  2766. }
  2767. if (clickDelay > 0) {
  2768. clickDelay--;
  2769. }
  2770. if (teleDelay > 0) {
  2771. teleDelay--;
  2772. }
  2773. if (equipSpecDelay > 0) {
  2774. equipSpecDelay--;
  2775. }
  2776. if (waveDelay > 0) {
  2777. waveDelay--;
  2778. }
  2779. if (waveDelay == 0) {
  2780. fCave.fightSystem();
  2781. }
  2782. if (countDelay > 0) {
  2783. countDelay--;
  2784. }
  2785. if (countDelay == 0) {
  2786. if (countType >= 0) {
  2787. if (countType == 3) {
  2788. requestForceChat("3");
  2789. } else if (countType == 2) {
  2790. requestForceChat("2");
  2791. } else if (countType == 1) {
  2792. requestForceChat("1");
  2793. } else if (countType == 0) {
  2794. requestForceChat("FIGHT!");
  2795. }
  2796. countType--;
  2797. countDelay = 3;
  2798. } else {
  2799. countType = -1;
  2800. countDelay = -1;
  2801. }
  2802. }
  2803. if (explodeDelay > 0) {
  2804. explodeDelay--;
  2805. }
  2806. if (explodeDelay == 0) {
  2807. appendPotion();
  2808. }
  2809. if (rangeDmgDelay > 0) {
  2810. rangeDmgDelay--;
  2811. }
  2812. if (rangeDmgDelay == 0) {
  2813. PlayerCombat PC2 = new PlayerCombat(this);
  2814. PC2.appendRangeDamage();
  2815. }
  2816. if (rangeDmgDelay2 > 0) {
  2817. rangeDmgDelay2--;
  2818. }
  2819. if (rangeDmgDelay2 == 0) {
  2820. PlayerCombat PC2 = new PlayerCombat(this);
  2821. PC2.appendRangeDamage();
  2822. }
  2823. if (damageSpecDelay > 0) {
  2824. damageSpecDelay--;
  2825. }
  2826. if (damageSpecDelay == 0 && enableSpecDamage) {
  2827. PlayerCombat playCb2 = new PlayerCombat(this);
  2828. playCb2.appendNpcDamageMeleeSpec();
  2829. }
  2830. if (damageDelay1 > 0) {
  2831. damageDelay1--;
  2832. }
  2833. if (damageDelay1 == 0 && enableDamage) {
  2834. PlayerCombat playerCb = new PlayerCombat(this);
  2835. playerCb.appendNpcDamageMelee();
  2836. }
  2837. if (atkDelay > 0) {
  2838. atkDelay--;
  2839. }
  2840. if (atkDelay == 0 && attackingNpc) {
  2841. PlayerCombat playCb = new PlayerCombat(this);
  2842. playCb.attackNpc();
  2843. }
  2844. if (buryDelay > 0) {
  2845. buryDelay--;
  2846. }
  2847. if (battleCDelay > 0) {
  2848. battleCDelay--;
  2849. }
  2850. if (battleCDelay == 0) {
  2851. battleCount = 0;
  2852. battleCDelay = -1;
  2853. }
  2854. if (pickPocketDelay > 0) {
  2855. pickPocketDelay--;
  2856. }
  2857. if (skullVanishDelay > 0) {
  2858. skullVanishDelay--;
  2859. }
  2860. if (skullVanishDelay == 0 && isSkulled) {
  2861. headIconSkull = -1;
  2862. isSkulled = false;
  2863. skullVanishDelay = 0;
  2864. appearanceUpdateReq = true;
  2865. updateReq = true;
  2866. getActionSender().sendMessage(this, "noob");
  2867. }
  2868. if (eatDelay > 0) {
  2869. eatDelay--;
  2870. }
  2871. if (drinkDelay > 0) {
  2872. drinkDelay--;
  2873. }
  2874.  
  2875. if (statDelay > 0) {
  2876. statDelay -= usingPrayer(8) ? 2 : 1;
  2877. } else {
  2878. updateStats();
  2879. }
  2880. if (hpDelay > 0) {
  2881. hpDelay -= usingPrayer(9) ? 2 : 1;
  2882. } else {
  2883. restoreHP();
  2884. }
  2885.  
  2886. if (poisonDelay > 0) {
  2887. poisonDelay--;
  2888. }
  2889. if (isPoisoned && poisonDelay == 0) {
  2890. double intreval = (poisonHitCount / 3) - poisonIntrevals;
  2891. if (poisonHitCount == 0) {
  2892. poisonDamage = getStartingPoisonDamage(Server.engine.players[enemyIndex]);
  2893. } else if (intreval == 1) {
  2894. poisonIntrevals++;
  2895. poisonDamage -= poisonIntrevals;
  2896. }
  2897. if (poisonDamage == 0) {
  2898. isPoisoned = false;
  2899. poisonHitCount = 0;
  2900. poisonIntrevals = 0;
  2901. getActionSender().sendMessage(this, "The poison wears off.");
  2902. return;
  2903. }
  2904. appendHit(poisonDamage, 1);
  2905. poisonDelay = 100;
  2906. poisonHitCount++;
  2907. }
  2908.  
  2909. if (specFillDelay > 0) {
  2910. if (specAmount < 1000) {
  2911. specFillDelay--;
  2912. } else {
  2913. specFillDelay = 50;
  2914. }
  2915. } else {
  2916. if (specAmount < 1000) {
  2917. if (specAmount - 100 > 900) {
  2918. specAmount = 1000;
  2919. } else {
  2920. specAmount += 100;
  2921. }
  2922. getActionSender().setConfig2(this, 300, specAmount);
  2923. }
  2924. specFillDelay = 50;
  2925. }
  2926.  
  2927. if (animClickDelay > 0) {
  2928. animClickDelay--;
  2929. }
  2930. if (agilityDelay > 0) {
  2931. agilityDelay--;
  2932. }
  2933. if (agilityDelay == 0 && agilityPerforming) {
  2934. PlayerAgility pa = new PlayerAgility(this);
  2935. pa.resetPerforming();
  2936. }
  2937. if (deathDelay > 0) {
  2938. deathDelay--;
  2939. }
  2940. if (waitDeathDelay > 0) {
  2941. waitDeathDelay--;
  2942. }
  2943.  
  2944. //if (skillLvl[3] <= 0 && waitDeathDelay == -1 && !randomVariable) {
  2945. // waitDeathDelay = 3;
  2946. // resetAttack();
  2947. // deathEmoteDelay = 3;
  2948. // if (duelFight())
  2949. // duelDeath = true;
  2950. // randomVariable = true;
  2951. // isDead = true;
  2952. //}
  2953.  
  2954. if (deathDelay == 0 && isDead) {
  2955. appendDeath();
  2956. }
  2957. if (combatDelay > 0) {
  2958. combatDelay--;
  2959. }
  2960. if (attackingPlayer) {
  2961. attackPlayer();
  2962. }
  2963. if (damageDelay > 0) {
  2964. damageDelay--;
  2965. }
  2966. if (damageDelay == 0) {
  2967. PlayerCombat PC = new PlayerCombat(this);
  2968. PC.appendDamages();
  2969. }
  2970. if (mageDelay > 0) {
  2971. mageDelay--;
  2972. }
  2973. if (specDelay > 0) {
  2974. specDelay--;
  2975. }
  2976. if (specDelay == 0) {
  2977. PlayerCombat PC1 = new PlayerCombat(this);
  2978. PC1.appendSpecDamage();
  2979. }
  2980. if (secondSpecDelay > 0) {
  2981. secondSpecDelay--;
  2982. }
  2983. if (secondSpecDelay == 0) {
  2984. PlayerCombat PC1 = new PlayerCombat(this);
  2985. PC1.appendSecondSpecDamage();
  2986. }
  2987. if (delayedDamageDelay > 0) {
  2988. delayedDamageDelay--;
  2989. }
  2990. if (delayedDamageDelay == 0) {
  2991. PlayerCombat PC1 = new PlayerCombat(this);
  2992. PC1.appendDelayedDamage(delayedDamageHit);
  2993. }
  2994. if (runEnergyDelay > 0) {
  2995. runEnergyDelay--;
  2996. } else {
  2997. if (runEnergy < 100) {
  2998. runEnergy++;
  2999. runEnergyUpdateReq = true;
  3000. }
  3001. runEnergyDelay = 4;
  3002. }
  3003. if (itemPickup) {
  3004. Engine.packets.pickupItem.handlePacket(this, 0, 0);
  3005. }
  3006. if (playerOption1) {
  3007. Engine.packets.playerOption1.handlePacket(this, 0, 0);
  3008. }
  3009. if (playerOption2) {
  3010. Engine.packets.playerOption2.handlePacket(this, 0, 0);
  3011. }
  3012. if (playerOption3) {
  3013. Engine.packets.playerOption3.handlePacket(this, 0, 0);
  3014. }
  3015. if (npcOption1) {
  3016. Engine.packets.npcOption1.handlePacket(this, 0, 0);
  3017. }
  3018. if (npcOption2) {
  3019. Engine.packets.npcOption2.handlePacket(this, 0, 0);
  3020. }
  3021. if (npcOption3) {
  3022. Engine.packets.npcOption3.handlePacket(this, 0, 0);
  3023. }
  3024. if (objectOption1) {
  3025. Engine.packets.objectOption1.handlePacket(this, 0, 0);
  3026. }
  3027. if (objectOption2) {
  3028. Engine.packets.objectOption2.handlePacket(this, 0, 0);
  3029. }
  3030. if (runEnergyUpdateReq) {
  3031. getActionSender().setEnergy(this);
  3032. runEnergyUpdateReq = false;
  3033. }
  3034. appendWilderness();
  3035. if (teleDelay == 0) {
  3036. teleDelay = -1;
  3037. if (teletab) {
  3038. requestAnim(teleFinishAnim, 0);
  3039. requestGFX(teleFinishGFX, teleFinishGFXHeight);
  3040. teleDelay = 2;
  3041. teleFinishAnim = playerWeapon.getStandEmote(equipment[3]);
  3042. teleFinishGFX = -1;
  3043. } else {
  3044. setCoords(teleX, teleY, teleH);
  3045. if (teleFinishAnim != -1) {
  3046. requestAnim(teleFinishAnim, 0);
  3047. }
  3048. if (teleFinishGFX != -1) {
  3049. requestGFX(teleFinishGFX, teleFinishGFXHeight);
  3050. }
  3051. }
  3052. if (!teletab) {
  3053. teleX = teleY = -1;
  3054. }
  3055. teletab = false;
  3056. }
  3057. if (clickDelay == 0) {
  3058. clickDelay = -1;
  3059. }
  3060. if(bountyArea() && target == null) {
  3061. getBHTarget();
  3062. }
  3063. }
  3064.  
  3065. public void potion(int potionID) {
  3066. int root = 0;
  3067. int toAdd = 0;
  3068. int i = 0;
  3069. switch (potionID) {
  3070. case 2436:
  3071. case 145:
  3072. case 147:
  3073. case 149:
  3074. root = getLevelForXP(0);
  3075. toAdd = 5 + (int)Math.round(root * 0.1414141414);
  3076. if ((skillLvl[0] + toAdd) > (root + toAdd)) {
  3077. skillLvl[0] = root + toAdd;
  3078. } else {
  3079. skillLvl[0] += toAdd;
  3080. }
  3081. getActionSender().setSkillLvl(this, 0);
  3082. break;
  3083.  
  3084. case 2440:
  3085. case 157:
  3086. case 159:
  3087. case 161:
  3088. root = getLevelForXP(2);
  3089. toAdd = 5 + (int)Math.round(root * 0.1414141414);
  3090. if ((skillLvl[2] + toAdd) > (root + toAdd)) {
  3091. skillLvl[2] = root + toAdd;
  3092. } else {
  3093. skillLvl[2] += toAdd;
  3094. }
  3095. getActionSender().setSkillLvl(this, 2);
  3096. break;
  3097.  
  3098. case 2442:
  3099. case 163:
  3100. case 165:
  3101. case 167:
  3102. root = getLevelForXP(1);
  3103. toAdd = 5 + (int)Math.round(root * 0.1414141414);
  3104. if ((skillLvl[1] + toAdd) > (root + toAdd)) {
  3105. skillLvl[1] = root + toAdd;
  3106. } else {
  3107. skillLvl[1] += toAdd;
  3108. }
  3109. getActionSender().setSkillLvl(this, 1);
  3110. break;
  3111.  
  3112. case 2444:
  3113. case 169:
  3114. case 171:
  3115. case 173:
  3116. root = getLevelForXP(4);
  3117. toAdd = 4 + (int)Math.round(root * 0.1509090909);
  3118. if ((skillLvl[4] + toAdd) > (root + toAdd)) {
  3119. skillLvl[4] = root + toAdd;
  3120. } else {
  3121. skillLvl[4] += toAdd;
  3122. }
  3123. getActionSender().setSkillLvl(this, 4);
  3124. break;
  3125.  
  3126. case 3040:
  3127. case 3042:
  3128. case 3044:
  3129. case 3046:
  3130. if (skillLvl[6] + 4 > getLevelForXP(6) + 4) {
  3131. skillLvl[6] = getLevelForXP(6) + 4;
  3132. } else {
  3133. skillLvl[6] += 4;
  3134. }
  3135. getActionSender().setSkillLvl(this, 6);
  3136. break;
  3137.  
  3138. case 2428:
  3139. case 121:
  3140. case 123:
  3141. case 125:
  3142. root = getLevelForXP(0);
  3143. toAdd = 3 + (int)Math.round(root * 0.0909090909);
  3144. if ((skillLvl[0] + toAdd) > (root + toAdd)) {
  3145. skillLvl[0] = root + toAdd;
  3146. } else {
  3147. skillLvl[0] += toAdd;
  3148. }
  3149. getActionSender().setSkillLvl(this, 0);
  3150. break;
  3151.  
  3152. case 113:
  3153. case 115:
  3154. case 117:
  3155. case 119:
  3156. root = getLevelForXP(2);
  3157. toAdd = 3 + (int)Math.round(root * 0.0909090909);
  3158. if ((skillLvl[2] + toAdd) > (root + toAdd)) {
  3159. skillLvl[2] = root + toAdd;
  3160. } else {
  3161. skillLvl[2] += toAdd;
  3162. }
  3163. getActionSender().setSkillLvl(this, 2);
  3164. break;
  3165.  
  3166. case 2432:
  3167. case 133:
  3168. case 135:
  3169. case 137:
  3170. root = getLevelForXP(1);
  3171. toAdd = 3 + (int)Math.round(root * 0.0909090909);
  3172. if ((skillLvl[1] + toAdd) > (root + toAdd)) {
  3173. skillLvl[1] = root + toAdd;
  3174. } else {
  3175. skillLvl[1] += toAdd;
  3176. }
  3177. getActionSender().setSkillLvl(this, 1);
  3178. break;
  3179.  
  3180. case 2434:
  3181. case 139:
  3182. case 141:
  3183. case 143:
  3184. root = getLevelForXP(5);
  3185. toAdd = 7 + (int)Math.round(root * 0.2424242424);
  3186. if ((skillLvl[5] + toAdd) > root) {
  3187. if (skillLvl[5] < root) {
  3188. skillLvl[5] = root;
  3189. }
  3190. } else {
  3191. skillLvl[5] += toAdd;
  3192. }
  3193. getActionSender().setSkillLvl(this, 5);
  3194. break;
  3195.  
  3196. case 2430:
  3197. case 127:
  3198. case 129:
  3199. case 131:
  3200. while (i <= 6) {
  3201. if (i == 3 || i == 5) {
  3202. i++;
  3203. }
  3204. root = getLevelForXP(i);
  3205. toAdd = 10 + (int)Math.round(root * 0.2929292929);
  3206. if ((skillLvl[i] + toAdd) > root) {
  3207. if (skillLvl[i] < root) {
  3208. skillLvl[i] = root;
  3209. }
  3210. } else {
  3211. skillLvl[i] += toAdd;
  3212. }
  3213. getActionSender().setSkillLvl(this, i);
  3214. i++;
  3215. }
  3216. break;
  3217.  
  3218. case 3024:
  3219. case 3026:
  3220. case 3028:
  3221. case 3030:
  3222. while (i <= 23) {
  3223. if (i == 3) {
  3224. i++;
  3225. }
  3226. root = getLevelForXP(i);
  3227. toAdd = 8 + (int)Math.round(root * 0.2424242424);
  3228. if ((skillLvl[i] + toAdd) > root) {
  3229. if (skillLvl[i] < root) {
  3230. skillLvl[i] = root;
  3231. }
  3232. } else {
  3233. skillLvl[i] += toAdd;
  3234. }
  3235. getActionSender().setSkillLvl(this, i);
  3236. i++;
  3237. }
  3238. break;
  3239.  
  3240. case 6685:
  3241. case 6687:
  3242. case 6689:
  3243. case 6691:
  3244. while (i <= 6) {
  3245. if (i == 5) {
  3246. i++;
  3247. }
  3248. root = getLevelForXP(i);
  3249. if (i == 0 || i == 2 || i == 4 || i == 6) {
  3250. toAdd = -1 * (2 + (int)Math.round(root * 0.0707070707));
  3251. if ((skillLvl[i] + toAdd) < 0) {
  3252. skillLvl[i] = 0;
  3253. } else {
  3254. skillLvl[i] += toAdd;
  3255. }
  3256. } else {
  3257. toAdd = 2 + (int)Math.round(root * (i == 1 ? 0.1919191919 : 0.1414141414));
  3258. if (skillLvl[i] + toAdd > root + toAdd) {
  3259. skillLvl[i] = root + toAdd;
  3260. } else {
  3261. skillLvl[i] += toAdd;
  3262. }
  3263. }
  3264. getActionSender().setSkillLvl(this, i);
  3265. i++;
  3266. }
  3267. break;
  3268.  
  3269. case 2450:
  3270. case 189:
  3271. case 191:
  3272. case 193:
  3273. while (i <= 5) {
  3274. if (i == 4) {
  3275. i++;
  3276. }
  3277. root = getLevelForXP(i);
  3278. if (i == 5) {
  3279. toAdd = 9;
  3280. if (skillLvl[i] + toAdd > root) {
  3281. if (skillLvl[i] < root) {
  3282. skillLvl[i] = root;
  3283. }
  3284. } else {
  3285. skillLvl[i] += toAdd;
  3286. }
  3287. break;
  3288. }
  3289. if (i == 1 || i == 3) {
  3290. toAdd = -1 * (2 + (int)Math.round(root * 0.0909090909));
  3291. if (i == 3) {
  3292. append1Hit(-1 * toAdd, 0);
  3293. } else {
  3294. if ((skillLvl[i] + toAdd) < 0) {
  3295. skillLvl[i] = 0;
  3296. } else {
  3297. skillLvl[i] += toAdd;
  3298. }
  3299. }
  3300. } else {
  3301. toAdd = 2 + (int)Math.round(root * (i == 0 ? 0.1919191919 : 0.1111111111));
  3302. if (skillLvl[i] + toAdd > root + toAdd) {
  3303. skillLvl[i] = root + toAdd;
  3304. } else {
  3305. skillLvl[i] += toAdd;
  3306. }
  3307. }
  3308. getActionSender().setSkillLvl(this, i);
  3309. i++;
  3310. }
  3311. break;
  3312. }
  3313. requestAnim(829, 0);
  3314. getActionSender().addSoundEffect(this, 2401, 1, 0, 0);
  3315. combatDelay = 6;
  3316. eatDelay = 3;
  3317. drinkDelay = 3;
  3318. }
  3319.  
  3320. public void food(int foodID) {
  3321. int healAmount = 0;
  3322. int toDelayCombat = 6;
  3323. int toDelayEat = 3;
  3324. switch (foodID) {
  3325. case 373:
  3326. healAmount = 14;
  3327. toDelayCombat = combatDelay;
  3328. drinkDelay = 3;
  3329. break;
  3330. case 379: healAmount = 12; break;
  3331. case 385: healAmount = 20; break;
  3332. case 391: healAmount = 22; break;
  3333. case 3144:
  3334. healAmount = 18;
  3335. break;
  3336. case 10476:
  3337. healAmount = 1 + Misc.random(2);
  3338. runEnergy += runEnergy * .10;
  3339. runEnergyUpdateReq = true;
  3340. if (runEnergy + (runEnergy * .10) > 100) {
  3341. runEnergy = 100;
  3342. }
  3343. break;
  3344. case 14540:
  3345. skillLvl[3] = getLevelForXP(3);
  3346. getActionSender().setSkillLvl(this, 3);
  3347. skillLvl[5] = getLevelForXP(5);
  3348. getActionSender().setSkillLvl(this, 5);
  3349. specAmount = 1000;
  3350. getActionSender().setConfig2(this, 300, 1000);
  3351. runEnergy = 100;
  3352. runEnergyUpdateReq = true;
  3353. break;
  3354. case 14543:
  3355. skillLvl[3] = getLevelForXP(3);
  3356. getActionSender().setSkillLvl(this, 3);
  3357. break;
  3358. case 7060: healAmount = 22; break;
  3359. case 7946: healAmount = 16; break;
  3360. }
  3361. requestAnim(829, 0);
  3362. getActionSender().addSoundEffect(this, 2393, 1, 0, 0);
  3363. updateHP(healAmount, true);
  3364. getActionSender().sendMessage(this, "You eat the "+Engine.items.getItemName(foodID)+".");
  3365. combatDelay = toDelayCombat;
  3366. eatDelay = toDelayEat;
  3367. }
  3368.  
  3369. public String lastKilled = "";
  3370. public boolean receivesPVPDrop(Player p, Player opp) {
  3371. if (Server.socketListener.getAddress(p.socket.socket).equals(Server.socketListener.getAddress(opp.socket.socket))) {
  3372. return false;
  3373. }
  3374. return true;
  3375. }
  3376.  
  3377. public void msgToAll(String msg)
  3378. {
  3379. for(Player ap : Server.engine.players)
  3380. {
  3381. if(ap != null)
  3382. {
  3383. getActionSender().sendMessage(ap,msg);
  3384. }
  3385. }
  3386. }
  3387.  
  3388. public void appendDeath() {
  3389. if (deathDelay == 0 && isDead) {
  3390. Player opp = Server.engine.players[hitIndex];
  3391. Player po = Engine.players[Opposing];
  3392.  
  3393. try {
  3394. if (!AtPits() && !AtClanField()) {
  3395. //if (rights < 2) {
  3396. dropStuff(opp.username);
  3397. //}
  3398. }
  3399. getActionSender().sendMessage(opp, getKillMessage(username));
  3400. if (pkArena()) {
  3401. opp.killedInPkArena = 1;
  3402. }
  3403. if (receivesPVPDrop(this, opp) && !AtPits() && !AtClanField()) {
  3404. opp.kills++;
  3405. opp.totalKills++;
  3406.  
  3407. DC++;
  3408. opp.KC++;
  3409. }
  3410.  
  3411. if(bountyArea()) {
  3412. if(opp.target != this && opp.BhTimer == 0) {
  3413. /*for(Player hunterOfThis : Engine.players) {
  3414. if(hunterOfThis.target == this) {
  3415. hunterOfThis.target = null;
  3416. hunterOfThis.getActionSender().setString(hunterOfThis, "None", 653, 8);
  3417. }
  3418. }*/
  3419. Engine.bountyHunterPlayers.add(this.target);
  3420. Engine.bountyHunterPlayers.remove(this);
  3421. Overlay = 0;
  3422. target = null;
  3423. //this.target.target = null;//
  3424. //this.target.getActionSender().setString(this.target, "None", 653, 8);//
  3425. opp.PickupTimer = 120;
  3426. opp.getActionSender().setInterfaceConfig(opp, 653, 9, false);
  3427. opp.getActionSender().setString(opp, "Can't pickup:", 653, 10);
  3428. opp.getActionSender().setOverlay(opp, 653);
  3429. opp.getActionSender().sendMessage(opp, "You have killed "+username+" in Bounty Hunter. If you loot in the next 120 seconds you");
  3430. opp.getActionSender().sendMessage(opp, "shall recieve a penalty making you unable to leave the Bounty Hunter Crater.");
  3431. } else if(opp.target == this && opp.BhTimer == 0) {
  3432. Engine.bountyHunterPlayers.add(opp);
  3433. Engine.bountyHunterPlayers.remove(this);
  3434. Overlay = 0;
  3435. opp.getActionSender().sendMessage(opp, "You have defeated "+username+" who was your target.!");
  3436. opp.getActionSender().setString(opp, "None", 653, 8);
  3437. opp.target = null;
  3438. target = null;
  3439. }
  3440. /*
  3441. for(Player player : Engine.players) {
  3442. if(BhTimer == 0 && player.target != this) {
  3443. Overlay = 0;
  3444. opp.PickupTimer = 120;
  3445. getActionSender().setInterfaceConfig(opp, 653, 9, false);
  3446. //getActionSender().setInterfaceConfig(opp, 653, 11, true);
  3447. getActionSender().setString(opp, "Can't pickup:", 653, 10);
  3448. //getActionSender().setString(opp, +PickupTimer+" seconds", 653, 11);
  3449. getActionSender().setOverlay(opp, 653);
  3450. getActionSender().sendMessage(opp, "You have killed "+username+" in Bounty Hunter. If you loot in the next 120 seconds you");
  3451. getActionSender().sendMessage(opp, "shall recieve a penalty making you unable to leave the Bounty Hunter Creater.");
  3452. } else {
  3453.  
  3454. }
  3455. }*/
  3456. }/*
  3457. for(Player player : Engine.players) {
  3458. if(player != null && player.target == this) {
  3459. if (bountyArea()) {
  3460. Engine.bountyHunterPlayers.remove(this);
  3461. Overlay = 0;
  3462. player.getActionSender().sendMessage(player, "You have defeated "+username+" who was your target.!");
  3463. player.getActionSender().setString(player, "None", 653, 8);
  3464. Engine.bountyHunterPlayers.add(player);
  3465. player.target = null;
  3466. }
  3467. }
  3468. } */
  3469.  
  3470. if (Server.socketListener.getAddress(socket.socket).equals(opp.lastKilled)) {
  3471. Engine.fileManager.appendData("characters/logs/flagged.txt", opp.username);
  3472. }
  3473. opp.lastKilled = Server.socketListener.getAddress(socket.socket);
  3474. Engine.fileManager.appendData("characters/logs/kills/"+opp.username+".txt", username);
  3475. } catch (Exception e) {
  3476. }
  3477.  
  3478. for (int i = 0; i < skillLvl.length; i++) {
  3479. skillLvl[i] = getLevelForXP(i);
  3480. getActionSender().setSkillLvl(this, i);
  3481. }
  3482. for (int i = 0; i < 1000; i++) {
  3483. requestAnim(playerWeapon.getStandEmote(equipment[3]), 0);
  3484. }
  3485.  
  3486. if (opp != null) {
  3487. opp.attacking = null;
  3488. opp.attackedBy = null;
  3489. opp.oppIndex = 0;
  3490. opp.hitIndex = 0;
  3491. opp.resetAttack();
  3492. opp.requestFaceTo(65535);
  3493. }
  3494. attacking = null;
  3495. attackedBy = null;
  3496. oppIndex = 0;
  3497. hitIndex = 0;
  3498. resetAttack();
  3499.  
  3500. if (AtPits() && !isPVP()) setCoords(2395+Misc.random(8), 5170+Misc.random(4), 0);
  3501. getActionSender().sendMessage(this, "Oh dear, you have died!");
  3502.  
  3503. if (isPVP() && !AtPits()) setCoords(spawnX + Misc.random(1), spawnY + Misc.random(3), 0);
  3504. getActionSender().sendMessage(this, "Oh dear, you have died!");
  3505.  
  3506. if (!isPVP() && !AtPits()) setCoords(spawnX + Misc.random(1), spawnY + Misc.random(3), 0);
  3507. getActionSender().sendMessage(this, "Oh dear, you have died!");
  3508.  
  3509. if (inEdgePk()) setCoords(3093, 3490, 0);
  3510. getActionSender().sendMessage(this, "Oh dear, you have died!");
  3511.  
  3512. if(AtClanField())
  3513. {
  3514. for(Player pz : Engine.players) {
  3515. if (pz != null) {
  3516. if(pz.clanchat == clanchat)
  3517. {
  3518. //pz.ClanCount -= 1;
  3519. }
  3520. }
  3521. }
  3522. if(ClanSide == 1)
  3523. {
  3524. setCoords(3320, 3781, clanheight);
  3525. }
  3526. else
  3527. {
  3528. setCoords(3320, 3770, clanheight);
  3529. }
  3530.  
  3531. }
  3532.  
  3533. if (xLogJail()) setCoords(this.absX, this.absY, 0);
  3534.  
  3535. deathDelay = -1;
  3536. isDead = false;
  3537.  
  3538. magicGraphicDelay = -1;
  3539. magicDamageDelay = -1;
  3540.  
  3541. initialAttack = false;
  3542. isSkulled = false;
  3543. headIconSkull = -1;
  3544. skullVanishDelay = 0;
  3545.  
  3546. BhTimer = 0;
  3547. PickupTimer = 0;
  3548.  
  3549. isPoisoned = false;
  3550. poisonHitCount = 0;
  3551. poisonDelay = 0;
  3552.  
  3553. specAmount = 1000;
  3554. getActionSender().setConfig2(this, 300, 1000);
  3555.  
  3556. resetPrayer();
  3557.  
  3558. getActionSender().removeOverlay(this);
  3559.  
  3560. appearanceUpdateReq = true;
  3561. updateReq = true;
  3562. }
  3563. }
  3564.  
  3565. public void resetAttack() {
  3566. attackingPlayer = false;
  3567. enemyIndex = 0;
  3568. oppIndex = 0;
  3569. hitOne = false;
  3570. hitTwo = false;
  3571. hitThree = false;
  3572. hitFour = false;
  3573. hit1 = 0;
  3574. hit2 = 0;
  3575. hit3 = 0;
  3576. hit4 = 0;
  3577. specDelay = -1;
  3578. secondSpecDelay = -1;
  3579. }
  3580.  
  3581. /**
  3582. * Get xp based on your level.
  3583. * @param skillId The skill level to get the level based off XP for.
  3584. * @return Returns the level based on the amount of XP the specified skill has.
  3585. */
  3586. public int getLevelForXP(int skillId) {
  3587. int exp = skillXP[skillId];
  3588. int points = 0;
  3589. int output = 0;
  3590. for (int lvl = 1; lvl < 100; lvl++) {
  3591. points += Math.floor((double)lvl + 300.0 * Math.pow(2.0, (double)lvl / 7.0));
  3592. output = (int)Math.floor(points / 4);
  3593. if ((output - 1) >= exp) {
  3594. return lvl;
  3595. }
  3596. }
  3597. return 99;
  3598. }
  3599.  
  3600. /**
  3601. * Calculates equipment bonus.
  3602. */
  3603. public void calculateEquipmentBonus() {
  3604. for (int i = 0; i < equipmentBonus.length; i++) {
  3605. equipmentBonus[i] = 0;
  3606. }
  3607. for (int i = 0; i < equipment.length; i++) {
  3608. if (equipment[i] > -1) {
  3609. for (int j = 0; j < Engine.items.maxListedItems; j++) {
  3610. if (Engine.items.itemLists[j] != null) {
  3611. if (Engine.items.itemLists[j].itemId == equipment[i]) {
  3612. for (int k = 0; k < equipmentBonus.length; k++) {
  3613. equipmentBonus[k] += Engine.items.itemLists[j].bonuses[k];
  3614. }
  3615. break;
  3616. }
  3617. }
  3618. }
  3619. }
  3620. }
  3621. }
  3622.  
  3623. /**
  3624. * Writes the equipment bonus.
  3625. */
  3626. public void setEquipmentBonus() {
  3627. String[] bonusNames = Misc.bonusNames;
  3628. int id = 35;
  3629. for (int i = 0; i < equipmentBonus.length; i++) {
  3630. getActionSender().setString(this, bonusNames[i] + ": " + (equipmentBonus[i] >= 0 ? "+" : "") + equipmentBonus[i], 667, id++);
  3631. if (id == 45) {
  3632. id = 47;
  3633. }
  3634. }
  3635. getActionSender().setString(this, "Summoning: +0", 667, 45);
  3636. }
  3637.  
  3638. public void openBank() {
  3639. getActionSender().setConfig2(this, 563, 4194304); //???
  3640. getActionSender().setConfig(this, 115, withdrawNote ? 1 : 0);
  3641. getActionSender().setConfig(this, 305, insertMode ? 1 : 0);
  3642. Engine.playerBank.sendTabConfig(this);
  3643. getActionSender().showInterface(this, 762);
  3644. getActionSender().setInventory(this, 763);
  3645. getActionSender().setBankOptions(this);
  3646. getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
  3647. getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
  3648. //getActionSender().hideTabs(this); code to hide inventory & tabs
  3649. getActionSender().setInterfaceConfig(this, 762, 18, true); //Hide some buttons
  3650. getActionSender().setInterfaceConfig(this, 762, 19, true); //Remove it
  3651. getActionSender().setInterfaceConfig(this, 762, 23, true); //If ya want
  3652. viewingBankTab = 10;
  3653. getActionSender().setString(this, "Bank of "+this.username, 762, 24);
  3654. getActionSender().setString(this, ""+Engine.playerBank.SIZE, 762, 98);
  3655. }
  3656.  
  3657. public void updateHP(int difference, boolean heal) {
  3658. if (skillLvl[3] == 0) {
  3659. xLogCheck = 30;
  3660. return;
  3661. }
  3662. if (heal) {
  3663. skillLvl[3] += difference;
  3664. if (skillLvl[3] > getLevelForXP(3)) {
  3665. skillLvl[3] = getLevelForXP(3);
  3666. }
  3667. } else if (!heal) {
  3668. skillLvl[3] -= difference;
  3669. if (skillLvl[3] <= 0) {
  3670. skillLvl[3] = 0;
  3671. deathEmoteDelay = 3;
  3672. isDead = true;
  3673. attacking = null;
  3674. attackedBy = null;
  3675. Engine.playerMovement.resetWalkingQueue(this);
  3676. requestFaceTo(65535);
  3677. }
  3678. }
  3679. getActionSender().setSkillLvl(this, 3);
  3680. if ((skillLvl[3] <= Math.round(getLevelForXP(3) * 0.10) && skillLvl[3] > 0) && usingPrayer(23)) {
  3681. requestGFX(436, 0);
  3682. getActionSender().addSoundEffect(this, 2681, 1, 0, 0);
  3683. skillLvl[3] += Math.round(getLevelForXP(5) * 0.25);
  3684. skillLvl[5] = 0;
  3685. getActionSender().setSkillLvl(this, 5);
  3686. }
  3687. }
  3688.  
  3689. /**
  3690. * Teleports a player.
  3691. * @param x The x coordinate to teleport to.
  3692. * @param y The y coordinate to teleport to.
  3693. * @param height The height level to teleport to.
  3694. * @param delay The delay before the teleport is done.
  3695. * @param distance The offset you can teleport to, such as 1 for a max offset of x +/- 1 and y +/- 1.
  3696. * @param emoteStart The emote to do right away.
  3697. * @param emoteEnd The emote to do after teleporting.
  3698. * @param gfxStart The graphic to do right away.
  3699. * @param gfxStartH The height level to create the start graphic at.
  3700. * @param gfxEnd The graphic to do after the teleport is done.
  3701. * @param gfxEndH The finish graphic height.
  3702. */
  3703. public void teleportTo(int x, int y, int height, int delay, int distance, int emoteStart, int emoteEnd, int gfxStart,
  3704. int gfxStartH, int gfxEnd, int gfxEndH) {
  3705. if (teleblocked) {
  3706. getActionSender().sendMessage(this, "You are teleport blocked!");
  3707. return;
  3708. }
  3709. if (inJail())
  3710. {
  3711. getActionSender().sendMessage(this, "You can't teleport out you fool, serve your punishment!");
  3712. return;
  3713. }
  3714. if (xLogJail() || xLogged || xLogged2 || pkArena()) {
  3715. return;
  3716. }
  3717. if (getWildernessLevel() >= 20 && !lever && !fullBounty() && !mageBankInside() && !AtWaitRoom()) {
  3718. getActionSender().sendMessage(this, "A magical force stops you from teleporting.");
  3719. return;
  3720. }
  3721. itemPickup = false;
  3722. playerOption1 = false;
  3723. playerOption2 = false;
  3724. playerOption3 = false;
  3725. npcOption1 = false;
  3726. npcOption2 = false;
  3727. npcOption3 = false;
  3728. objectOption1 = false;
  3729. objectOption2 = false;
  3730. attackingPlayer = false;
  3731. clickDelay = delay + 2;
  3732. teleDelay = delay;
  3733. if (distance > 0) {
  3734. int xType = Misc.random(1);
  3735. int yType = Misc.random(1);
  3736. int xOffset = Misc.random(distance);
  3737. int yOffset = Misc.random(distance);
  3738. if (xType == 1)
  3739. x += -xOffset;
  3740. else
  3741. x += xOffset;
  3742. if(yType == 1)
  3743. y += -yOffset;
  3744. else
  3745. y += yOffset;
  3746. }
  3747. teleX = x;
  3748. teleY = y;
  3749. teleH = height;
  3750. Engine.playerMovement.resetWalkingQueue(this);
  3751. requestAnim(emoteStart, 0);
  3752. requestGFX(gfxStart, gfxStartH);
  3753. teleFinishGFX = gfxEnd;
  3754. teleFinishGFXHeight = gfxEndH;
  3755. teleFinishAnim = emoteEnd;
  3756. }
  3757.  
  3758. /**
  3759. * Set the player's coordinates.
  3760. * @param x The x coordinate to teleport to.
  3761. * @param y The y coordinate to teleport to.
  3762. */
  3763. public void setCoords(int x, int y, int height) {
  3764. teleportToX = x;
  3765. teleportToY = y;
  3766. heightLevel = height;
  3767. didTeleport = true;
  3768. }
  3769.  
  3770. /**
  3771. * Req an animation for this player.
  3772. * @param animId The amination to perform.
  3773. * @param animD The delay before doing the animation.
  3774. */
  3775. public void requestAnim(int animId, int animD) {
  3776. animReq = animId;
  3777. animDelay = animD;
  3778. animUpdateReq = true;
  3779. updateReq = true;
  3780. }
  3781.  
  3782. /**
  3783. * Req an graphic for this player.
  3784. * @param gfxId The graphic to perform.
  3785. * @param gfxD The delay or height or the gfx depending on the value.
  3786. */
  3787. public void requestGFX(int gfxId, int gfxD) {
  3788. if (gfxD >= 100) {
  3789. gfxD += 6553500;
  3790. }
  3791. gfxReq = gfxId;
  3792. gfxDelay = gfxD;
  3793. gfxUpdateReq = true;
  3794. updateReq = true;
  3795. }
  3796.  
  3797. /**
  3798. * Req this player faces NPC or player.
  3799. * @param faceId The target to face.
  3800. */
  3801. public void requestFaceTo(int faceId) {
  3802. faceToReq = faceId;
  3803. faceToUpdateReq = true;
  3804. updateReq = true;
  3805. }
  3806. /**
  3807. * Request this player faces two coordinates.
  3808. * @param x The x coordinate to face.
  3809. * @param y The y coordinate to face.
  3810. */
  3811. public void requestFaceCoords(int x, int y) {
  3812. faceCoordsX = 2 * x + 1;
  3813. faceCoordsY = 2 * y + 1;
  3814. faceCoordsUpdateReq = true;
  3815. updateReq = true;
  3816. }
  3817.  
  3818. int poisonDamage;
  3819. int poisonIntrevals = 0;
  3820. public int getStartingPoisonDamage(Player p2) {
  3821. String name = "";
  3822. int damage = 0;
  3823. boolean usingRange = false;
  3824. if ((p2.equipment[3] >= 839 && p2.equipment[3] <= 861) || (p2.equipment[3] >= 9174 && p2.equipment[3] <= 9185) || p2.equipment[3] == 11235) { //Ranged
  3825. name = Engine.items.getItemName(equipment[13]);
  3826. usingRange = true;
  3827. } else { //Melee
  3828. name = Engine.items.getItemName(p2.equipment[3]);
  3829. }
  3830. if (name.contains("(p++)")) {
  3831. damage = usingRange ? 4 : 6;
  3832. }
  3833. if (name.contains("(p+)")) {
  3834. damage = usingRange ? 3 : 5;
  3835. }
  3836. if (name.contains("(p)")) {
  3837. damage = usingRange ? 2 : 4;
  3838. }
  3839. return damage;
  3840. }
  3841.  
  3842. public int totalDamageRecoiled;
  3843.  
  3844. public void appendNPCHit(int damage, int poison) {
  3845. if (damage > skillLvl[3]) {
  3846. damage = skillLvl[3];
  3847. }
  3848. updateHP(damage, false);
  3849. if (!hit1UpdateReq) {
  3850. hitDiff1 = damage;
  3851. poisonHit1 = poison;
  3852. hit1UpdateReq = true;
  3853. } else {
  3854. hitDiff2 = damage;
  3855. poisonHit2 = poison;
  3856. hit2UpdateReq = true;
  3857. }
  3858. updateReq = true;
  3859. }
  3860.  
  3861. public void appendHit(int damage, int poison) {
  3862. Player opp = Server.engine.players[hitIndex];
  3863. if (opp != null) {
  3864. if (opp.isDead) {
  3865. return;
  3866. }
  3867. if (damage > skillLvl[3]) {
  3868. damage = skillLvl[3];
  3869. }
  3870. updateHP(damage, false);
  3871. if (autoRetaliate) {
  3872. enemyIndex = hitIndex;
  3873. attackingPlayer = true;
  3874. }
  3875. int[] skill = {-1, -1, -1};
  3876. if (!usingMage) {
  3877. switch (opp.attackStyle()) {
  3878. case 1:
  3879. skill[0] = 0;
  3880. skill[1] = 0;
  3881. skill[2] = 0;
  3882. break;
  3883. case 2:
  3884. skill[0] = 2;
  3885. skill[1] = 2;
  3886. skill[2] = 2;
  3887. break;
  3888. case 3:
  3889. skill[0] = 1;
  3890. skill[1] = 1;
  3891. skill[2] = 1;
  3892. break;
  3893. case 4:
  3894. skill[0] = 0;
  3895. skill[1] = 1;
  3896. skill[2] = 2;
  3897. break;
  3898. case 5:
  3899. case 6:
  3900. skill[0] = 4;
  3901. skill[1] = 4;
  3902. skill[2] = 4;
  3903. break;
  3904. case 7:
  3905. opp.appendExperience((damage * 500), 4);
  3906. opp.appendExperience((damage * 500), 1);
  3907. opp.appendExperience((damage * 500), 3);
  3908. break;
  3909. }
  3910. for (int i : skill) {
  3911. if (i != -1) {
  3912. opp.appendExperience((damage * 500), i);
  3913. }
  3914. }
  3915. opp.appendExperience((damage * 500), 3);
  3916. }
  3917. if (opp.usingPrayer(24) && poison == 0) { //Smite
  3918. if (skillLvl[5] - (int)Math.round(damage * 0.25) > 0) {
  3919. skillLvl[5] -= (int)Math.round(damage / 4);
  3920. getActionSender().setSkillLvl(this, 5);
  3921. } else {
  3922. skillLvl[5] = 0;
  3923. getActionSender().setSkillLvl(this, 5);
  3924. }
  3925. }
  3926. if (vengeance && poison == 0) { //Vengeance
  3927. if (damage > 0) {
  3928. if (skillLvl[3] > 0) {
  3929. opp.append1Hit(((int)Math.floor(damage * 0.75)), 0);
  3930. } else {
  3931. opp.append1Hit(0, 0);
  3932. }
  3933. requestForceChat("Taste vengeance!");
  3934. vengeance = false;
  3935. }
  3936. }
  3937. if (equipment[12] == 2550 && poison == 0) { //Ring of recoil
  3938. if (damage > 0) {
  3939. if (skillLvl[3] > 0) {
  3940. int recoil = 1 + ((int)Math.floor(damage * 0.10));
  3941. opp.append1Hit(recoil, 0);
  3942. totalDamageRecoiled += recoil;
  3943. if (totalDamageRecoiled >= 40) {
  3944. equipment[12] = -1;
  3945. equipmentN[12] = 0;
  3946. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  3947. getActionSender().sendMessage(this, "Your ring of recoil has shattered.");
  3948. totalDamageRecoiled = 0;
  3949. }
  3950. } else {
  3951. opp.append1Hit(0, 0);
  3952. }
  3953. }
  3954. }
  3955. if (opp.barrowsSet(3) && poison == 0) { //Guthans affect
  3956. if (Math.random() <= 0.25) {
  3957. opp.updateHP(damage, true);
  3958. requestGFX(398, 0);
  3959. }
  3960. }
  3961. if (!hit1UpdateReq) {
  3962. hitDiff1 = damage;
  3963. poisonHit1 = poison;
  3964. hit1UpdateReq = true;
  3965. } else {
  3966. hitDiff2 = damage;
  3967. poisonHit2 = poison;
  3968. hit2UpdateReq = true;
  3969. }
  3970. updateReq = true;
  3971. }
  3972. }
  3973.  
  3974. /**
  3975. * Append damage.
  3976. */
  3977. public void append1Hit(int damage, int poison) {
  3978. if (damage > skillLvl[3]) {
  3979. damage = skillLvl[3];
  3980. }
  3981. updateHP(damage, false);
  3982. if (!hit1UpdateReq) {
  3983. hitDiff1 = damage;
  3984. poisonHit1 = poison;
  3985. hit1UpdateReq = true;
  3986. } else {
  3987. hitDiff2 = damage;
  3988. poisonHit2 = poison;
  3989. hit2UpdateReq = true;
  3990. }
  3991. updateReq = true;
  3992. }
  3993.  
  3994. /**
  3995. * Block anims.
  3996. */
  3997. public int getBlockAnim() {
  3998. if (equipment[3] == 4031) {
  3999. return 221;
  4000. }
  4001. if (equipment[5] == 8850) {
  4002. return 4177;
  4003. }
  4004. return 1156;
  4005. }
  4006.  
  4007. /**
  4008. * Block anims.
  4009. */
  4010. public int getBlockAnim1() {
  4011. if (equipment[3] == 4031) {
  4012. return 221;
  4013. }
  4014. if (equipment[3] == 4151) {
  4015. return 1659;
  4016. }
  4017. if (equipment[3] == 4718 ||
  4018. equipment[3] == -1) {
  4019. return 424;
  4020. }
  4021. if (equipment[3] == 4755) {
  4022. return 2063;
  4023. }
  4024. if (equipment[3] == 10887) {
  4025. return 5866;
  4026. }
  4027. if (equipment[3] == 4153) {
  4028. return 1666;
  4029. }
  4030. if (equipment[3] == 11694 ||
  4031. equipment[3] == 11696 ||
  4032. equipment[3] == 11698 ||
  4033. equipment[3] == 11700 ||
  4034. equipment[3] == 1307 ||
  4035. equipment[3] == 1309 ||
  4036. equipment[3] == 1311 ||
  4037. equipment[3] == 1313 ||
  4038. equipment[3] == 1315 ||
  4039. equipment[3] == 1317 ||
  4040. equipment[3] == 1319 ||
  4041. equipment[3] == 7158 ||
  4042. equipment[3] == 11730) {
  4043. return 7050;
  4044. }
  4045. if (equipment[3] == 3204) {
  4046. return 420;
  4047. }
  4048. return 404;
  4049. }
  4050.  
  4051. /**
  4052. * Force chat text.
  4053. */
  4054. public void requestForceChat(String s) {
  4055. forceChat = s;
  4056. forceChatUpdateReq = true;
  4057. updateReq = true;
  4058. }
  4059. public boolean quickChat;
  4060. public void requestForceChat2(String s) {
  4061. quickChat = true;
  4062. chatTextUpdateReq = true;
  4063. chatText = s;
  4064. updateReq = true;
  4065. }
  4066.  
  4067. public int getArmourDef() {
  4068. switch (equipment[4]) {
  4069.  
  4070. case 1127: return 80;
  4071. case 4712: return 120;
  4072. case 4757: return 140;
  4073. case 4720: return 140;
  4074. case 3140: return 100;
  4075. case 10551: return 70;
  4076. case 11720: return 215;
  4077. case 11724: return 220;
  4078. }
  4079. return 10;
  4080. }
  4081.  
  4082. public int getRangeArmourDef() {
  4083. switch (equipment[4]) {
  4084.  
  4085. case 1135: return 115;
  4086. case 2499: return 140;
  4087. case 2501: return 165;
  4088. case 2503: return 190;
  4089. case 11720: return 200;
  4090. }
  4091. return 40;
  4092. }
  4093.  
  4094. public int getRangeBonus() {
  4095. switch (equipment[3]) {
  4096.  
  4097. case 841: return 65;
  4098. case 843: return 80;
  4099. case 845: return 85;
  4100. case 847: return 90;
  4101. case 849: return 95;
  4102. case 851: return 100;
  4103. case 853: return 120;
  4104. case 855: return 130;
  4105. case 857: return 150;
  4106. case 859: return 165;
  4107. case 861: return 180;
  4108. case 9185: return 280;
  4109. case 11235: return 160;
  4110. }
  4111. return 60;
  4112. }
  4113.  
  4114. public boolean defile;
  4115.  
  4116. public void checkVeracs() {
  4117. if (barrowsSet(6)) {
  4118. if (Math.random() <= 0.15) {
  4119. defile = true;
  4120. }
  4121. } else {
  4122. defile = false;
  4123. }
  4124. }
  4125.  
  4126. public double accuracy = 1;
  4127.  
  4128. public double meleeAccuracy(Player opp) {
  4129. if (opp == null || this.isDead || opp.isDead || this.disconnected[0] || opp.disconnected[0]) {
  4130. return 1;
  4131. }
  4132. double attack = skillLvl[0];
  4133. double defence = opp.skillLvl[1];
  4134. int activeAttackBonus = weaponStyle(equipment[3]) - 1;
  4135. int activeDefenceBonus = activeAttackBonus + 5;
  4136. double attackBonus = equipmentBonus[activeAttackBonus];
  4137. double defenceBonus = opp.equipmentBonus[activeDefenceBonus];
  4138. if (usingPrayer(2)) {
  4139. attack *= 1.05;
  4140. }
  4141. if (usingPrayer(7)) {
  4142. attack *= 1.10;
  4143. }
  4144. if (usingPrayer(15)) {
  4145. attack *= 1.15;
  4146. }
  4147. if (usingPrayer(25)) {
  4148. attack *= 1.15;
  4149. }
  4150. if (usingPrayer(26)) {
  4151. attack *= 1.20;
  4152. }
  4153. if (attackStyle() == 4) {
  4154. attack += 1;
  4155. }
  4156. if (attackStyle() == 1) {
  4157. attack += 3;
  4158. }
  4159. if (opp.usingPrayer(0)) {
  4160. defence *= 1.05;
  4161. }
  4162. if (opp.usingPrayer(5)) {
  4163. defence *= 1.10;
  4164. }
  4165. if (opp.usingPrayer(13)) {
  4166. defence *= 1.15;
  4167. }
  4168. if (opp.usingPrayer(25)) {
  4169. defence *= 1.20;
  4170. }
  4171. if (opp.usingPrayer(26)) {
  4172. defence *= 1.25;
  4173. }
  4174. if (opp.attackStyle() == 4) {
  4175. defence += 1;
  4176. }
  4177. if (opp.attackStyle() == 3) {
  4178. defence += 3;
  4179. }
  4180. if (attackBonus < 0) {
  4181. attackBonus = 0;
  4182. }
  4183. if (defenceBonus < 0) {
  4184. defenceBonus = 0;
  4185. }
  4186. if (defile) {
  4187. defenceBonus = 0;
  4188. }
  4189. double offensiveAttribute = (attack * 1.5) + attackBonus;
  4190. double defensiveAttribute = (defence * 1.5) + defenceBonus;
  4191. double difference = Math.abs(offensiveAttribute - defensiveAttribute);
  4192. boolean positive = offensiveAttribute > defensiveAttribute;
  4193. double interval = difference * 0.0015;
  4194. double percentage = 0.55;
  4195. if (!positive) {
  4196. percentage -= interval;
  4197. }
  4198. if (positive) {
  4199. percentage += interval;
  4200. }
  4201. if (accuracy != 1) {
  4202. percentage *= accuracy;
  4203. accuracy = 1;
  4204. }
  4205. return percentage;
  4206. }
  4207.  
  4208. public boolean hitPlayer(Player opp) {
  4209. return Math.random() <= meleeAccuracy(opp);
  4210. }
  4211.  
  4212. public double rangeAccuracy(Player opp) {
  4213. if (opp == null || this.isDead || opp.isDead || this.disconnected[0] || opp.disconnected[0]) {
  4214. return 1;
  4215. }
  4216. double range = skillLvl[4];
  4217. double defence = opp.skillLvl[1];
  4218. double rangeBonus = equipmentBonus[4];
  4219. double defenceBonus = opp.equipmentBonus[9];
  4220. if (usingPrayer(3)) {
  4221. range *= 1.05;
  4222. }
  4223. if (usingPrayer(11)) {
  4224. range *= 1.10;
  4225. }
  4226. if (usingPrayer(20)) {
  4227. range *= 1.15;
  4228. }
  4229. if (attackStyle() == 5) {
  4230. range += 1;
  4231. }
  4232. if (opp.usingPrayer(0)) {
  4233. defence *= 1.05;
  4234. }
  4235. if (opp.usingPrayer(5)) {
  4236. defence *= 1.10;
  4237. }
  4238. if (opp.usingPrayer(13)) {
  4239. defence *= 1.15;
  4240. }
  4241. if (opp.usingPrayer(25)) {
  4242. defence *= 1.20;
  4243. }
  4244. if (opp.usingPrayer(26)) {
  4245. defence *= 1.25;
  4246. }
  4247. if (opp.attackStyle() == 4) {
  4248. defence += 1;
  4249. }
  4250. if (opp.attackStyle() == 3) {
  4251. defence += 3;
  4252. }
  4253. if (rangeBonus < 0) {
  4254. rangeBonus = 0;
  4255. }
  4256. if (defenceBonus < 0) {
  4257. defenceBonus = 0;
  4258. }
  4259. double offensiveAttribute = range + rangeBonus;
  4260. double defensiveAttribute = defence + defenceBonus;
  4261. double difference = Math.abs(offensiveAttribute - defensiveAttribute);
  4262. boolean positive = offensiveAttribute > defensiveAttribute;
  4263. double interval = difference * 0.00175;
  4264. double percentage = 0.50;
  4265. if (!positive) {
  4266. percentage -= interval;
  4267. }
  4268. if (positive) {
  4269. percentage += interval;
  4270. }
  4271. if (accuracy != 1) {
  4272. percentage *= accuracy;
  4273. accuracy = 1;
  4274. }
  4275. return percentage;
  4276. }
  4277.  
  4278. public boolean hitPlayerRange(Player opp) {
  4279. return Math.random() <= rangeAccuracy(opp);
  4280. }
  4281.  
  4282. public boolean barrowsSet(int setID) {
  4283. String helmet = Engine.items.getItemName(equipment[0]);
  4284. String platebody = Engine.items.getItemName(equipment[4]);
  4285. String weapon = Engine.items.getItemName(equipment[3]);
  4286. String platelegs = Engine.items.getItemName(equipment[7]);
  4287. String set = "";
  4288. switch (setID) {
  4289. case 1: //Ahrim's
  4290. set = "Ahrim";
  4291. break;
  4292. case 2: //Dharok's
  4293. set = "Dharok";
  4294. break;
  4295. case 3: //Guthan's
  4296. set = "Guthan";
  4297. break;
  4298. case 4: //Karil's
  4299. set = "Karil";
  4300. break;
  4301. case 5: //Torag's
  4302. set = "Torag";
  4303. break;
  4304. case 6: //Verac's
  4305. set = "Verac";
  4306. break;
  4307. }
  4308. boolean hasHelmet = helmet.contains(set);
  4309. boolean hasPlatebody = platebody.contains(set);
  4310. boolean hasWeapon = weapon.contains(set);
  4311. boolean hasPlatelegs = platelegs.contains(set);
  4312. if (hasHelmet && hasPlatebody && hasWeapon && hasPlatelegs) {
  4313. return true;
  4314. }
  4315. return false;
  4316. }
  4317. public boolean voidSet(int setID) {
  4318. String helmet = Engine.items.getItemName(equipment[0]);
  4319. String set = "";
  4320. switch (setID) {
  4321. case 1: //Melee
  4322. set = "Void melee";
  4323. break;
  4324. case 2: //Range
  4325. set = "Void ranger";
  4326. break;
  4327. case 3: //Mage
  4328. set = "Void mage";
  4329. break;
  4330. }
  4331. boolean hasHelmet = helmet.contains(set);
  4332. boolean hasTop = equipment[4] == 8839;
  4333. boolean hasGloves = equipment[9] == 8842;
  4334. boolean hasBottom = equipment[7] == 8840;
  4335. if (hasHelmet && hasTop && hasGloves && hasBottom) {
  4336. return true;
  4337. }
  4338. return false;
  4339. }
  4340.  
  4341. public boolean hasProperArrows(int bow, int arrows) {
  4342. if (usingSpecial) {
  4343. if (weapon == 861 || weapon == 11235) {
  4344. if (equipmentN[13] <= 1) {
  4345. getActionSender().sendMessage(this, "You don't have enough ammo!");
  4346. return false;
  4347. }
  4348. }
  4349. }
  4350. if (bow >= 839 && bow <= 861) {
  4351. switch (arrows) {
  4352. case 882:
  4353. case 884:
  4354. case 886:
  4355. case 888:
  4356. case 890:
  4357. case 892: return true;
  4358. }
  4359. }
  4360. if (bow == 11235) {
  4361. switch (arrows) {
  4362. case 882:
  4363. case 884:
  4364. case 886:
  4365. case 888:
  4366. case 890:
  4367. case 892:
  4368. case 11212:
  4369. if (equipmentN[13] > 1) {
  4370. return true;
  4371. } else {
  4372. getActionSender().sendMessage(this, "You don't have enough ammo!");
  4373. return false;
  4374. }
  4375. }
  4376. }
  4377. if (bow == 4214 || bow == 868 || bow == 11230) {
  4378. return true;
  4379. }
  4380. if (bow == 9185) {
  4381. switch (arrows) {
  4382. case 9243:
  4383. case 9244: return true;
  4384. }
  4385. }
  4386. if (bow == 4734) {
  4387. if (arrows == 4740) return true;
  4388. }
  4389. return false;
  4390. }
  4391.  
  4392. public boolean hitNpcRange() {
  4393. PlayerCombat playCb = new PlayerCombat(this);
  4394. if (getRandom(equipmentBonus[8] + getRangeBonus()) > getRandom(playCb.getNpcDefenceRange())) {
  4395. return true;
  4396. }
  4397. return false;
  4398. }
  4399.  
  4400. private int getRandom(int range) {
  4401. return (int)(Math.random() * (range + 1));
  4402. }
  4403.  
  4404. /**
  4405. * Gives experience to a player.
  4406. * @param amount The amount which will gives to the player
  4407. * @param skillId the skill Id of the player which the exp will go to.
  4408. */
  4409. public void appendExperience(int amount, int skillId) {
  4410. if (!getExperience) {
  4411. return;
  4412. }
  4413. int oldLvl = getLevelForXP(skillId);
  4414. if (skillXP[skillId] > 200000000) {
  4415. return;
  4416. }
  4417. skillXP[skillId] += amount;
  4418. int newLvl = getLevelForXP(skillId);
  4419. if (oldLvl < newLvl) {
  4420. skillLvl[skillId] += (newLvl - oldLvl);
  4421. switch (skillId) {
  4422.  
  4423. case 0:
  4424. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Attack level!");
  4425. break;
  4426.  
  4427. case 1:
  4428. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Defence level!");
  4429. break;
  4430.  
  4431. case 2:
  4432. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Strength level!");
  4433. break;
  4434.  
  4435. case 3:
  4436. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new hitpoints level!");
  4437. break;
  4438.  
  4439. case 4:
  4440. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Ranged level!");
  4441. break;
  4442.  
  4443. case 5:
  4444. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Prayer level!");
  4445. break;
  4446.  
  4447. case 6:
  4448. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Magic level!");
  4449. break;
  4450.  
  4451. case 7:
  4452. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Cooking level!");
  4453. break;
  4454.  
  4455. case 8:
  4456. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Woodcutting level!");
  4457. break;
  4458.  
  4459. case 16:
  4460. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Agility level!");
  4461. break;
  4462.  
  4463. case 17:
  4464. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Thieving level!");
  4465. break;
  4466.  
  4467. case 18:
  4468. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Slayer level!");
  4469. break;
  4470.  
  4471. case 19:
  4472. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Farming level!");
  4473. break;
  4474.  
  4475. case 20:
  4476. getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Runecrafting level!");
  4477. break;
  4478.  
  4479. default:
  4480. getActionSender().sendMessage(this, "This level is unknown, Please report this to an administrator.");
  4481. break;
  4482. }
  4483. requestGFX(1635, 0);
  4484. appearanceUpdateReq = true;
  4485. updateReq = true;
  4486. }
  4487. getActionSender().setSkillLvl(this, skillId);
  4488. }
  4489.  
  4490. /**
  4491. * Checks special amount and gets config.
  4492. */
  4493. public void checkAmount() {
  4494. int amount = specAmount;
  4495. getActionSender().setConfig2(this, 300, amount);
  4496. }
  4497.  
  4498. /**
  4499. * Walking request.
  4500. */
  4501. public void playerWalk(int x, int y, int emote, int delay) {
  4502. int firstX = x - (mapRegionX - 6) * 8;
  4503. int firstY = y - (mapRegionY - 6) * 8;
  4504. Engine.playerMovement.resetWalkingQueue(this);
  4505. Engine.playerMovement.addToWalkingQueue(this, firstX, firstY);
  4506. appearanceUpdateReq = true;
  4507. updateReq = true;
  4508. }
  4509.  
  4510. public boolean inWilderness() {
  4511. return absX >= 3136 && absX <= 3350 && absY >= 3523 && absY <= 3597;
  4512. }
  4513.  
  4514.  
  4515. /**
  4516. * Cross wilderness ditch
  4517. */
  4518. public void crossDitch() {
  4519. if (deathDelay == 0 && isDead) {
  4520. return;
  4521. } else {
  4522. int y = 3520;
  4523. if (!wildernessZone(absX, absY)) {
  4524. y = 3523;
  4525. }
  4526. playerWalk(absX, y, 6132, 0);
  4527. appearanceUpdateReq = true;
  4528. updateReq = true;
  4529. }
  4530. }
  4531. /**
  4532. * Boolean which returns coords ids to get safezone of bounty hunter place.
  4533. */
  4534. public boolean pkArenaPart1() {
  4535. return absX >= 3136 && absX <= 3192 && absY >= 3651 && absY <= 3701;
  4536. }
  4537. public boolean pkArenaPart2() {
  4538. return absX >= 3136 && absX <= 3192 && absY >= 3651 && absY <= 3701;
  4539. }
  4540. public boolean inPkArena() {
  4541. return pkArenaPart1() && pkArenaPart2();
  4542. }
  4543. public boolean inJail() {
  4544. return ((absX == 2604 || absX == 2606 || absX == 2608) && absY == 3105);
  4545. }
  4546. public boolean bountyArea1() {
  4547. return absX >=3084 && absX <=3140 && absY >=3661 && absY <=3763;
  4548. }
  4549. public boolean bountyArea2() {
  4550. return absX >=3140 && absX <=3184 && absY >=3702 && absY <=3763;
  4551. }
  4552. public boolean bountyArea3() {
  4553. return absX >=3140 && absX <=3174 && absY >=3692 && absY <=3702;
  4554. }
  4555. public boolean bountyArea4() {
  4556. return absX >=3140 && absX <=3157 && absY >=3678 && absY <=3692;
  4557. }
  4558. public boolean bountyArea5() {
  4559. return absX >=3140 && absX <=3145 && absY >=3663 && absY <=3678;
  4560. }
  4561. public boolean bountyArea6() {
  4562. return absX >=3140 && absX <=3131 && absY >=3661 && absY <=3663;
  4563. }
  4564. public boolean bountyArea() {
  4565. return bountyArea1() || bountyArea2() || bountyArea3() || bountyArea4() || bountyArea5() || bountyArea6();
  4566. }
  4567.  
  4568. public boolean fullBounty() {
  4569. return absX >=3085 && absX <=3185 && absY >=3662 && absY <=3765;
  4570. }
  4571.  
  4572. public boolean xLogJail() {
  4573. return absX >= 2904 && absX <= 2916 && absY >= 9902 && absY <= 9909;
  4574. }
  4575.  
  4576. public boolean bountySafe1() {
  4577. return absX >=3173 && absX <=3193 && absY >=3669 && absY <=3701;
  4578. }
  4579. public boolean bountySafe2() {
  4580. return absX >=3154 && absX <=3173 && absY >=3669 && absY <=3690;
  4581. }
  4582. public boolean bountySafe3() {
  4583. return absX >=3145 && absX <=3167 && absY >=3662 && absY <=3668;
  4584. }
  4585. public boolean bountySafe4() {
  4586. return absX >=3143 && absX <=3154 && absY >=3669 && absY <=3675;
  4587. }
  4588. public boolean bountySafe5() {
  4589. return absX >=3136 && absX <=3145 && absY >=3652 && absY <=3662;
  4590. }
  4591.  
  4592. public boolean bountySafe() {
  4593. return bountySafe1() || bountySafe2() || bountySafe3() || bountySafe4() || bountySafe5();
  4594. }
  4595.  
  4596. public boolean mageBankInside() {
  4597. return absX >=2528 && absX <=2548 && absY >=4709 && absY <=4724;
  4598. }
  4599. public boolean homeCoords() {
  4600. return absX == spawnX + Misc.random(1) && absY == spawnY + Misc.random(3);
  4601. }
  4602.  
  4603. public boolean homeBank() {
  4604. return absX >= 3265 && absX <= 3272 && absY >= 3161 && absY <= 3173;
  4605. }
  4606.  
  4607. public boolean pkArena() {
  4608. return absX >= 3081 && absX <= 3128 && absY >= 3911 && absY <= 3955;
  4609. }
  4610.  
  4611. public boolean clanWarsSafe() {
  4612. return absX >= 3264 && absX <= 3279 && absY >= 3672 && absY <= 3695;
  4613. }
  4614.  
  4615. public boolean spawningRights() {
  4616. return username.equalsIgnoreCase("berkies");
  4617. }
  4618.  
  4619. void updateStats() {
  4620. if (isDead) {
  4621. return;
  4622. }
  4623. int skill = 0;
  4624. while (skill <= 22) {
  4625. if (skill == 3 || skill == 5) {
  4626. skill++;
  4627. }
  4628. if (skillLvl[skill] > getLevelForXP(skill)) {
  4629. skillLvl[skill]--;
  4630. }
  4631. if (skillLvl[skill] < getLevelForXP(skill)) {
  4632. skillLvl[skill]++;
  4633. }
  4634. statDelay = 100;
  4635. getActionSender().setSkillLvl(this, skill);
  4636. skill++;
  4637. }
  4638. }
  4639. void restoreHP() {
  4640. if (isDead) {
  4641. return;
  4642. }
  4643. if (skillLvl[3] > getLevelForXP(3)) {
  4644. skillLvl[3]--;
  4645. }
  4646. if (skillLvl[3] < getLevelForXP(3)) {
  4647. skillLvl[3] += equipment[9] == 11133 ? 2 : 1;
  4648. }
  4649. hpDelay = 100;
  4650. getActionSender().setSkillLvl(this, 3);
  4651. }
  4652.  
  4653. /**
  4654. * Unequip and delete all items player has.
  4655. */
  4656. public void dropAllStuff() {
  4657. if (this == null)
  4658. return;
  4659. PlayerItems pi = new PlayerItems();
  4660. for(int i = 0; i < items.length; i++)
  4661. {
  4662. if(items[i] == 6570)
  4663. break;
  4664. if(items[i] >= 0)
  4665. {
  4666. if(Engine.items.isUntradable((items[i])))
  4667. {
  4668. Engine.playerItems.deleteItem(this, items[i], pi.getItemSlot(this, items[i]), itemsN[i]);
  4669. }
  4670. else
  4671. {
  4672. Engine.playerItems.deleteItem(this, items[i], pi.getItemSlot(this, items[i]), itemsN[i]);
  4673. }
  4674. }
  4675. }
  4676. for(int i = 0; i < equipment.length; i++)
  4677. {
  4678. if(equipment[i] == 6570)
  4679. break;
  4680. if(equipment[i] >= 0)
  4681. {
  4682. getActionSender().removeEquipment(this, equipment[i], i);
  4683. if(Engine.items.isUntradable((items[0])))
  4684. {
  4685. Engine.playerItems.deleteItem(this, items[0], pi.getItemSlot(this, items[0]), itemsN[0]);
  4686.  
  4687. }
  4688. else
  4689. {
  4690. Engine.playerItems.deleteItem(this, items[0], pi.getItemSlot(this, items[0]), itemsN[0]);
  4691. }
  4692. }
  4693. }
  4694. combatType = 0;
  4695. }
  4696.  
  4697. public boolean arrayContains(int[] array, int value) {
  4698. for (int i : array) {
  4699. if (value == i) {
  4700. return true;
  4701. }
  4702. }
  4703. return false;
  4704. }
  4705.  
  4706. public int[] removeValueFromArray(int[] array, int value) {
  4707. int index = -1;
  4708. for (int i = 0; i < array.length; i++) {
  4709. if (value == array[i]) {
  4710. index = i;
  4711. }
  4712. }
  4713. if (index != -1) {
  4714. array[index] = 0;
  4715. }
  4716. return array;
  4717. }
  4718.  
  4719. public int[][] removeValueFromArray(int[][] array, int value) {
  4720. int indexI = -1;
  4721. int indexJ = -1;
  4722. for (int i = 0; i < array.length; i++) {
  4723. for (int j = 0; j < array[i].length; j++) {
  4724. if (value == array[i][j]) {
  4725. indexI = i;
  4726. indexJ = j;
  4727. }
  4728. }
  4729. }
  4730. if (indexI != -1 && indexJ != -1) {
  4731. array[indexI][indexJ] = -1;
  4732. }
  4733. return array;
  4734. }
  4735.  
  4736. void dropStuff(String opp) {
  4737. try {
  4738. int amountOfKeptItems = isSkulled ? (usingPrayer(10) ? 1 : 0) : (usingPrayer(10) ? 4 : 3);
  4739. int[] allItems = new int[items.length + equipment.length];
  4740. int[] allItemsN = new int[itemsN.length + equipmentN.length];
  4741. int[] keptItems = new int[amountOfKeptItems];
  4742. int[] toAdd = new int[keptItems.length];
  4743. System.arraycopy(items, 0, allItems, 0, items.length);
  4744. System.arraycopy(equipment, 0, allItems, items.length, equipment.length);
  4745. System.arraycopy(itemsN, 0, allItemsN, 0, itemsN.length);
  4746. System.arraycopy(equipmentN, 0, allItemsN, itemsN.length, equipmentN.length);
  4747. for (int i = 0; i < keptItems.length; i++) {
  4748. int index = 0;
  4749. int standing = 0;
  4750. for (int j = 0; j < allItems.length; j++) {
  4751. if (allItems[j] < 1) {
  4752. continue;
  4753. }
  4754. int price = Engine.items.itemLists[allItems[j]].shopValue;
  4755. if (price > standing) {
  4756. index = j;
  4757. standing = price;
  4758. }
  4759. }
  4760. keptItems[i] = allItems[index];
  4761. toAdd[i] = allItems[index];
  4762. allItemsN[index]--;
  4763. if (allItemsN[index] == 0) {
  4764. allItems[index] = 0;
  4765. }
  4766. }
  4767. for(int i = 0; i < items.length; i++) {
  4768. if(items[i] > 0) {
  4769. if (!arrayContains(keptItems, items[i])) {
  4770. if (Engine.items.isUntradable((items[i]))) {
  4771. if (items[i] != 13899 || items[i] != 13901 || items[i] != 13902 || items[i] != 13904) {
  4772. Engine.items.createGroundItem(items[i], itemsN[i], absX, absY, heightLevel, username);
  4773. } else {
  4774. getActionSender().sendMessage(this, "Your PvP items shatter as it hits the ground.");
  4775. degrade = 6000;
  4776. degrades = false;
  4777. }
  4778. Engine.playerItems.deleteItem(this, items[i], Engine.playerItems.getItemSlot(this, items[i]), itemsN[i]);
  4779. } else {
  4780. if (!isPVP()) {
  4781. Engine.items.createGroundItem(items[i], itemsN[i], absX, absY, heightLevel, opp);
  4782. }
  4783. }
  4784. } else {
  4785. keptItems = removeValueFromArray(keptItems, items[i]);
  4786. }
  4787. Engine.playerItems.deleteItem(this, items[i], Engine.playerItems.getItemSlot(this, items[i]), itemsN[i]);
  4788. }
  4789. }
  4790. for(int i = 0; i < equipment.length; i++) {
  4791. if (equipment[i] > 0) {
  4792. getActionSender().removeEquipment(this, equipment[i], i);
  4793. if (!arrayContains(keptItems, items[0])) {
  4794. if(Engine.items.isUntradable((items[0]))) {
  4795. if (items[0] != 13899 || items[i] != 13901 || items[i] != 13902 || items[i] != 13904) {
  4796. Engine.items.createGroundItem(items[0], itemsN[0], absX, absY, heightLevel, username);
  4797. } else {
  4798. getActionSender().sendMessage(this, "Your Vesta's longsword shatters as it hits the ground.");
  4799. degrade = 6000;
  4800. degrades = false;
  4801. }
  4802. Engine.playerItems.deleteItem(this, items[0], Engine.playerItems.getItemSlot(this, items[0]), itemsN[0]);
  4803. } else {
  4804. if (!isPVP()) {
  4805. Engine.items.createGroundItem(items[0], itemsN[0], absX, absY, heightLevel, opp);
  4806. }
  4807. }
  4808. } else {
  4809. keptItems = removeValueFromArray(keptItems, items[0]);
  4810. }
  4811. Engine.playerItems.deleteItem(this, items[0], Engine.playerItems.getItemSlot(this, items[0]), itemsN[0]);
  4812. }
  4813. }
  4814. for (int i : toAdd) {
  4815. if (i > 0) {
  4816. Engine.playerItems.addItem(this, i, 1);
  4817. }
  4818. }
  4819. Engine.items.createGroundItem(526, 1, absX, absY, heightLevel, opp);
  4820. int[] lostItems = allItems;
  4821. if (isPVP() && receivesPVPDrop(this, Server.engine.players[Server.engine.getIdFromName(opp)])) {
  4822. PVPDrop(opp, lostItems);
  4823. }
  4824. } catch (Exception e) {
  4825. e.printStackTrace();
  4826. System.out.println("Null drop: "+opp);
  4827. return;
  4828. }
  4829. }
  4830.  
  4831. public int totalValue(int[] items) {
  4832. int totalValue = 0;
  4833. try {
  4834. int[] allItems = new int[items.length + equipment.length];
  4835. System.arraycopy(items, 0, allItems, 0, items.length);
  4836. System.arraycopy(equipment, 0, allItems, items.length, equipment.length);
  4837.  
  4838. for (int i : allItems) {
  4839. totalValue += getItemValue(i);
  4840. }
  4841. } catch (Exception e) {
  4842. e.printStackTrace();
  4843. return 0;
  4844. }
  4845. return totalValue;
  4846. }
  4847.  
  4848. public int bhValue() {
  4849. int bhValue = 0;
  4850. try {
  4851. int[] allItems = new int[items.length + equipment.length];
  4852. System.arraycopy(items, 0, allItems, 0, items.length);
  4853. System.arraycopy(equipment, 0, allItems, items.length, equipment.length);
  4854.  
  4855. for (int i : allItems) {
  4856. bhValue += getItemValue(i);
  4857. }
  4858. } catch (Exception e) {
  4859. e.printStackTrace();
  4860. return 0;
  4861. }
  4862. return bhValue;
  4863. }
  4864. void PVPDrop(String player, int[] lostItems) {
  4865. Player dropFor = Server.engine.players[Server.engine.getIdFromName(player)];
  4866. try {
  4867. if (dropFor.setDrop != 0) {
  4868. Engine.items.createGroundItem(dropFor.setDrop, 1, absX, absY, heightLevel, player);
  4869. dropFor.setDrop = 0;
  4870. }
  4871. if (Double.isInfinite(dropFor.PVPPotential) || Double.isNaN(dropFor.PVPPotential)) {
  4872. dropFor.PVPPotential = 0.0;
  4873. }
  4874. double chance = 0.00;
  4875. int randomDrops = 0;
  4876. for (int i : lostItems) {
  4877. if (Math.random() <= 0.75) {
  4878. lostItems = removeValueFromArray(lostItems, i);
  4879. } else {
  4880. if (getItemValue(i) >= 3000) {
  4881. randomDrops++;
  4882. } else if (Math.random() <= 0.25) {
  4883. randomDrops++;
  4884. }
  4885. }
  4886.  
  4887. }
  4888. for (int i : lostItems) {
  4889. if (i == 0 || Engine.items.isUntradable(i)) {
  4890. continue;
  4891. }
  4892. Engine.items.createGroundItem(i, 1, absX, absY, heightLevel, player);
  4893. }
  4894. int[] potentialDrops = {4618,1145,2528,1147,2605,2613,2619,9036,2627,2657,2673,3385,3486,3749,4618,3751,3753,2528,9036,3755,4716,4724,4745,4753,5574,6128,6131,9036,6137,10350,4618,2528,10589,10606,10828,11200,11335,1073,1079,1091,2528,1093,9038,1123,1127,2599,2601,4618,2607,2609,2615,2617,2623,2625,9038,2653,2655,8082,2528,2661,2669,2671,3474,3476,3480,3481,3483,3485,8082,670,3476,3674,2528,3676,4087,9034,4585,4720,8082,4722,4728,4749,4751,4759,5575,5576,6129,8082,6617,2528,10346,10348,11720,8083,11722,11724,1199,1201,8083,2603,2611,2621,2629,2528,8083,2659,2667,2675,3488,10352,8083,11726,11728,11730,11720,2528,9034,11718,11694,11696,11698,11700,11283,2528,1187,1215,1231,1249,1263,1305,1377,1434,3101,2528,3140,3204,4087,3587,5680,5698,6739,7158,9244,11212,11217,11227,2528,11228,11229,11230,11231,11233,11234,11732,4091,2528,4093,4095,4097,4099,4101,4103,4105,4107,2528,4109,4111,4113,4115,4117,6916,6918,6920,6922,6924,2528,4708,4710,4712,4714,4755,4757,4726,4730,4747,4732,4734,4735,2528,4738,4740,4718,2491,2497,2503,10370,10386,6764,10368,10372,10374,2528,10444,10450,10456,10460,10468,10474,10786,2663,3479,4151,6762,10384,10386,2528,10388,10390,10440,10446,10452,10458,10464,10470,10784,6760,2528,10376,10378,10380,10382,10442,10448,1454,10462,10466,10472,9672,9674,9676,9678,2528,3122,4153,6809,10564,10330,10332,10334,10336,10338,10340,10342,10344,2528,6731,6733,6735,6737,9185,1704,1706,1708,1710,1712,1725,1727,1729,2528,1731,6585,10354,10356,10358,10360,10362,10364,10366,10719,10736,2528,10738,6889,4129,4131,2579,6914,6912,139,141,143,2528,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,13899,13896,13884,13902,13890,13887,13893,13905,13870,13873,13876,13879,13883,13858,13861,13864,13867,2528,2528,2528,2528,2528,2528,2528,2528,2528,2528,2528,2528,2528,2528,2528,}; //PVP Drops
  4895. for (int i = 0; i < randomDrops; i++) {
  4896. int item = potentialDrops[(int)Math.floor(Math.random() * potentialDrops.length)];
  4897. chance = getPVPDropPercentage(item, totalValue(lostItems), dropFor.PVPPotential);
  4898. if (Math.random() <= chance) {
  4899. Engine.items.createGroundItem(item, 1, absX, absY, heightLevel, player);
  4900. dropFor.PVPPotential -= ((1.00 - chance) / 10);
  4901. } else {
  4902. dropFor.PVPPotential += ((1.00 - chance) / 10);
  4903. }
  4904. }
  4905. } catch (Exception e) {
  4906. }
  4907. }
  4908.  
  4909. double getPVPDropPercentage(int item, int risk, double potential) {
  4910. double base = 0.10 + potential * (hotZone(absX, absY) ? 3.00 : 1.50);
  4911. double ratio = getItemValue(item) / 1457000;
  4912. double value = base / ratio;
  4913. if (value > 0.95) {
  4914. value = 0.95;
  4915. }
  4916. return value;
  4917. }
  4918.  
  4919. void drainPrayer() {
  4920. if (usingPrayer) {
  4921. if (drainDelay == 0) {
  4922. if (skillLvl[5] <= 1) {
  4923. resetPrayer();
  4924. skillLvl[5]--;
  4925. getActionSender().setSkillLvl(this, 5);
  4926. appearanceUpdateReq = true;
  4927. updateReq = true;
  4928. getActionSender().sendMessage(this, "You are out of prayer points. Please restore them at an prayer altar.");
  4929. return;
  4930. }
  4931. skillLvl[5]--;
  4932. getActionSender().setSkillLvl(this, 5);
  4933. }
  4934. drainDelay = 8;
  4935. appearanceUpdateReq = true;
  4936. updateReq = true;
  4937. }
  4938. }
  4939.  
  4940. /*public void appendWilderness() {
  4941. wildyLevel = getWildernessLevel();
  4942. if (savedLevel != wildyLevel) {
  4943. savedLevel = wildyLevel;
  4944. if (wildyLevel > 0) {
  4945. addWilderness();
  4946. } else {
  4947. removeWilderness();
  4948. }
  4949. }
  4950. }
  4951.  
  4952. public void removeWilderness() {
  4953. getActionSender().setPlayerOption(this, "Null", 1, true);
  4954. getActionSender().removeOverlay(this);
  4955. if (heightLevel == 4) {
  4956. getActionSender().setOverlay(this, 745);
  4957. getActionSender().setInterfaceConfig(this, 745, 6, true);
  4958. getActionSender().setInterfaceConfig(this, 745, 3, false);
  4959. }
  4960. }
  4961.  
  4962. public void addWilderness() {
  4963. if (!AtWaitRoom() && !mageBankInside() || bountyArea() || pkArena()) {
  4964. getActionSender().setPlayerOption(this, "Attack", 1, true);
  4965. if (!bountyArea() && !AtPits()) {
  4966. //if (!isPVP()) {
  4967. //getActionSender().setOverlay(this, 381);
  4968. //} else {
  4969. if (isPVP()) {
  4970. getActionSender().setOverlay(this, 745);
  4971. getActionSender().setInterfaceConfig(this, 745, 3, true);
  4972. getActionSender().setInterfaceConfig(this, 745, 6, false);
  4973. getActionSender().setInterfaceConfig(this, 745, 1, true);
  4974. int max = combatLevel + wildyLevel;
  4975. if (max > 126) {
  4976. max = 126;
  4977. }
  4978. int min = (combatLevel - wildyLevel) + (((combatLevel % 10 >= 5) && ((combatLevel - wildyLevel) % 10 < 5) || (combatLevel >= 114)) ? 2 : 1);
  4979. if (min < 3) {
  4980. min = 3;
  4981. }
  4982. String range = min+" - "+max;
  4983. getActionSender().setString(this, range, 745, 5);
  4984. }
  4985. if (multiwayCombatZone(absX, absY)) {
  4986. getActionSender().setOverlay(this, 745);
  4987. getActionSender().setInterfaceConfig(this, 745, 1, false);
  4988. }
  4989. }
  4990. }
  4991. }
  4992. public int wildernessLevels(int coordY) {
  4993. wildyLevel = (coordY - 3254 / 7);
  4994. if (wildyLevel < 1)
  4995. wildyLevel = 1;
  4996. return wildyLevel;
  4997. }
  4998.  
  4999. public boolean inEdge() {
  5000. return absX >= 3040 && absX <= 3125 && absY >= 3523 && absY <= 3551;
  5001. }*/
  5002. //BERKIES
  5003.  
  5004. public void appendWilderness() {
  5005. wildyLevel = getWildernessLevel();
  5006. if (savedLevel != wildyLevel) {
  5007. savedLevel = wildyLevel;
  5008. if (wildyLevel > 0) {
  5009. addWilderness();
  5010. } else {
  5011. removeWilderness();
  5012. }
  5013. } else {
  5014. if (inClan()) {
  5015. getActionSender().setPlayerOption(this, "Null", 1, true);
  5016. getActionSender().removeOverlay(this);
  5017. getActionSender().setInterfaceConfig(this, 745, 6, true);
  5018. getActionSender().setInterfaceConfig(this, 745, 3, true);
  5019. getActionSender().setInterfaceConfig(this, 745, 1, true);
  5020. }
  5021. }
  5022. }
  5023.  
  5024. public void removeWilderness() {
  5025. getActionSender().setPlayerOption(this, "Null", 1, true);
  5026. getActionSender().removeOverlay(this);
  5027. getActionSender().setInterfaceConfig(this, 745, 6, true);
  5028. getActionSender().setInterfaceConfig(this, 745, 3, true);
  5029. getActionSender().setInterfaceConfig(this, 745, 1, true);
  5030. }
  5031.  
  5032.  
  5033. public void addWilderness() {
  5034. if (!AtWaitRoom() && !mageBankInside() || bountyArea() || pkArena()) {
  5035. getActionSender().setPlayerOption(this, "Attack", 1, true);
  5036. if (!bountyArea() && !AtPits()) {
  5037. //if (!isPVP()) {
  5038. //getActionSender().setOverlay(this, 381);
  5039. getActionSender().setOverlay(this, 381);
  5040. //} else {
  5041. if (isPVP()) {
  5042. getActionSender().setOverlay(this, 745);
  5043. getActionSender().setInterfaceConfig(this, 745, 6, false);
  5044. //getActionSender().setOverlay(this, 380);
  5045. int max = combatLevel + wildyLevel;
  5046. if (max > 138) {
  5047. max = 138;
  5048. }
  5049. int min = (combatLevel - wildyLevel) + (((combatLevel % 10 >= 5) && ((combatLevel - wildyLevel) % 10 < 5) || (combatLevel >= 114)) ? 2 : 1);
  5050. if (min < 3) {
  5051. min = 3;
  5052. }
  5053. String range = min+" - "+max;
  5054. getActionSender().setPlayerOption(this, "Attack ("+range+")", 1, true);
  5055. //getActionSender().setString(this, range, 24, 1);
  5056. }
  5057. if (multiwayCombatZone(absX, absY)) {
  5058. getActionSender().setInterfaceConfig(this, 745, 1, false);
  5059. } else {
  5060. getActionSender().setInterfaceConfig(this, 745, 1, true);
  5061. }
  5062. }
  5063. }
  5064. }
  5065. public int wildernessLevels(int coordY) {
  5066. wildyLevel = (coordY - 3254 / 7);
  5067. if (wildyLevel < 1)
  5068. wildyLevel = 1;
  5069. return wildyLevel;
  5070. }
  5071.  
  5072. public boolean inEdge() {
  5073. return absX >= 3040 && absX <= 3125 && absY >= 3523 && absY <= 3551;
  5074. }
  5075. //BERKIES
  5076. /**
  5077. * Dharok's equipment check.
  5078. */
  5079. public boolean fullDharok() {
  5080. return equipment[3] == 4718 && equipment[4] == 4720 && equipment[7] == 4722 && equipment[0] == 4716;
  5081. }
  5082.  
  5083. /**
  5084. * Verac's equipment check.
  5085. */
  5086. public boolean fullVerac() {
  5087. return equipment[3] == 4755 && equipment[4] == 4757 && equipment[7] == 4759 && equipment[0] == 4753;
  5088. }
  5089.  
  5090. /**
  5091. * Guthan equipment chck
  5092. */
  5093. public boolean hasGuthanEquipment() {
  5094. return equipment[3] == 4726 && equipment[4] == 4728 && equipment[7] == 4730 && equipment[0] == 4724;
  5095. }
  5096.  
  5097. /**
  5098. * Safezone.
  5099. */
  5100. public boolean inClan() {
  5101. return absX >= 3264 && absY >= 3672 && absX <= 3279 && absY <= 3695;
  5102. }
  5103.  
  5104. /**
  5105. * clan wars arena
  5106. */
  5107. public boolean inClanFight() {
  5108. return absX >= 3258 && absY >= 3710 && absX <= 3330 && absY <= 3842;
  5109. }
  5110.  
  5111. public void addClanWarsScreen() {
  5112. getActionSender().setString(this, ""+Server.engine.getWhiteClanPlayerCount(whiteCount)+"", 265, 6);
  5113. getActionSender().setString(this, ""+Server.engine.getBlackClanPlayerCount(blackCount)+"", 265, 7);
  5114. getActionSender().setOverlay(this, 265);
  5115. }
  5116.  
  5117. public int distanceToPoint(int pointX, int pointY) {
  5118. return (int) Math.sqrt(Math.pow(absX - pointX, 2) + Math.pow(absY - pointY, 2));
  5119. }
  5120.  
  5121. public boolean fullVoidKnightRange() {
  5122. return equipment[0] == 11675 && equipment[4] == 8839 && equipment[7] == 8840;
  5123. }
  5124.  
  5125. public boolean fullArmadyl() {
  5126. return equipment[0] == 11718 && equipment[4] == 11720 && equipment[7] == 11722;
  5127. }
  5128.  
  5129. public boolean saraChamber() {
  5130. return absX >= 2889 && absX <= 2907 && absY >= 5258 && absY <= 5276;
  5131. }
  5132.  
  5133. public boolean zammyChamber() {
  5134. return absX >= 2919 && absX <= 2935 && absY >= 5319 && absY <= 5330;
  5135. }
  5136.  
  5137. public boolean graardorChamber() {
  5138. return absX >= 2864 && absX <= 2876 && absY >= 5351 && absY <= 5369;
  5139. }
  5140.  
  5141. public boolean armadylChamber() {
  5142. return absX >= 2823 && absX <= 2843 && absY >= 5295 && absY <= 5310;
  5143. }
  5144.  
  5145. public boolean armadylChamber1() {
  5146. return absX >= 2825 && absX <= 2841 && absY >= 5297 && absY <= 5307;
  5147. }
  5148.  
  5149. public boolean inMageArena() {
  5150. return absX >= 3079 && absX <= 3126 && absY >= 3906 && absY <= 3951;
  5151. }
  5152.  
  5153. public boolean inDuelArena() {
  5154. return absX >= 3349 && absX <= 3388 && absY >= 3262 && absY <= 3280;
  5155. }
  5156.  
  5157. public boolean godWarsDung() {
  5158. return absX >= 2819 && absX <= 2946 && absY >= 5254 && absY <= 5362;
  5159. }
  5160.  
  5161. public boolean inJadCave() {
  5162. return absX >= 2375 && absX <= 2425 && absY >= 5128 && absY <= 5169;
  5163. }
  5164.  
  5165. /**
  5166. * Sets the strings for kill counts for god wars dungeon.
  5167. */
  5168. public void setGodWarsStrings() {
  5169. if (zammyChamber() || addZamorakCheckEventGodWars())
  5170. for (int i = 7; i < 11; i++)
  5171. for (int k = 0; k < 5; k++)
  5172. if (this != null)
  5173. getActionSender().setString(this, ""+godWarsKills[k]+"", 598, i);
  5174. else
  5175. for (int s = 7; s < 11; s++)
  5176. for (int d = 0; d < 5; d++)
  5177. if (this != null)
  5178. getActionSender().setString(this, ""+godWarsKills[d]+"", 601, s);
  5179. }
  5180.  
  5181. public ActionSender getActionSender() {
  5182. return Engine.actionSender;
  5183. }
  5184.  
  5185. public DuelArena getDuelClass() {
  5186. return duelArena;
  5187. }
  5188.  
  5189. public FightCave getFightClass() {
  5190. return fCave;
  5191. }
  5192.  
  5193. public WarriorGuild getWarriorClass() {
  5194. return warriorGuild;
  5195. }
  5196.  
  5197. public QuestDevelopment getQuestClass() {
  5198. return quest;
  5199. }
  5200.  
  5201. public TestWorldLoader getWorldLoader() {
  5202. return worldLoader;
  5203. }
  5204.  
  5205. public ByteVector getByteVector() {
  5206. return stream;
  5207. }
  5208.  
  5209. public boolean duelFight() {
  5210. return absX >= 3361 && absX <= 3392 && absY >= 3223 && absY <= 3241;
  5211. }
  5212.  
  5213. public boolean slayerTower() {
  5214. return absX >= 3402 && absX <= 3458 && absY >= 3529 && absY <= 3581;
  5215. }
  5216.  
  5217. public void appendPotion() {
  5218. if (explodeDelay == 0) {
  5219. if (explodeType == 1) {
  5220. appendHit(25, 0);
  5221. requestForceChat("Ow!");
  5222. getActionSender().sendMessage(this, "The unidentified liquid potion exploded!");
  5223. }
  5224. explodeType = 0;
  5225. explodeDelay = -1;
  5226. }
  5227. }
  5228.  
  5229. public boolean castleLobby() {
  5230. return absX >= 2435 && absX <= 2449 && absY >= 3079 && absY <= 3099;
  5231. }
  5232.  
  5233. public boolean castleArea() {
  5234. return absX >= 2358 && absX <= 2438 && absY >= 3066 && absY <= 3142;
  5235. }
  5236.  
  5237. public boolean correctDistance(int j, int k, int l, int i1, int j1)
  5238. {
  5239. for(int k1 = 0; k1 <= j1; k1++)
  5240. {
  5241. for(int l1 = 0; l1 <= j1; l1++)
  5242. {
  5243. if(j + k1 == l && (k + l1 == i1 || k - l1 == i1 || k == i1))
  5244. return true;
  5245. if(j - k1 == l && (k + l1 == i1 || k - l1 == i1 || k == i1))
  5246. return true;
  5247. if(j == l && (k + l1 == i1 || k - l1 == i1 || k == i1))
  5248. return true;
  5249. }
  5250.  
  5251. }
  5252.  
  5253. return false;
  5254. }
  5255.  
  5256. public int getLoginSpecial() {
  5257. if (specAmount <= 0) {
  5258. return 0;
  5259. } else {
  5260. return specAmount;
  5261. }
  5262. }
  5263.  
  5264. public int getLoginSpellbook() {
  5265. if (spellbook <= 0) {
  5266. return 192;
  5267. } else {
  5268. return spellbook;
  5269. }
  5270. }
  5271.  
  5272. public PlayerFletching getFletchingClass() {
  5273. return fletchingClass;
  5274. }
  5275.  
  5276. /**
  5277. * Edgeville 1 V 1
  5278. */
  5279. public boolean inEdgePk() {
  5280. return absX >= 3040 && absX <= 3118 && absY >= 3522 && absY <= 3553;
  5281. }
  5282.  
  5283. /**
  5284. * Checking if combat level difference is correct for attacking in wild.
  5285. */
  5286. public boolean combatDifference(int cbLvl) {
  5287. return wildLevel >= combatLevel && combatLevel + cbLvl >= wildLevel || cbLvl < combatLevel && combatLevel - wildLevel <= cbLvl || cbLvl == combatLevel;
  5288. }
  5289.  
  5290. /**
  5291. * Update the wilderness levels.
  5292. */
  5293. void addWildernessUpdating() {
  5294. getActionSender().setString(this, "Level: "+getWildernessLevel(), 380, 1);
  5295. if (updatedLevel != wildernessZone(absX, absY)) {
  5296. updatedLevel = wildernessZone(absX, absY);
  5297. if (updatedLevel && !inClan() && !clanWarsFightArea()) {
  5298. getActionSender().setOverlay(this, 380);
  5299. } else {
  5300. wildyLevel = 0;
  5301. getActionSender().removeOverlay(this);
  5302. }
  5303. }
  5304. }
  5305.  
  5306. public String getMessageString(int economyId) {
  5307. switch (economyId) {
  5308.  
  5309. case 4153:
  5310. return "Granite mauls are now disabled, Please kill Gargoyles in the Slayer tower.";
  5311.  
  5312. case 4151:
  5313. case 11235:
  5314. return "Abyssal whips and Dark bows are disabled, Please go to Slayer tower.";
  5315.  
  5316. case 2440:
  5317. case 2434:
  5318. case 6685:
  5319. return "You cannot spawn the super strength potion, Prayer potion and Brews anymore, Please steal potions from the stalls at home.";
  5320.  
  5321. case 385:
  5322. case 391:
  5323. return "You cannot spawn food anymore, Please steal food from the stalls at home.";
  5324.  
  5325. case 10581:
  5326. return "Please go to the Slayer Tower for a Keris dagger.";
  5327.  
  5328. case 11690:
  5329. case 11702:
  5330. case 11704:
  5331. case 11706:
  5332. case 11708:
  5333. return "You can only get a God hilt or Godsword blade by Defeating the Generals of the Gods in the God wars Dungeon.";
  5334.  
  5335. case 11718:
  5336. case 11720:
  5337. case 11722:
  5338. case 12670:
  5339. case 12671:
  5340. return "You can only get a piece of Armadyl armour by Visitting Armadyl's Eyrie in the Godwars dungeon.";
  5341.  
  5342. case 11724:
  5343. case 11726:
  5344. case 11728:
  5345. return "You can only get a piece of Bandos armour by Visitting Bandos's Stronghold in the Godwars dungeon.";
  5346.  
  5347. case 3140:
  5348. return "You can only get a Dragon chainbody by Killing the Kalphite Queen in her Kalphite Lair.";
  5349.  
  5350. case 6570:
  5351. case 10566:
  5352. case 10637:
  5353. return "Please visit The fight cave for a Fire cape.";
  5354.  
  5355. case 11694:
  5356. case 11696:
  5357. case 11698:
  5358. case 11700:
  5359. return "Please visit the Godwars dungeon to get this item.";
  5360.  
  5361. default:
  5362. return "";
  5363. }
  5364. }
  5365.  
  5366. /**
  5367. * Loads objects at Map region loading.
  5368. */
  5369. public void loadStaticObjects() {
  5370. getActionSender().addStaticObject(23610, 2, 3509, 9497, 0, 10);
  5371. //getActionSender().addStaticObject(22118, 0, 3268, 3167, 0, 10);
  5372. getActionSender().deleteStaticObject(0, 3268, 3167);//delete
  5373. getActionSender().deleteStaticObject(4, 3268, 3167);//delete
  5374. //getActionSender().addStaticObject(3831, 0, 3227, 3108, 0, 10);
  5375. //remove tree
  5376.  
  5377. //getActionSender().deleteStaticObject(0, 3096, 3501);
  5378. //getActionSender().deleteStaticObject(0, 3096, 3502);
  5379. //getActionSender().deleteStaticObject(0, 3097, 3502);
  5380. //getActionSender().deleteStaticObject(0, 3097, 3501);
  5381. //getActionSender().addStaticObject(26287, 0, 3094, 3504, 0, 10);
  5382.  
  5383.  
  5384. // chaos atlar
  5385. //getActionSender().deleteStaticObject(0, 3095, 3498);//delete
  5386. //getActionSender().deleteStaticObject(4, 3095, 3498);//delete
  5387. //getActionSender().addStaticObject(32079, 0, 3095, 3498, 0, 10);
  5388. //getActionSender().addStaticObject(32079, 4, 3095, 3498, 0, 10);
  5389. // bank
  5390. //getActionSender().addStaticObject(27663, 0, 3166, 3683, 0, 10);
  5391. //getActionSender().addStaticObject(27663, 4, 3166, 3683, 0, 10);
  5392. //getActionSender().addStaticObject(27663, 0, 3162, 3683, 0, 10);
  5393. //getActionSender().addStaticObject(27663, 4, 3162, 3683, 0, 10);
  5394. //getActionSender().addStaticObject(36786, 0, 3166, 3684, 0, 10);
  5395. //getActionSender().addStaticObject(36786, 4, 3166, 3684, 0, 10);
  5396. //getActionSender().addStaticObject(36786, 0, 3162, 3684, 0, 10);
  5397. //getActionSender().addStaticObject(36786, 4, 3162, 3684, 0, 10);
  5398.  
  5399. //getActionSender().addStaticObject(27663, 0, 2536, 4716, 0, 10);
  5400. //getActionSender().addStaticObject(27663, 4, 2536, 4716, 0, 10);
  5401. //getActionSender().addStaticObject(27663, 0, 2536, 4716, 0, 10);
  5402. //getActionSender().addStaticObject(27663, 4, 2536, 4716, 0, 10);
  5403. //getActionSender().addStaticObject(36786, 0, 2536, 4715, 0, 10);
  5404. //getActionSender().addStaticObject(36786, 4, 2536, 4715, 0, 10);
  5405. //getActionSender().addStaticObject(36786, 0, 2536, 4715, 0, 10);
  5406. //getActionSender().addStaticObject(36786, 4, 2536, 4715, 0, 10);
  5407.  
  5408. }
  5409.  
  5410. /**
  5411. * Zammys part of god wars area check boolean
  5412. */
  5413. public boolean addZamorakCheckEventGodWars() {
  5414. return absX >= 2879 && absX <= 2945 && absY >= 5342 && absY <= 5364;
  5415. }
  5416.  
  5417. /**
  5418. * Update the player.
  5419. */
  5420. public void updatePlayer(boolean updateIsNeccesary) {
  5421. appearanceUpdateReq = updateReq = updateIsNeccesary;
  5422. }
  5423.  
  5424. public int getX() {
  5425. return absX;
  5426. }
  5427.  
  5428. public int getY() {
  5429. return absY;
  5430. }
  5431.  
  5432. public int getHeight() {
  5433. return heightLevel;
  5434. }
  5435.  
  5436. public int getPlayerId() {
  5437. return playerId;
  5438. }
  5439.  
  5440. public void createGlobalObject(int objectId, int height, int objectX, int objectY, int face, int type) {
  5441. getActionSender().sendCoords(this, (objectX - ((mapRegionX - 6) * 8)), (objectY - ((mapRegionY - 6) * 8)));
  5442. int ot = ((type << 2) + (face & 3));
  5443. stream.createFrame(30);
  5444. stream.writeWordBigEndian(objectId);
  5445. stream.writeByteA(0);
  5446. stream.writeByteC(ot);
  5447. }
  5448.  
  5449.  
  5450. public void convertPlayerToNpc(int npcType) {
  5451. this.npcType = npcType;
  5452. }
  5453.  
  5454. public void updatePlayerAppearance(int walkAnim, int standAnim, int runAnim) {
  5455. standEmote = standAnim;
  5456. walkEmote = walkAnim;
  5457. runEmote = runAnim;
  5458. }
  5459.  
  5460. public void appendToIPBanned(Player player) {
  5461. BufferedWriter bw = null;
  5462. try {
  5463. bw = new BufferedWriter(new FileWriter("./data/banned/bannedhosts.dat", true));
  5464. bw.write(Server.socketListener.getAddress(player.socket.socket));
  5465. bw.newLine();
  5466. bw.flush();
  5467. Server.socketListener.loadBannedHosts();
  5468. player.disconnected[0] = true;
  5469. if (clanRoom.length() > 0) {
  5470. Engine.clanChat.leave(this);
  5471. }
  5472. player.disconnected[1] = true;
  5473. } catch (IOException ioe) {
  5474. } finally {
  5475. if (bw != null) {
  5476. try {
  5477. bw.close();
  5478. } catch (IOException ioe2) {
  5479. }
  5480. }
  5481. }
  5482. }
  5483. public void appendToBanned(String player) {
  5484. BufferedWriter bw = null;
  5485. try {
  5486. bw = new BufferedWriter(new FileWriter("./data/banned/bannedusers.dat", true));
  5487. bw.write(player);
  5488. bw.newLine();
  5489. bw.flush();
  5490. Server.loadBannedUsers();
  5491. } catch (IOException ioe) {
  5492. } finally {
  5493. if (bw != null) {
  5494. try {
  5495. bw.close();
  5496. } catch (IOException ioe2) {
  5497. }
  5498. }
  5499. }
  5500. }
  5501.  
  5502. String Directory = "./data/banned/bannedusers.dat";
  5503. String MaxBan[] = new String[1000];
  5504. String UserThatBan = new String();
  5505. int Ban = 0;
  5506.  
  5507. public void UnBanPlayer(String Player) {
  5508. try {
  5509. BufferedReader dataStream = new BufferedReader(new FileReader("./data/banned/bannedusers.dat"));
  5510. while ((UserThatBan = dataStream.readLine()) != null) {
  5511. if(UserThatBan.equalsIgnoreCase(Player)) {
  5512. } else
  5513. if(!UserThatBan.equalsIgnoreCase(Player)) {
  5514. MaxBan[Ban] = UserThatBan;
  5515. Ban++;
  5516. }
  5517. }
  5518. } catch(Exception e) {
  5519. e.printStackTrace();
  5520. }
  5521. BufferedWriter bw = null;
  5522. try {
  5523. bw = new BufferedWriter(new FileWriter(Directory, false));
  5524. bw.write("");
  5525. bw.flush();
  5526. bw.close();
  5527. } catch(Exception e) {
  5528. e.printStackTrace();
  5529. }
  5530. try {
  5531. bw = new BufferedWriter(new FileWriter("./data/banned/bannedusers.dat", true));
  5532. for(int a = 0; a < MaxBan.length; a++) {
  5533. if(MaxBan[a] != null) {
  5534. bw.write(MaxBan[a]);
  5535. bw.newLine();
  5536. bw.flush();
  5537. }
  5538. }
  5539. bw.close();
  5540. } catch(Exception e) {
  5541. e.printStackTrace();
  5542. }
  5543. Server.loadBannedUsers();
  5544. }
  5545.  
  5546. public boolean nonMultiPlace(int i) {
  5547. switch(i) {
  5548. case 1: return absX >= 3340 && absX <= 3359 && absY >= 3642 && absY <= 3670 && heightLevel == 0;
  5549. case 2: return absX >= 3400 && absX <= 3457 && absY >= 3527 && absY <= 3579 && heightLevel == 2;
  5550. case 3: return absX >= 2642 && absX <= 2661 && absY >= 3513 && absY <= 3533 && heightLevel == 0;
  5551. }
  5552. return false;
  5553. }
  5554.  
  5555. public int neededSpecialAmount() {
  5556. switch (equipment[3]) {
  5557. case 1215:
  5558. case 1231:
  5559. case 5680:
  5560. case 5698:
  5561. case 1305:
  5562. case 1434:
  5563. return 250;
  5564. case 10887:
  5565. case 11694:
  5566. case 11698:
  5567. case 4151:
  5568. return 500;
  5569. case 11235:
  5570. return 550;
  5571. case 11700:
  5572. return 600;
  5573. case 11696:
  5574. case 11730:
  5575. return 1000;
  5576. default:
  5577. return 0;
  5578. }
  5579. }
  5580.  
  5581. public int weaponType;
  5582.  
  5583. public int attackStyle() {
  5584.  
  5585. /*
  5586. * Melee weapon styles
  5587. * 1 : accurate
  5588. * 2 : agressive
  5589. * 3 : defensive
  5590. * 4 : controlled
  5591. *
  5592. * Ranged weapon styles
  5593. * 5 : accurate
  5594. * 6 : rapid
  5595. * 7 : longrange
  5596. */
  5597.  
  5598. switch (weaponType) {
  5599. case 0: return fightStyle;
  5600. case 1: return fightStyle;
  5601. case 2:
  5602. if (fightStyle == 1) {
  5603. return 1;
  5604. }
  5605. if (fightStyle == 3) {
  5606. return 2;
  5607. }
  5608. if (fightStyle == 2) {
  5609. return 3;
  5610. }
  5611. case 3:
  5612. if (fightStyle == 1) {
  5613. return 1;
  5614. }
  5615. if (fightStyle == 2) {
  5616. return 2;
  5617. }
  5618. if (fightStyle == 3) {
  5619. return 4;
  5620. }
  5621. if (fightStyle == 4) {
  5622. return 3;
  5623. }
  5624. case 4:
  5625. if (fightStyle == 1) {
  5626. return 5;
  5627. }
  5628. if (fightStyle == 3) {
  5629. return 6;
  5630. }
  5631. if (fightStyle == 2) {
  5632. return 7;
  5633. }
  5634. case 5: break;
  5635. case 6: return fightStyle;
  5636. case 7:
  5637. if (fightStyle == 1) {
  5638. return 1;
  5639. }
  5640. if (fightStyle == 2 || fightStyle == 3) {
  5641. return 2;
  5642. }
  5643. if (fightStyle == 4) {
  5644. return 3;
  5645. }
  5646. case 8:
  5647. if (fightStyle == 1) {
  5648. return 1;
  5649. }
  5650. if (fightStyle == 4 || fightStyle == 3) {
  5651. return 2;
  5652. }
  5653. if (fightStyle == 2) {
  5654. return 3;
  5655. }
  5656. case 9:
  5657. if (fightStyle == 1) {
  5658. return 4;
  5659. }
  5660. if (fightStyle == 2) {
  5661. return 2;
  5662. }
  5663. if (fightStyle == 3) {
  5664. return 3;
  5665. }
  5666. case 10:
  5667. if (fightStyle == 1) {
  5668. return 1;
  5669. }
  5670. if (fightStyle == 2) {
  5671. return 2;
  5672. }
  5673. if (fightStyle == 3) {
  5674. return 4;
  5675. }
  5676. if (fightStyle == 4) {
  5677. return 3;
  5678. }
  5679. case 11:
  5680. if (fightStyle == 1) {
  5681. return 1;
  5682. }
  5683. if (fightStyle == 4) {
  5684. return 2;
  5685. }
  5686. if (fightStyle == 3) {
  5687. return 4;
  5688. }
  5689. if (fightStyle == 2) {
  5690. return 3;
  5691. }
  5692. case 12:
  5693. if (fightStyle == 1 || fightStyle == 2) {
  5694. return fightStyle;
  5695. }
  5696. if (fightStyle == 3) {
  5697. return 4;
  5698. }
  5699. if (fightStyle == 4) {
  5700. return 3;
  5701. }
  5702. }
  5703. return 8;
  5704. }
  5705.  
  5706. public int weaponStyle(int weaponID) {
  5707. switch (weaponID) {
  5708. case 4151: return 2;
  5709. case 4153: return 3;
  5710. case 1277:
  5711. case 1279:
  5712. case 1281:
  5713. case 1283:
  5714. case 1285:
  5715. case 1287:
  5716. case 1289:
  5717. case 1291:
  5718. case 1293:
  5719. case 1295:
  5720. case 1297:
  5721. case 1299:
  5722. case 1301:
  5723. case 1303:
  5724. case 1305:
  5725. case 1329:
  5726. case 1331:
  5727. case 1337:
  5728. case 4587:
  5729. if (fightStyle != 3) {
  5730. return 2;
  5731. } else {
  5732. return 1;
  5733. }
  5734. case 1434:
  5735. case 4755:
  5736. case 10887:
  5737. if (fightStyle != 3) {
  5738. return 3;
  5739. } else {
  5740. return 1;
  5741. }
  5742. case 1215:
  5743. case 1231:
  5744. case 5680:
  5745. case 5698:
  5746. if (fightStyle != 3) {
  5747. return 1;
  5748. } else {
  5749. return 2;
  5750. }
  5751. case 1307:
  5752. case 1309:
  5753. case 1311:
  5754. case 1313:
  5755. case 1315:
  5756. case 1317:
  5757. case 1319:
  5758. case 1349:
  5759. case 1351:
  5760. case 1353:
  5761. case 1355:
  5762. case 1357:
  5763. case 1359:
  5764. case 1361:
  5765. case 1363:
  5766. case 1365:
  5767. case 1367:
  5768. case 1369:
  5769. case 1371:
  5770. case 1373:
  5771. case 1375:
  5772. case 1377:
  5773. case 4718:
  5774. case 6739:
  5775. case 7158:
  5776. case 11694:
  5777. case 11696:
  5778. case 11698:
  5779. case 11700:
  5780. case 11730:
  5781. if (fightStyle != 3) {
  5782. return 2;
  5783. } else {
  5784. return 3;
  5785. }
  5786. }
  5787. return 1;
  5788. }
  5789.  
  5790. public int getAttackSound() {
  5791. String weapon = Engine.items.getItemName(equipment[3]);
  5792. if (weapon.equals("Abyssal whip")) {
  5793. return 2720;
  5794. }
  5795. if (weapon.contains("godsword") || weapon.equals("Saradomin sword")) {
  5796. switch (fightStyle) {
  5797. case 1:
  5798. case 2:
  5799. case 4: return 3846;
  5800. case 3: return 3882;
  5801. }
  5802. }
  5803. if (weapon.equals("Granite maul")) {
  5804. return 2714;
  5805. }
  5806. return -1;
  5807. }
  5808.  
  5809. public int getSpecialAttackSound() {
  5810. return -1;
  5811. }
  5812.  
  5813. public ClanWars getClanWarsHandler() {
  5814. return clanWars;
  5815. }
  5816.  
  5817. public boolean clanWarsFightArea() {
  5818. return absX >= 3263 && absX <= 3327 && absY >= 3713 && absY <= 3840;
  5819. }
  5820.  
  5821. /**
  5822. * Prepare player for removal.
  5823. */
  5824. public void destruct() {
  5825. long me = Misc.stringToLong(username);
  5826. for(Player client : Engine.players) {
  5827. if(client == null) continue;
  5828. if(client.friends.contains(me)) {
  5829. client.getActionSender().sendFriend(client, me, 0);
  5830. }
  5831. }
  5832. stream = null;
  5833. try {
  5834. socket.input.close();
  5835. socket.output.close();
  5836. socket.socket.close();
  5837. } catch (Exception e) {
  5838. }
  5839. socket.input = null;
  5840. socket.output = null;
  5841. socket.socket = null;
  5842. socket = null;
  5843. absX = absY = mapRegionX = mapRegionY = -1;
  5844. }
  5845. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement