PDA

View Full Version : [codeusa] Bounty hunter



owner lorenzo
June 18th, 2010, 17:14
have a little problem i added Bounty Hunter but when i go in creator it shows the wildersnis level
normally my Bh interface need to come there but the wilderis thingy takes it over

Here is A pic:
Only the registered members can see the link.

REP ++ for the one who can fix it
I got teamviewer
My msn is lorenzodeloof@hotmail.com
Or post little Tut here thx ;)

Nathan
June 18th, 2010, 17:17
teamviewer id and pass ill do for u.

Aaron
June 18th, 2010, 17:19
There is No Rep Button yet.

Neelix
June 18th, 2010, 17:20
teamviewer id and pass ill do for u.

Jesus, stop posting 'teamviewer' everywhere.

@lorenzo:

Post your wildernessArea void (just search it, probably in player.java) and post it. Then you can change it and tell the void that BH is not an bounty area. If it still doesn't work, you didn't make it so that your player updates when he or she goes outside wilderness or bh.

owner lorenzo
June 18th, 2010, 17:42
Here is my player .java lol


/*
* Class Player
*
* Version 1.0
*
* Thursday, August 14, 2008
*
* Created by Palidino76 Codeusa
*/

package net.com.codeusa.model;

import java.io.FileWriter;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.IOException;
import java.net.Socket;
import java.util.*;
import java.lang.*;
import net.com.codeusa.test.TestWorldLoader;
import net.com.codeusa.model.misc.*;
import net.com.codeusa.model.games.*;
import net.com.codeusa.model.skills.*;
import net.com.codeusa.model.combat.*;
import net.com.codeusa.model.quest.*;
import net.com.codeusa.*;
import net.com.codeusa.Engine;
import net.com.codeusa.io.*;
import net.com.codeusa.net.PlayerSocket;
import net.com.codeusa.util.ByteVector;
import net.com.codeusa.util.Misc;
import net.com.codeusa.npcs.NPC;
import net.com.codeusa.model.items.*;
import net.com.codeusa.model.items.PlayerWeapon;
import net.com.codeusa.model.games.BountyHunter;
import net.com.codeusa.model.ptrade.PTrade;
import net.com.codeusa.util.UserInput;

public class Player implements Entity {
public UserInput input = new UserInput(this);
public List<Long> friends = new ArrayList<Long>(200);
public List<Long> ignores = new ArrayList<Long>(100);
public boolean swapAsNote = false;

public boolean DFSSpecial;
public long lastDFS;
public int DFSDelay = -1;
public int Donator = 0;
public int cantpray;
public int serverMess;
public boolean serverMessSet = false;
public int bobitems = 0;
public boolean wildWarned = false;
public boolean splitChat = false;
public int followPlayer;
public boolean followingPlayer;
public boolean guest = false;
public boolean canLog = true;

public int stunned;

/**
* To check if the brother is spawned
**/
public static int barrowsItems[] = {4708, 4710, 4712, 4714, 4716, 4718, 4720, 4722, 4724, 4726,
4728, 4730, 4732, 4734, 4736, 4738, 4745, 4747, 4749, 4751, 4753, 4755, 4757, 4759};

public static int getBarrowsReward() {
return barrowsItems[(int) (Math.random() * barrowsItems.length)];
}

public int barrowkc;

public int DharokSpawned = 0;

public int VeracSpawned = 0;

public int AhrimSpawned = 0;

public int ToragSpawned = 0;

public int GuthanSpawned = 0;

public int KarilSpawned = 0;

public int SlayerAm = 0;

public int SlayerTask = 0;

public boolean MonsterTele = false;

public boolean SkillingTele = false;

public boolean MinigameTele = false;

public boolean PvpTele = false;

public int systemupdate;

public int itemSet;

public int heightSave;
public int heightLoad;

public int updateTime = 0;
public boolean updateTimer = false;

public boolean initialAttack;
public boolean boltSpecial;
public boolean boltSpecial2;
public String nameSet;
public int setDrop;
public boolean inCombat = false;
public int target;
public int pvpsafe;
public int bh1;
public int bh2;
public int bh3;
public int bh4;
public boolean bhtl = false;
public boolean bhtl2 = false;
public boolean bhtl3 = false;
public boolean bhtl4 = false;
public int assign = 0;

public int KC;
public int DC;

public String chatName;
public final String ACTIVE_CHAT_DEFAULT = "World Of Welf";
public String activeChat = ACTIVE_CHAT_DEFAULT;
public final String ACTIVE_CHAT_OWNER_DEFAULT = "Public Channel";
public String activeChatOwner = ACTIVE_CHAT_OWNER_DEFAULT;

String[][] itemPrices = {{"Null", "999999999"}, {"null", "999999999"}, {"Ahrim's hood", "236"}, {"Zamorak hilt", "267983"}, {"Warrior helm", "536"}, {"Enchanted robe", "495"}, {"Enchanted top", "741"}, {"Enchanted hat", "89"}, {"Adamant knife", "2"}, {"Adamant knife(p)", "4"}, {"Adamant knife(p+)", "5"}, {"Adamant knife(p++)", "13"}, {"Adamant dart", "1"}, {"Adamant dart(p)", "3"}, {"Adamant dart(p+)", "4"}, {"Adamant dart(p++)", "12"}, {"Tzhaar-ket-em", "891"}, {"Barrelchest anchor", "2300"}, {"Crystal bow full", "9000"}, {"Crystal shield full", "9000"}, {"Rune chainbody", "315"}, {"Zamorakian spear", "14395"}, {"Saradomin staff", "800"}, {"Guthix staff", "800"}, {"Zamorak staff", "800"}, {"Bolt rack", "2"}, {"Santa hat", "131601"}, {"Tuna potato", "14"}, {"Wizard boots", "3319"}, {"Regen bracelet", "2570"}, {"Combat bracelet", "137"}, {"Combat bracelet(1)", "137"}, {"Combat bracelet(2)", "137"}, {"Combat bracelet(3)", "137"}, {"Combat bracelet(4)", "137"}, {"Splitbark body", "271"}, {"Splitbark boots", "28"}, {"Splitbark gauntlets", "28"}, {"Splitback helm", "59"}, {"Splitback legs", "240"}, {"Dwarven helmet", "358"}, {"Abyssal whip", "14570"}, {"Fire cape", "10000"}, {"Armadyl godsword", "150000000"}, {"Bandos godsword", "488580"}, {"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", "397832"}, {"Dragon chainbody", "50565"}, {"Morrigan's javelin", "5056"}, {"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", "0"}, {"Rune arrow", "0"}, {"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"}, {"Mystic robe top", "790"}, {"Mystic robe bottom", "790"}, {"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 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", "3537022"}, {"Bandos tassets", "5419478"}, {"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"}, {"Purple sweets", "8"}, {"Dark bow", "7900"}, {"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"}, {"Zuriel's robe top", "74912"}, {"Zuriel's robe bottom", "84912"}, {"Zuriel's hood", "4912"}, {"Zuriel's staff", "3941"}, {"Morrigan's leather body", "103180"}, {"Morrigan's leather chaps", "83180"}, {"Morrigan's throwing axe", "250"}, {"Vesta's plateskirt", "143180"}, {"Vesta's chainbody", "263180"}, {"Statius's platebody", "310182"}, {"Statius's platelegs", "211182"}, {"Statius's full helm", "91182"}, {"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"}, {"Vesta's spear", "7400180"}, {"Statius's warhammer", "199180"}};

String[][] killPrices = {{"Fighter torso", "15"}, {"Fire cape", "30"}, {"Dragon claws", "10"}, {"Void knight top", "20"}, {"Void knight robe", "20"}, {"Void knight mace", "10"}, {"Void knight gloves", "15"}, {"Void mage helm", "15"}, {"Void ranger helm", "15"}, {"Void melee helm", "15"}, {"Runner hat", "25"}, {"Healer hat", "25"}, {"Ranger hat", "25"}, {"Runner boots", "25"}, {"Penance gloves", "25"}, {"Penance skirt", "50"}, {"Dwarf remains", "500000"}, {"Corrupt statius's platebody", "15"}, {"Corrupt statius's platelegs", "15"}, {"Corrupt statius's warhammer", "15"}, {"Corrupt statius's full helm", "15"}, {"Corrupt vesta's chainbody", "15"}, {"Corrupt vesta's plateskirt", "15"}, {"Corrupt vesta's spear", "15"}, {"Corrupt vesta's longsword", "15"}, {"Corrupt morrigan's leather body", "15"}, {"Corrupt morrigan's leather chaps", "15"}, {"Corrupt morrigan's coif", "15"}, {"Corrupt zuriel's robe top", "15"}, {"Corrupt zuriel's robe bottom", "15"}, {"Corrupt zuriel's hood", "15"}, {"Corrupt zuriel's staff", "15"}, {"Statius's platebody", "50"}, {"Statius's platelegs", "50"}, {"Statius's warhammer", "100"}, {"Statius's full helm", "50"}, {"Vesta's chainbody", "30"}, {"Vesta's plateskirt", "30"}, {"Vesta's spear", "100"}, {"Vesta's longsword", "100"}, {"Morrigan's leather body", "30"}, {"Morrigan's leather chaps", "30"}, {"Morrigan's coif", "30"}, {"Zuriel's robe top", "30"}, {"Zuriel's robe bottom", "30"}, {"Zuriel's hood", "30"}, {"Zuriel's staff", "15"}};

int[][] otherPrices = {{7653, 1}, {7454, 1}, {7455, 3}, {7456, 5}, {7457, 10}, {7458, 15}, {7459, 25}, {7460, 50}, {7461, 1000}, {7462, 1000}, {4097, 59}, {4107, 153}, {4117, 61}, {4105, 59}, {4115, 59}, {4095, 58}, {4099, 92}, {4109, 118}, {4089, 145}, {4093, 482}, {4103, 478}, {4113, 480}, {4091, 721}, {4101, 720}, {4111, 720}};

int[][] killRequirments = {{10551, 15}, {6570, 30}, {8844, 5}, {8845, 0}, {8846, 1}, {8847, 2}, {8848, 3}, {8849, 4}, {8850, 5}, {10887, 10}, {4214, 25}, {4225, 25}, {7453, 0}, {7454, 5}, {7455, 10}, {7456, 15}, {7458, 1}, {7459, 2}, {7460, 3}, {7461, 4}, {7462, 5},};

public int getItemValue(int item) {
if (item == 995) {
return 1;
}
int value = 0;
for (String[] s : itemPrices) {
String name = Engine.items.getItemName(item);
if (name.equals(s[0])) {
value = 100 * Integer.parseInt(s[1]);
}
}
for (int[] i : otherPrices) {
if (item == i[0]) {
value = 100 * i[1];
}
}
if (Engine.items.stackable(item) && value == 0) {
value = 1;
}
return value;
}

public int getKillRequirment(int item) {
int requirment = 0;
for (int[] i : killRequirments) {
if (item == i[0]) {
requirment = i[1];
}
}
return requirment;
}

public int getKillCost(int item) {
int cost = 0;
for (String[] s : killPrices) {
String name = Engine.items.getItemName(item);
if (name.equals(s[0])) {
cost = Integer.parseInt(s[1]);
}
}
return cost;
}

public double PVPPotential;

public int totalKills;
public int kills;

public void message(String message) {
getActionSender().sendMessage(this, message);
}

public boolean teleblocked;
public int teleblockTimer = 500;

public boolean teletab;
public int leverTeleportX;
public int leverTeleportY;
public int leverTeleportH;
public int leverTeleportDelay = -1;

public boolean hitOne;
public boolean hitTwo;
public boolean hitThree;
public boolean hitFour;
public double hit1;
public double hit2;
public double hit3;
public double hit4;

public int specials;

public int spendingExperience = 16000000;

public int Starter = 1;

public int degrade = 6000;
public boolean degrades = degrade < 6000;

//Combat variables

public double rangedMax;

public int attackedByCount;
public String attacking;
public String attackedBy;

public boolean inLowBounty = false;
public boolean inMedBounty = false;
public boolean inHighBounty = false;
public int bountyMaxPlayers = 100;
public boolean bountyInterface = false;
public int BhTimer;
public int leftBhTimer = 0;
public int bhPickup;
public int pickedUp;
public int bhLeave;
public int bhTarget = 0;
public int bhLeave1;
public boolean inBounty = false;
public boolean isInFunPk = false;
public int InBounty = 0;

public int spell;
public int spell2;
public int cuedSpell;
public int cuedSpells;
public int magicOppIndex;
public int graphicMSDelay;
public int magicGraphicDelay = -1;
public int magicDamageDelay = -1;
public int magicAffectDelay = -1;
public boolean successfulCast;
public boolean usingMage;
public boolean orb;
public boolean recentFreeze = false;
public int weapon;
public int strengthBonus;
public int oppIndex;
public int hitIndex;

public boolean getExperience = true;
public PTrade pTrade;

public boolean getStarter = true;

public void statSpy(Player other) {
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};
getActionSender().setString(this, other.username.substring(0, 1).toUpperCase() + other.username.substring(1), 523, 99);
for (int i = 0; i < strings.length; i++) {
getActionSender().setString(this, ""+other.skillLvl[i], 523, strings[i]);
getActionSender().setString(this, ""+other.getLevelForXP(i), 523, strings[i] + 1);
}
getActionSender().setTab(this, 79, 523);
}

public void clearItem(int item) {
for (int i = 0; i < bankItems.length; i++) {
if (item == bankItems[i]) {
bankItems[i] = -1;
bankItemsN[i] = 0;
}
}
for (int i = 0; i < equipment.length; i++) {
if (item == equipment[i]) {
equipment[i] = -1;
equipmentN[i] = 0;
}
}
for (int i = 0; i < items.length; i++) {
if (item == items[i]) {
items[i] = -1;
itemsN[i] = 0;
}
}
}

public void clearItem(String item) {
String name = item;
for (int i = 0; i < bankItems.length; i++) {
if (name.equals(Engine.items.getItemName(bankItems[i]))) {
bankItems[i] = -1;
bankItemsN[i] = 0;
}
}
for (int i = 0; i < equipment.length; i++) {
if (name.equals(Engine.items.getItemName(equipment[i]))) {
equipment[i] = -1;
equipmentN[i] = 0;
}
}
for (int i = 0; i < items.length; i++) {
if (name.equals(Engine.items.getItemName(items[i]))) {
items[i] = -1;
itemsN[i] = 0;
}
}
}

public boolean lever;
public void leverTeleport(String location) {
if (teleblocked) {
getActionSender().sendMessage(this, "You are teleport blocked!");
return;
}
if (jailed == 1) {
getActionSender().sendMessage(this, "You are jailed!");
return;
}

int x = absX;
int y = absY;
int h = heightLevel;
if (location != null) {
if (location.equals("Deep Wilderness")) {
x = 3153;
y = 3923;
}
if (location.equals("Ardougne Lever")) {
x = 2561;
y = 3311;
}
if (location.equals("Mage Bank (Inside)")) {
x = 2539;
y = 4712;
}
if (location.equals("Mage Bank (Arena in)")) {
x = 3105;
y = 3951;
}
if (location.equals("Mage Bank (Arena out)")) {
x = 3105;
y = 3956;
}
if (location.equals("Mage Bank (Inside)")) {
x = 2539;
y = 4712;
}
if (location.equals("Mage Bank (Outside)")) {
x = 3090;
y = 3956;
}
}
getActionSender().removeShownInterface(this);
requestAnim(2140, 0);
leverTeleportX = x;
leverTeleportY = y;
leverTeleportH = h;
leverTeleportDelay = 2;
lever = true;
}

public void teletab(String city) {
int itemSlot = stream.readUnsignedWordBigEndianA();
int x = absX;
int y = absY;
int h = heightLevel;
int r = 0;
teletab = true;
if (city != null) {
if (city.equals("Varrock")) {
x = 3210;
y = 3421;
r = 4;
Engine.playerItems.deleteItem(this, 8007, itemSlot, 1);
}
if (city.equals("Lumbridge")) {
x = 3221;
y = 3218;
r = 2;
Engine.playerItems.deleteItem(this, 8008, itemSlot, 1);
}
if (city.equals("Troll")) {
x = 2891;
y = 3677;
r = 2;
Engine.playerItems.deleteItem(this, 8009, itemSlot, 1);
}
if (city.equals("Falador")) {
x = 2964;
y = 3378;
r = 3;
Engine.playerItems.deleteItem(this, 8009, itemSlot, 1);
}
if (city.equals("Camelot")) {
x = 2756;
y = 3476;
r = 3;
Engine.playerItems.deleteItem(this, 8010, itemSlot, 1);
}
if (city.equals("Home")) {
x = 3186;
y = 3439;
r = 2;
Engine.playerItems.deleteItem(this, 8013, itemSlot, 1);
}
if (city.equals("Ardougne")) {
x = 2660;
y = 3301;
r = 4;
Engine.playerItems.deleteItem(this, 8011, itemSlot, 1);
}
}
getActionSender().removeShownInterface(this);
x += getRandom(r);
y += getRandom(r);
teleportTo(x, y, h, 3, 0, 9597, 4071, 1680, 0, 678, 0);
}


public void cityTeleport(String city) {
int x = absX;
int y = absY;
int h = heightLevel;
int r = 0;
if (city != null) {
if (city.equals("Varrock")) {
x = 3210;
y = 3421;
r = 4;
}
if (city.equals("Lumbridge")) {
x = 3221;
y = 3218;
r = 2;
}
if (city.equals("Falador")) {
x = 2964;
y = 3378;
r = 3;
}
if (city.equals("Camelot")) {
x = 2756;
y = 3476;
r = 3;
}
if (city.equals("Ardougne")) {
x = 2660;
y = 3301;
r = 4;
}
}
getActionSender().removeShownInterface(this);
x += getRandom(r);
y += getRandom(r);
teleportTo(x, y, h, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
}

public boolean isPVP() {
return heightLevel == 4;
}
public boolean hotZone(int x, int y) {
if ((x >= 3205 && x <= 3222 && y >= 3420 && y <= 3438) || //Varrock
(x >= 3231 && x <= 3238 && y >= 3212 && y <= 3225) || //Lumbridge
(x >= 2949 && x <= 2978 && y >= 3367 && y <= 3391) || //Falador
(x >= 2741 && x <= 2774 && y >= 3464 && y <= 3481) || //Camelot
(x >= 2652 && x <= 2672 && y >= 3294 && y <= 3318)) { //Ardougne
return true;
}
return false;
}
public boolean Safezone(int x, int y) {
if ((x >= 3091 && x <= 3098 && y >= 3488 && y <= 3499) ||
(x >= 3135 && x <= 3192 && y >= 3652 && y <= 3702) ||
(x >= 3179 && x <= 3194 && y >= 3432 && y <= 3446) ||
(x >= 3250 && x <= 3257 && y >= 3416 && y <= 3423) ||
(x >= 2943 && x <= 2947 && y >= 2946 && y <= 3373) ||
(x >= 2943 && x <= 2949 && y >= 3368 && y <= 3368) ||
(x >= 3009 && x <= 3018 && y >= 3353 && y <= 3358) ||
(x >= 3009 && x <= 3022 && y >= 3353 && y <= 3356) ||
(x >= 2649 && x <= 2658 && y >= 3280 && y <= 3287) ||
(x >= 2612 && x <= 2621 && y >= 3330 && y <= 3335) ||
(x >= 3201 && x <= 3229 && y >= 3217 && y <= 3220) ||
(x >= 3201 && x <= 3226 && y >= 3209 && y <= 3228) ||
(x >= 3201 && x <= 3225 && y >= 3208 && y <= 3229) ||
(x >= 3201 && x <= 3224 && y >= 3207 && y <= 3230) ||
(x >= 3201 && x <= 3223 && y >= 3206 && y <= 3231) ||
(x >= 3201 && x <= 3222 && y >= 3205 && y <= 3232) ||
(x >= 3201 && x <= 3221 && y >= 3204 && y <= 3233) ||
(x >= 3201 && x <= 3220 && y >= 3203 && y <= 3234) ||
(x >= 3201 && x <= 3213 && y >= 3202 && y <= 3235) ||
(x >= 3201 && x <= 3212 && y >= 3201 && y <= 3236) ||
(x >= 3201 && x <= 3203 && y >= 3202 && y <= 3235) ||
(x >= 3201 && x <= 3202 && y >= 3203 && y <= 3234) ||
(x >= 2526 && x <= 2550 && y >= 4709 && y <= 4725) ||
(x >= 2358 && x <= 2438 && y >= 3066 && y <= 3142) ||
(x >= 3201 && x <= 3201 && y >= 3204 && y <= 3233)) {
return true;
}
return false;
}

public boolean DoorArea(int x, int y) {
if ((x >= 3124 && x <= 3124 && y >= 3665 && y <= 3665) ||
(x >= 3138 && x <= 3138 && y >= 3669 && y <= 3669) ||
(x >= 3146 && x <= 3146 && y >= 3681 && y <= 3681) ||
(x >= 3163 && x <= 3163 && y >= 3696 && y <= 3696) ||
(x >= 3180 && x <= 3180 && y >= 3708 && y <= 3708) ||
(x >= 3181 && x <= 3181 && y >= 3720 && y <= 3720) ||
(x >= 3171 && x <= 3171 && y >= 3737 && y <= 3737) ||
(x >= 3101 && x <= 3101 && y >= 3682 && y <= 3682) ||
(x >= 3170 && x <= 3170 && y >= 3746 && y <= 3746) ||
(x >= 3163 && x <= 3163 && y >= 3753 && y <= 3753) ||
(x >= 3147 && x <= 3147 && y >= 3758 && y <= 3758) ||
(x >= 3135 && x <= 3135 && y >= 3758 && y <= 3758) ||
(x >= 3121 && x <= 3121 && y >= 3754 && y <= 3754) ||
(x >= 3110 && x <= 3110 && y >= 3747 && y <= 3747) ||
(x >= 3091 && x <= 3091 && y >= 3735 && y <= 3735) ||
(x >= 3086 && x <= 3086 && y >= 3717 && y <= 3717) ||
(x >= 3091 && x <= 3091 && y >= 3706 && y <= 3706) ||
(x >= 3096 && x <= 3096 && y >= 3692 && y <= 3692) ||
(x >= 3108 && x <= 3108 && y >= 3670 && y <= 3670) ||
(x >= 3171 && x <= 3171 && y >= 3701 && y <= 3701)) {
return true;
}
return false;
}


public void Welcome() {
if (this == null || this.disconnected[0]) {
return;
}
requestGFX(1844, 0);
getActionSender().removeOverlay(this);
getActionSender().removeShownInterface(this);
getActionSender().setOverlay(this, 653);
getActionSender().setInterfaceConfig(this, 653, 9, false);
getActionSender().setString(this, "None", 653, 8);
getActionSender().setString(this, "Target:", 653, 7);
getActionSender().setString(this, "Target Likelihood:", 653, 10);
getActionSender().setString(this, "0%", 653, 11);
bhtl = true;
bh1 = 30;
clearItem("null");
getActionSender().setWindowPane(this, 549);
getActionSender().setInterface(this, 1, 549, 2, 378);
getActionSender().setInterface(this, 1, 549, 3, 17);
getActionSender().setString(this, "Message", 17, 0);
getActionSender().setString(this, "World Of Welf.", 17, 3);
getActionSender().setString(this, "Message", 378, 37);
getActionSender().setString(this, "Don't forget, if you donate we will buy a VPS for more uptime.", 378, 38);
getActionSender().setString(this, "1", 378, 39);
if (Donator == 1) {
getActionSender().setString(this, "Donator", 378, 94);
getActionSender().setString(this, "You have infinite member credit remaining.", 378, 93);
getActionSender().setString(this, "Yes", 378, 96);
} else {
getActionSender().setString(this, "Donator", 378, 94);
getActionSender().setString(this, "You have no member credit.", 378, 93);
getActionSender().setString(this, "No", 378, 96);
}
getActionSender().setString(this, "Welcome to World Of Welf", 378, 115);
getActionSender().setString(this, "You last logged in yesterday from: " + Server.socketListener.getAddress(socket.socket) + "", 378, 116);
}

public String getKillMessage(String player) {
String[][] selection = {{"It's official: you are far more awesome than ", " is."},
{"Let all warriors learn from the fate of ", " and fear you."},
{"Well done, you've pwned ", "."},
{"You rock, ", " clearly does not."},
{"", " was clearly no match for you."},
{"You have wiped the floor with ", "."},
{"Ooh, ", " just dropped dead, and it's all thanks to you!"},
{"", " has fallen before your mighty mightiness."},
{"You have proven your superiority over ", "."}};
int index = (int)Math.floor(Math.random() * 9);
return selection[index][0] + player + selection[index][1];
}

public boolean multiwayCombatZone(int x, int y) {
if ((x > 3072 && x < 3107 && y > 3401 && y < 3448) ||
(x > 2946 && x < 3004 && y > 3333 && y < 3424) ||
(x > 3193 && x < 3332 && y > 3665 && y < 3752) ||
(x > 3203 && x < 3331 && y > 3519 && y < 3666) ||
(x > 3134 && x < 3328 && y > 3519 && y < 3658) ||
(x > 2945 && x < 2961 && y > 3812 && y < 3828) ||
(x > 2982 && x < 3010 && y > 3913 && y < 3929) ||
(x > 3203 && x < 3392 && y > 3904 && y < 4031) ||
(x > 3385 && x < 3241 && y > 3970 && y < 3822) ||
(x > 3149 && x < 3331 && y > 3799 && y < 3850) ||
(x > 3064 && x < 3391 && y > 3864 && y < 3903) ||
(x > 3006 && x < 3072 && y > 3601 && y < 3713)) {
return true;
}
return false;
}

public boolean timerStarted;
public long PVPTimer;

public boolean wildernessZone(int x, int y) {
if (!isPVP()) {
if (jailed == 1) setCoords(3093, 3490, 4);
return (x >= 3042 && x <= 3395 && y >= 3523 && y <= 4000);
}
if (isPVP()) {
if (jailed == 1) setCoords(3093, 3490, 4);
if ((x >= 3091 && x <= 3098 && y >= 3488 && y <= 3499) ||
(x >= 3161 && x <= 3167 && y >= 3480 && y <= 3488) ||
(x >= 3179 && x <= 3194 && y >= 3432 && y <= 3446) ||
(x >= 3250 && x <= 3257 && y >= 3416 && y <= 3423) ||
(x >= 2943 && x <= 2947 && y >= 2946 && y <= 3373) ||
(x >= 2943 && x <= 2949 && y >= 3368 && y <= 3368) ||
(x >= 3009 && x <= 3018 && y >= 3353 && y <= 3358) ||
(x >= 3009 && x <= 3022 && y >= 3353 && y <= 3356) ||
(x >= 2721 && x <= 2730 && y >= 3490 && y <= 3493) ||
(x >= 2724 && x <= 2727 && y >= 3487 && y <= 3489) ||
(x >= 2649 && x <= 2658 && y >= 3280 && y <= 3287) ||
(x >= 2612 && x <= 2621 && y >= 3330 && y <= 3335) ||
(x >= 3201 && x <= 3229 && y >= 3217 && y <= 3220) ||
(x >= 3201 && x <= 3226 && y >= 3209 && y <= 3228) ||
(x >= 3201 && x <= 3225 && y >= 3208 && y <= 3229) ||
(x >= 3201 && x <= 3224 && y >= 3207 && y <= 3230) ||
(x >= 3201 && x <= 3223 && y >= 3206 && y <= 3231) ||
(x >= 3201 && x <= 3222 && y >= 3205 && y <= 3232) ||
(x >= 3201 && x <= 3221 && y >= 3204 && y <= 3233) ||
(x >= 3201 && x <= 3220 && y >= 3203 && y <= 3234) ||
(x >= 3201 && x <= 3213 && y >= 3202 && y <= 3235) ||
(x >= 3201 && x <= 3212 && y >= 3201 && y <= 3236) ||
(x >= 3201 && x <= 3203 && y >= 3202 && y <= 3235) ||
(x >= 3201 && x <= 3202 && y >= 3203 && y <= 3234) ||
(x >= 3201 && x <= 3201 && y >= 3204 && y <= 3233) ||
(x >= 3007 && x <= 3062 && y >= 10301 && y <= 10353)){
if ((attacking == null && attackedBy == null) || (timerStarted && System.currentTimeMillis() - PVPTimer >= 10000)) {
if (timerStarted) {
removeWilderness();
timerStarted = false;
attackedBy = null;
attacking = null;
}
return false;
} else if (!timerStarted && (attacking == null || attackedBy != null || attacking != null || attackedBy == null)) {
PVPTimer = System.currentTimeMillis();
timerStarted = true;
pvpsafe = 10;
}
}
return true;
}
return false;
}

public int getWildernessLevel() {
int level = 0;
if (absY >= 3525 && absY <= 3527) {
level = 1;
} else if (absY >= 3526 && absY <= 3535) {
level = 2;
} else {
level = 3 + (int)Math.ceil((absY - 3536) / 8);
}
if (level < 0 || absY < 3525) {
level = 0;
}
if (!isPVP()) {
return level;
}
if (isPVP()) {
double base = 5 + (combatLevel * 0.10);
int total = (int)Math.round(base) + level;
if (wildernessZone(absX, absY)) {
return total;
} else {
return 0;
}
}
return level;
}

public boolean properWildernessLevel(int thisCombat, int opponentCombat) {
int difference = thisCombat >= opponentCombat ? thisCombat - opponentCombat : opponentCombat - thisCombat;
return getWildernessLevel() >= difference;
}

public void restoreTabs(Player p) {
for (int b = 16; b <= 21; b++) {
p.getActionSender().setInterfaceConfig(p, 548, b, false);
}

for (int a = 32; a <= 38; a++) {
p.getActionSender().setInterfaceConfig(p, 548, a, false);
}
p.calculateEquipmentBonus();

p.getActionSender().setInterfaceConfig(p, 548, 14, false);
p.getActionSender().setInterfaceConfig(p, 548, 31, false);
p.getActionSender().setInterfaceConfig(p, 548, 63, false);

p.getActionSender().setInterfaceConfig(p, 548, 72, false);
}
public void hideTabs(Player p) {
for (int b = 16; b <= 21; b++) {
p.getActionSender().setInterfaceConfig(p, 548, b, true);
}

for (int a = 32; a <= 38; a++) {
p.getActionSender().setInterfaceConfig(p, 548, a, true);
}
p.calculateEquipmentBonus();

p.getActionSender().setInterfaceConfig(p, 548, 14, true);
p.getActionSender().setInterfaceConfig(p, 548, 31, true);
p.getActionSender().setInterfaceConfig(p, 548, 63, true);

p.getActionSender().setInterfaceConfig(p, 548, 72, true);
}
public boolean Pits(){
return absX >= 3085 && absX <= 3185 && absY >= 3662 && absY <= 3765;
}

/**
* Player count in clan.
*/
public static int blackCount, whiteCount;
/**
* Clan wars teams
*/
public static boolean blackTeam, whiteTeam;
/**
* Clan wars handler
*/
public ClanWars clanWars = Engine.clanWars;
/**
* Wilderness level
*/
public int wildLevel;
/**
* If player updated the Wilderness level.
*/
public boolean updatedLevel;
public int savedLevel;
/**
* Thieving.
*/
public int[] thievingArray = new int[4];
public int maxArrays = 10;
public boolean[] optionArray = new boolean[maxArrays];
public TestWorldLoader worldLoader = new TestWorldLoader(this);
/**
* Quest variables
*/
public int questId;
public int questStage;
public QuestDevelopment quest = new QuestDevelopment(this);
/**
* Has entered defence room Warrior guild.
*/
public boolean enteredDefenceRoom;
/**
* Prevents XLogging.
*/
public int combatType;
/**
* The delay for making a fire.
*/
public int[] firemaking = new int[4];
/**
* Next graphic creating delay for MSB Special attack
*/
public int nextDamageDelay = -1;
public int nextGraphicDelay = -1;
/**
* Item ids of which are not spawnable.
*/
public int[] economyItems = {
11696, 11698, 11700, 11694, 11730, 3140, 11718, 11720, 11722, 11724, 11726, 11728,
11690, 11702, 11704, 11706, 11708, 10581, 10566, 10637, 385, 391, 2440, 2434, 6685,
11235, 4151, 12670, 12671, 4153
};
/**
* Option variable
*/
public int optionId;
/**
* Call Warrior guild class
*/
public WarriorGuild warriorGuild = new WarriorGuild(this);
/**
* Defender dropping types variable
*/
public int defenderId;

/**
* Wilderness Levels
*/
public int wildernessLevel;

/**
* Summoning variables
*/
public int summonTeleDelay = -1;
public int summonDrainDelay = -1;
public boolean callFamiliar;
public boolean familiarDissMiss;
public boolean summonedFamiliar;
public boolean hasFamiliar;

/**
* Warrior Guild variables
*/
public int[] randomItemIds = {
8843, 8844, 8845, 8846, 8847, 8848, 8849, 8850
};
public String warriorArmour;

/**
* autoCast Variables
*/

public int[] regularStaffs = {
1381
};
public int[] otherStaffs = {
4675
};
public int autoCastDmgDelay = -1;
public int autoCastDelay;
public int[] autoCast = new int[3];
public boolean castAuto;
public boolean usingAutoCast;
/**
* If player is disturbing commander zilyana.
*/
public boolean disturbSara;
/**
* Death Delays
*/
public int deathEmoteDelay = -1;
/**
* Yell delay
*/
public int massYellDelay = 0;

/**
* Crystal bow shots.
*/
public int crystalShots;

/**
* Fight Cave variables
*/
public int neededKills;
public int[] waveType = new int[5];
public int waveCount;
public int waveDelay = -1;
public FightCave fCave = new FightCave(this);

/**
* Fletching variables
*/
public int deletedItem, addedItem;
public int fletchAmt;
public boolean isFletching;
public int[] fletching;
public int fletchDelay;
public int fletchType, fletchExp;
PlayerFletching fletchingClass = new PlayerFletching(this);

public int equipSpecDelay;
public int[] miningAxes = {
1265, 1267, 1269, 1271, 1273, 1275
};
public boolean isBanking;

/**
* Dueling variables
*/
public int countDelay = -1;
public int countType = -1;
public boolean duelDeath;
public boolean acceptDuel;
public boolean acceptScreen1, acceptScreen2;
public DuelArena duelArena = new DuelArena(this);
public int duelFriend;
public boolean duelScreen1, duelScreen2;

public int explodeType;
public int explodeDelay = -1;

public int[] godWarsKills = new int[5];

public int watchId = -1;

public int spellType;

public int playerStart;

public boolean muteExpect, muteExpect2;
public int muteType;
public int[] hugeNpcs = {
50, 1155, 1157, 1158, 1160, 2745, 6222, 6203, 8133
};

/**
* Woodcutting variables
*/
public int cutDelay;
public boolean isWoodcutting;

/**
* Dueling variables
*/
public boolean isBusy;
public int duelEnemy;
public boolean inDuelFight;

/**
* Pet variables
*/
public int petKeeper;
public boolean summonedPet;

/**
* Mage Arena variables
*/
public int kolodionDelay;
public boolean arenaActive;

/**
* Slayer variables
*/
public int slayerAmount1;
public int slayerType1;
public int[] slayerType = {
1615, 5363, 55, 54
};
public boolean slayerTask;
public int[] slayerArray = {
1, 2, 3, 4
};
public int slayerAmount;

/**
* Pvn variables
*/
public int damageSpecDelay = -1;
public boolean enableSpecDamage;
public int damageDelay1 = -1;
public boolean enableDamage;
public int atkDelay;
public boolean attackingNpc;
public int attackNpc;

/**
* Clan wars variables.
*/
public boolean blackClan;
public boolean whiteClan;

/**
* Thieving variables.
*/
public int pickPocketDelay;

/**
* This variable is added to add facing if player is gonna pickpocket.
*/
public int npcClick2;

/**
* Mining variables.
*/
public int rockId;
public boolean isMining;
public int receiveOreDelay;
public int miningDelay;

/**
* Wilderness variables.
*/
public int wildyLevel;

public int statDelay = 100; //Stat update delay
public int hpDelay = 100; //HP update delay

/**
* Emote clicking delay.
*/
public int animClickDelay;
public boolean usingPrayer;
public int buryDelay;
public int drainDelay;
public boolean rangedPrayer;
public boolean meleePrayer;
public boolean magicPrayer;
public boolean retriPrayer;
public boolean redempPrayer;

//Prayer

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}};
public int headIconPrayer = -1;
public double drainCount = 0;

public boolean canPray(int prayer) {
if (skillLvl[5] > 0 && getLevelForXP(5) >= prayers[prayer][0]) {
return true;
}
return false;
}

public boolean usingPrayer(int prayer) {
return prayers[prayer][1] == 1;
}

public boolean usingPrayer() {
int i = 0;
while (i <= 26) {
if (prayers[i][1] == 1) return true;
i++;
}
return false;
}

public void togglePrayer(int prayer, int toggle) {
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};
prayers[prayer][1] = toggle;
getActionSender().setConfig(this, configuration[prayer], toggle);
}

public double prayerDrain() {
int i = 0;
double drainPerMinute = 0;
while (i <= 26) {
if (usingPrayer(i)) drainPerMinute += prayers[i][2];
i++;
}
drainPerMinute *= 1 + (equipmentBonus[11] / 30);
return drainPerMinute / 100;
}

public void switchPrayers(int[] prayers, int prayer) {
if (!canPray(prayer)) {
return;
}
for (int i : prayers) {
if (usingPrayer(i)) {
togglePrayer(i, 0);
}
}
}

public void prayerSounds(int prayer) {
int sound = 0;
switch (prayer) {
case 0: sound = 2690; break;
case 1: sound = 2688; break;
case 2: sound = 2664; break;
case 3: sound = 2685; break;
case 4: sound = 2668; break;
case 5: sound = 2684; break;
case 6: sound = 2689; break;
case 7: sound = 2662; break;
case 8: sound = 2679; break;
case 9: sound = 2678; break;
case 10: sound = 0; break;
case 11: sound = 2666; break;
case 12: sound = 2670; break;
case 13: sound = 2687; break;
case 14: sound = 2691; break;
case 15: sound = 2667; break;
case 16: sound = 0; break;
case 17: sound = 2675; break;
case 18: sound = 2677; break;
case 19: sound = 2676; break;
case 20: sound = 2665; break;
case 21: sound = 2669; break;
case 22: sound = 2682; break;
case 23: sound = 2680; break;
case 24: sound = 2686; break;
case 25: sound = 3826; break;
case 26: sound = 3825; break;
}
if (sound != 0) {
getActionSender().addSoundEffect(this, sound, 1, 0, 0);
}
}

public void resetPrayer() {
int i = 0;
while (i <= 26) {
togglePrayer(i, 0);
i++;
}
drainCount = 0;
headIconPrayer = -1;
updateReq = true;
appearanceUpdateReq = true;
}
public void resetbarrowkc() {
barrowkc = 0;

}

/**
* Magic combat variables
*/
public int freezeDelay;
public int runChance;
public int vengeanceDelay;
public boolean vengeance;
public int spellbookSwapTimer;
public boolean spellbookSwap;
public boolean usedSpellbookSwap;
public int mageDelay;

/**
* Agility Variables
*/
public int[] agilityX = {
2476, 2475, 2474, 2473, 2472, 2471
};
public int[] agilityY = {
3426
};
public boolean agilityPerforming;
public int agilityDelay;
public int agilityType;

/**
* Combat variables
*/
public boolean fadeAway;
public int enemyFadeAwayDelay = -1;
public int fightStyle = 1;
public int[] strangeItems = {
6570
};
public int battleCDelay;
public int battleCount;
public int poisonDelay;
public int poisonHitCount;
public boolean isPoisoned;
public int headIconSkull = -1;
public boolean isSkulled;
public int skullVanishDelay;
public int rangeDmgDelay = -1;
public int rangeDmgDelay2 = -1;

public int[] rangeBows = {
841, 843, 845, 847, 849, 851, 853,
855, 857, 859, 861, 9174, 9176, 9177,
9179, 9181, 9183, 8880, 9185
};
public int[] rangeArrows = {
882, 884, 886, 888, 890, 892
};
public int[] godSwords = {
11694, 11696, 11698, 11700
};
public int myBonus;
public int meleeDef;
public int waitDeathDelay = -1;
public boolean randomVariable;
public int deathDelay = -1;
public boolean isDead;
public int specDelay = -1;
public int secondSpecDelay = -1;
public int delayedDamageDelay = -1;
public int delayedDamageHit = -1;
public boolean expectSpec;
public boolean autoRetaliate = true;
public int specFillDelay = 50;
public boolean usingSpecial;
public int specAmount;
public int damageDelay;
public boolean damagePending;
public int combatDelay;
public int enemyIndex;
public boolean attackingPlayer;

/**
* Player's index.
*/
public int playerId = 0;
/**
* Class for storing and converting bytes.
*/
public ByteVector stream = new ByteVector(500, 5000);
/**
* Player's socket for handling most io operations.
*/
public PlayerSocket socket;
/**
* Set to true if the player has finished the login stage.
*/
public boolean online = false;
/**
* Player's username.
*/
public String username = "null";
/**
* Player's password.
*/
public String password = "";
/**
* Player's rights.
*/
public int rights = 0;
/**
* Player's jail status.
*/
public int jailed = 0;
/**
* Player's starter.
*/
public int starter = 0;
/**
* 1 set to true means socket disconnected but logged in, both for removing the player.
*/
public boolean[] disconnected = new boolean[2];
/**
* The region this player is in.
*/
public int mapRegionX = 0;
public int mapRegionY = 0;
/**
* The position this player is at in the map region.
*/
public int currentX = 0;
public int currentY = 0;
/**
* Absolute coordinates this player is at.
*/
public int absX = 0;
public int absY = 0;
/**
* The height level this player is at.
*/
public int heightLevel = 0;
/**
* Storing players spellbook
*/
public int spellbook = 192;
/**
* If either are above -1 then the player is in motion.
*/
public int walkDir = -1;
public int runDir = -1;
/**
* True if the player is running, false if it isn't.
*/
public boolean isRunning = false;
/**
* Set to true if the player has entered a new map region.
*/
public boolean mapRegionDidChange = false;
/**
* Set to true if teleported.
*/
public boolean didTeleport = false;
/**
* Set Absolute coordinates to these.
*/
public int teleportToX = -1;
public int teleportToY = -1;
/**
* True if the player is Reqing an update.
*/
public boolean updateReq = false;
/**
* Max number of steps this player can have pending.
*/
public int walkingQueueSize = 50;
public int wQueueReadPtr = 0;
public int wQueueWritePtr = 0;
/**
* Positions the player is Reqing to walk to.
*/
public int[] walkingQueueX = new int[walkingQueueSize];
public int[] walkingQueueY = new int[walkingQueueSize];
public int[] walkingQueue = new int[walkingQueueSize];
/**
* All the players within distance.
*/
public Player[] playerList = new Player[Engine.players.length];
/**
* All the players stored in distance.
*/
public byte[] playersInList = new byte[Engine.players.length];
public int playerListSize = 0;
/**
* True if chatting is Reqing to be sent.
*/
public boolean chatTextUpdateReq = false;
public String chatText = "";
public int chatTextEffects = 0;
/**
* True if an appearance update is needed.
*/
public boolean appearanceUpdateReq = false;
/**
* Animation data.
*/
public boolean animUpdateReq = false;
public int animReq = -1;
public int animDelay = 0;
/**
* GFX data.
*/
public boolean gfxUpdateReq = false;
public int gfxReq = -1;
public int gfxDelay = 0;
/**
* Player and NPC facing data.
*/
public boolean faceToUpdateReq = false;
public int faceToReq = -1;
/**
* Damage data.
*/
public boolean hit1UpdateReq = false;
public boolean hit2UpdateReq = false;
public int hitDiff1 = 0;
public int hitDiff2 = 0;
public int poisonHit1 = 0;
public int poisonHit2 = 0;
/**
* Skill level data.
*/
public int[] skillLvl = new int[25];
public int[] skillXP = new int[25];
public int combatLevel = 0;
/**
* Equipment data.
*/
public int[] equipment = new int[14];
public int[] equipmentN = new int[14];
public int[] equipmentBonus = new int[12];
/**
* Player appearance.
*/
public int[] color = new int[5];
public int[] look = new int[7];
public int npcType = -1;
public int gender = 0;
/**
* Player emotes.
*/
public int runEmote = 0x338;
public int walkEmote = 0x333;
public int standEmote = 0x328;
/**
* All the NPCs within distance.
*/
public NPC[] npcList = new NPC[Engine.npcs.length];
/**
* All the npcs stored in distance.
*/
public byte[] npcsInList = new byte[Engine.npcs.length];
public int npcListSize = 0;
/**
* Rebuild the entire NPC list.
*/
public boolean rebuildNPCList = false;
/**
* An array storing all the players items.
*/
public int[] items = new int[28];
public int[] itemsN = new int[28];
/**
* Open interfaces, use these to confirm an interface is open when trying to use one.
*/
public int interfaceId = -1;
public int chatboxInterfaceId = -1;
/**
* The current position in the login stage.
*/
public int loginStage = 0;
/**
* Click x position.
*/
public int clickX = 0;
/**
* Click y position.
*/
public int clickY = 0;
/**
* Click id.
*/
public int clickId = 0;
/**
* Eat delay.
*/
public int eatDelay;
public int drinkDelay;
/**
* True if the player is trying to pickup an item.
*/
public boolean itemPickup = false;
/**
* Set run energy.
*/
public boolean runEnergyUpdateReq = false;
/**
* Amount of current run energy.
*/
public int runEnergy = 100;
/**
* Delay before run energy can increase.
*/
public int runEnergyDelay = 0;
/**
* Clicked the first option on a player.
*/
public boolean playerOption1 = false;
/**
* Clicked the second option on a player.
*/
public boolean playerOption2 = false;
/**
* Clicked the third option on a player.
*/
public boolean playerOption3 = false;
/**
* Clicked the first option on a NPC.
*/
public boolean npcOption1 = false;
/**
* Clicked the first option on an object.
*/
public boolean objectOption1 = false;
/**
* Setting the prayer system effects.
*/
public PrayerSystem prayerSystem = new PrayerSystem(this);
/**
* Setting the players weapon.
*/
public PlayerWeapon playerWeapon = new PlayerWeapon(this);
/**
* Clicked the second option on an object.
*/
public boolean objectOption2 = false;
/**
* Clicked the second option on a NPC.
*/
public boolean npcOption2 = false;
/**
* Forced chat.
*/
public String forceChat = "";
public boolean forceChatUpdateReq = false;
/**
* Teleporting variables.
*/
public int teleX = -1;
public int teleY = -1;
public int teleH = -1;
public int teleDelay = -1;
public int teleFinishGFX = 0;
public int teleFinishGFXHeight = 0;
public int teleFinishAnim = 0;
/**
* Delay before recieving packets.
*/
public int clickDelay = -1;
public long loginTimeout = System.currentTimeMillis();
public int[] bankItems = new int[500];
public int[] bankItemsN = new int[500];

/**
* Constructs a new Player.
* @param socket The socket this Player belongs to.
* @param id The index this player is at.
*/
public Player(Socket socket, int id) {
this.socket = new PlayerSocket(this, socket);
playerId = id;
look[0] = 0;
look[1] = 10;
look[2] = 18;
look[3] = 26;
look[4] = 33;
look[5] = 36;
look[6] = 42;
for (int i = 0; i < skillLvl.length; i++) {
skillLvl[i] = 1;
skillXP[i] = 0;
skillLvl[3] = 10;
skillXP[3] = 1155;
}
for (int i = 0; i < items.length; i++) {
items[i] = -1;
itemsN[i] = 0;
}
for (int i = 0; i < equipment.length; i++) {
equipment[i] = -1;
}
for (int i = 0; i < bankItems.length; i++) {
bankItems[i] = -1;
}
pTrade = new PTrade(this);
}

public boolean skillCapeEquiped() {
for (int i = 10639; i < 10663; i++) {
for (int j = 9747; j < 9812; j++) {
if (equipment[1] == i || equipment[1] == j || equipment[1] == 12169 || equipment[1] == 12170) {
return true;
}
}
}
return false;
}

public int logoutTimer;
public int restoreSpecialTimer;
int tellAll = 700;

public void processTimers() { //Processes evenly at 1000 milliseconds
if (tellAll > 0) {
tellAll--;
}
if (tellAll == 700) {
message("<img=2>[SERVER]<col=336600>DONATE TO KEEP SERVER UP !!!");
}
if (tellAll == 500) {
message("<img=2>[SERVER]<col=336600>REGISTER AT Only the registered members can see the link.!!!");
}
if (tellAll == 350) {
message("<img=2>[SERVER]<col=336600>VOTE EVERY DAY!!!");
}
if (tellAll == 150) {
message("<img=2>[SERVER]<col=336600>RESPECT AL PLAYERS!!!");
}
if (tellAll == 0) {
message("<img=2>[SERVER]<col=336600>BREAK ANY RULE WILL BE WARN THEN BAN!!!");
tellAll = 850;
}
if (updateTime > 0) {
updateTime--;
updateTimer = true;
}
if (updateTime == 0 && updateTimer == true) {
System.exit(0);
}
if (cantpray > 0) {
cantpray--;
}
if (freezeDelay > 0) {
freezeDelay--;
}
if (runChance > 0) {
runChance--;
}
if (vengeanceDelay > 0) {
vengeanceDelay--;
}
if (spellbookSwapTimer > 0) {
spellbookSwapTimer--;
} else if (spellbookSwap) {
getActionSender().setTab(this, 79, spellbook);
spellbookSwap = false;
usedSpellbookSwap = false;
}
if (attackedBy != null) {
count++;
if (count == 6) {
attackedBy = null;
attackedByCount--;
count = 0;
}
}
if (logoutTimer > 0) {
logoutTimer--;
}
if (restoreSpecialTimer > 0) {
restoreSpecialTimer--;
}
}


/**
* This method is called every 600 milliseconds.
* <p>While this is good for for changing integers, this
* should not be abused. Things that can be handled else where should
* be done in that way, such as clicking the accept button in trade
* should update in the ActionsButton class rather than Reqing
* an update for the process to handle.
*/

public void attackPlayer() {
PlayerCombat pc = new PlayerCombat(this);
pc.attackPlayer();
}
/**
*Pm void
*/
public void friendsLoggedIn() {
for(Long friend : friends) {
getActionSender().sendFriend(this, friend, getWorld(friend));
}
long[] array = new long[ignores.size()];
int i = 0;
for(Long ignore : ignores) {
if(ignore != null)
array[i++] = ignore;
}
getActionSender().sendIgnores(this, array);
long me = Misc.stringToLong(username);
for(Player p : Engine.players) {
if(p == null) continue;
if(p.friends.contains(me)) {
p.getActionSender().sendFriend(p, me, 66);
}
}
}
public int getWorld(long friend) {
for(Player p : Engine.players) {
if(p != null && p.online) {
if(Misc.stringToLong(p.username) == friend) {
return 66;
}
}
}
return 0;
}

public int count;
public boolean usedLogout;

public void process() {
if (heightLoad == 0 && heightSave != heightLevel && heightSave != 0) {
setCoords(absX, absY, heightSave);
heightLoad = 1;
}
heightSave = heightLevel;
heightLoad = 1;

if (systemupdate == 1) {
disconnected[0] = true;
}
if (systemupdate > 1) {
systemupdate--;
}
if(serverMess > 0){
serverMess--;
}
if(serverMess == 0 && serverMessSet == true) {
for ( Player ap : Engine.players) {
if(ap == null)
continue;
if(!ap.online)
continue;
ap.getActionSender().sendMessage(ap, "<col=FF1A00>[SERVER]: Stay on server guys");
ap.getActionSender().sendMessage(ap, "<col=FF1A00>Go to ::pvp. - Auto message -");
serverMess = 60;
System.out.println("Message sent at "+Misc.getDate()+" to server.");
}
}
if (pvpsafe > 0) {
pvpsafe--;
}
if (pvpsafe == 10) {
getActionSender().sendMessage(this, "10 Seconds until safe.");
}
if (pvpsafe == 9) {
getActionSender().sendMessage(this, "9 Seconds until safe.");
}
if (pvpsafe == 8) {
getActionSender().sendMessage(this, "8 Seconds until safe.");
}
if (pvpsafe == 7) {
getActionSender().sendMessage(this, "7 Seconds until safe.");
}
if (pvpsafe == 6) {
getActionSender().sendMessage(this, "6 Seconds until safe.");
}
if (pvpsafe == 5) {
getActionSender().sendMessage(this, "5 Seconds until safe.");
}
if (pvpsafe == 4) {
getActionSender().sendMessage(this, "4 Seconds until safe.");
}
if (pvpsafe == 3) {
getActionSender().sendMessage(this, "3 Seconds until safe.");
}
if (pvpsafe == 2) {
getActionSender().sendMessage(this, "2 Seconds until safe.");
}
if (pvpsafe == 1) {
getActionSender().sendMessage(this, "1 Second until safe GWAS!");
}
if (leftBhTimer > 0) {
leftBhTimer--;
}
if (bhLeave1 > 0) {
bhLeave1--;
}
if(bhPickup < 1 && (InBounty == 1)) {
bhPickup--;
this.getActionSender().setString(this, "", 653, 11);
this.getActionSender().setString(this, "", 653, 10);
}
if(bhPickup > 0 && (InBounty == 1)) {
bhPickup--;
this.getActionSender().setString(this, + bhPickup +" Sec", 653, 11);
this.getActionSender().setString(this, "Can't leave for:", 653, 10);
}
if(bhLeave > 0 && (InBounty == 1)) {
bhLeave--;
this.getActionSender().setString(this, + bhLeave +" Sec", 653, 11);
this.getActionSender().setString(this, "Pickup penalty:", 653, 10);
}
if (DFSDelay > 0) {
DFSDelay--;
} else if (DFSDelay == 0) {
append1Hit((int)Math.round(Math.random() * 25), 0);
DFSDelay = -1;
}
if(InBounty == 1){
getActionSender().setHintIcon(this, 10, this.bhTarget, 1, -1);
Player p9 = Engine.players[this.bhTarget];
if(p9 != null) {
this.getActionSender().setString(this, "" + p9.username , 653, 8);
if (p9.rights == 10) {
this.bhTarget = Engine.BountyHunter.getTargetHigh(this);
getActionSender().sendMessage(this, "Your target was an administrator and you have been re-asigned one.");
}
} else {
this.getActionSender().setString(this, "None" , 653, 8);
this.bhTarget = Engine.BountyHunter.getTargetHigh(this);
}
}

if(followingPlayer)
Engine.playerFollow.followPlayer(this);

if (leverTeleportDelay > 0) {
leverTeleportDelay--;
} else if (leverTeleportDelay == 0) {
teleportTo(leverTeleportX, leverTeleportY, leverTeleportH, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
lever = false;
leverTeleportDelay--;
}

if (teleblocked && teleblockTimer > 0) {
if (teleblockTimer == 500) {
getActionSender().sendMessage(this, "You have been teleport blocked!");
if (usingPrayer(17)) {
teleblockTimer = 300;
}
}
teleblockTimer--;
}
if (teleblockTimer == 0) {
teleblocked = false;
teleblockTimer = 500;
getActionSender().sendMessage(this, "The teleport block has worn off.");
}

if (degrades && equipment[3] == 13889) {
degrade--;
if (degrade == 0) {
boolean deleted = false;
PlayerItems playerItems = new PlayerItems();
for (int i = 0; i < equipment.length; i++) {
if (equipment[i] == 13889) {
equipment[i] = -1;
equipmentN[i] = 0;
getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
getActionSender().sendMessage(this, "Your Vesta's longsword has degraded into nothing.");
deleted = true;
break;
}
}
if (!deleted) {
for (int i = 0; i < items.length; i++) {
if (items[i] == 13889) {
playerItems.deleteItem(this, 13889, playerItems.getItemSlot(this, 13889), 1);
getActionSender().sendMessage(this, "Your Vesta's longsword has degraded into nothing.");
deleted = true;
break;
}
}
}
if (!deleted) {
for (int i = 0; i < bankItems.length; i++) {
if (bankItems[i] == 13889) {
bankItemsN[i]--;
if (bankItemsN[i] <= 0) {
bankItems[i] = -1;
}
getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
getActionSender().setItems(this, 149, 0, 93, items, itemsN);
getActionSender().sendMessage(this, "Your Vesta's longsword has degraded into nothing.");
break;
}
}
}
degrade = 6000;
degrades = false;
}
}



if (magicGraphicDelay > 0) {
magicGraphicDelay--;
} else if (magicGraphicDelay == 0) {
PlayerMagic playerMagic = new PlayerMagic(this);
playerMagic.appendGraphic(spellbook, spell);
magicGraphicDelay--;
}
if (magicDamageDelay > 0) {
magicDamageDelay--;
} else if (magicDamageDelay == 0) {
PlayerMagic playerMagic = new PlayerMagic(this);
playerMagic.appendDamage(spellbook, spell);
magicDamageDelay--;
}
if (magicAffectDelay > 0) {
magicAffectDelay--;
} else if (magicAffectDelay == 0) {
PlayerMagic playerMagic = new PlayerMagic(this);
playerMagic.appendAffect(spellbook, spell);
magicAffectDelay--;
}
if (cuedSpells > 0 && combatDelay == 0) {
try {
Player opp = Server.engine.players[magicOppIndex];
PlayerMagic playerMagic = new PlayerMagic(this);
playerMagic.combatMagic(opp, spellbook, cuedSpell);
cuedSpells = 0;
} catch (Exception e) {
}
}

if (usingPrayer()) {
drainCount += prayerDrain();
if (!isDead) {
if (drainCount >= 1) {
skillLvl[5]--;
getActionSender().setSkillLvl(this, 5);
drainCount--;
}
}
if (skillLvl[5] <= 0) {
skillLvl[5] = 0;
getActionSender().addSoundEffect(this, 2672, 1, 0, 0);
getActionSender().setSkillLvl(this, 5);
getActionSender().sendMessage(this, "You have run out of Prayer points; you must recharge at an altar.");
resetPrayer();
}
}

getDuelClass().process();
if(disconnected[0] && (usedLogout | attackedBy == null))
{
try
{
if (heightLevel != 0) heightLevel = 0;
Engine.fileManager.saveCharacter(this);
familiarDissMiss = true;
hasFamiliar = false;
summonedFamiliar = false;
} catch (Exception e) {
}
if (pTrade.getPartner() != null) {
pTrade.declineTrade();
}
disconnected[1] = true;
}
/**
* Warrior Guild
*/
if (!enteredDefenceRoom) {
if (absX == 2842 && absY == 3545 && heightLevel == 1)
getWarriorClass().addWarriorDefenceEvent();
enteredDefenceRoom = false;
}
if (thievingArray[0] > 0)
thievingArray[0]--;
if (thievingArray[0] == 0) {
PlayerThieving thievClass = new PlayerThieving(this);
thievClass.addStallThievingEvent();
}
if (thievingArray[3] > 0)
thievingArray[3]--;
if (nextGraphicDelay > 0)
nextGraphicDelay--;
if (nextGraphicDelay == 0) {
PlayerCombat playerAttacking = new PlayerCombat(this);
playerAttacking.addNextAttack();
}
if (nextDamageDelay > 0)
nextDamageDelay--;
if (nextDamageDelay == 0) {
PlayerCombat playerAttacking = new PlayerCombat(this);
playerAttacking.addNextDamage();
}
if (fletchDelay > 0)
fletchDelay--;

if (fletchDelay == 0 && isFletching)
getFletchingClass().appendFletchingEngine();

if (summonTeleDelay > 0) {
summonTeleDelay--;
}
if (summonTeleDelay == 0) {
setCoords(3069, 10257, 0);
summonTeleDelay = -1;
requestAnim(715, 0);
}
if (summonDrainDelay > 0) {
summonDrainDelay--;
}
if (summonDrainDelay == 0) {
if (skillLvl[23] > 0) {
skillLvl[23]--;
getActionSender().setSkillLvl(this, 23);
summonDrainDelay = 14;
} else {
familiarDissMiss = true;
summonedFamiliar = false;
summonDrainDelay = -1;
getActionSender().sendMessage(this, "You ran out of Summoning skill points, Please restore them.");
}
}
if (deathEmoteDelay > 0) {
deathEmoteDelay--;
}
if (deathEmoteDelay == 0) {
requestAnim(2261, 0); //10977, 836, 9055
if (usingPrayer(22)) {
requestGFX(437, 0);
if (multiwayCombatZone(absX, absY)) {
try {
for (Player player : Server.engine.players) {
if (Misc.getDistance(absX, absY, player.absX, player.absY) <= 1) {
player.append1Hit(getRandom((int)Math.floor(getLev elForXP(5) * 0.25)), 0);
}
}
} catch (Exception e) {
}
} else {
try {
Server.engine.players[hitIndex].append1Hit(getRandom((int)Math.floor(getLevelForX P(5) * 0.25)), 0);
} catch (Exception e) {
}
}
}

isDead = true;
deathDelay = 4;
deathEmoteDelay = -1;
}
if (massYellDelay > 0) {
massYellDelay--;
}
if (clickDelay > 0) {
clickDelay--;
}
if (teleDelay > 0) {
teleDelay--;
}
if (equipSpecDelay > 0) {
equipSpecDelay--;
}
if (waveDelay > 0) {
waveDelay--;
}
if (waveDelay == 0) {
fCave.fightSystem();
}
if (countDelay > 0) {
countDelay--;
}
if (countDelay == 0) {
if (countType >= 0) {
if (countType == 3) {
requestForceChat("3");
} else if (countType == 2) {
requestForceChat("2");
} else if (countType == 1) {
requestForceChat("1");
} else if (countType == 0) {
requestForceChat("FIGHT!");
}
countType--;
countDelay = 3;
} else {
countType = -1;
countDelay = -1;
}
}
if (explodeDelay > 0) {
explodeDelay--;
}
if (explodeDelay == 0) {
appendPotion();
}
if (rangeDmgDelay > 0) {
rangeDmgDelay--;
}
if (rangeDmgDelay == 0) {
PlayerCombat PC2 = new PlayerCombat(this);
PC2.appendRangeDamage();
}
if (rangeDmgDelay2 > 0) {
rangeDmgDelay2--;
}
if (rangeDmgDelay2 == 0) {
PlayerCombat PC2 = new PlayerCombat(this);
PC2.appendRangeDamage();
}
if (damageSpecDelay > 0) {
damageSpecDelay--;
}
if (damageSpecDelay == 0 && enableSpecDamage) {
PlayerCombat playCb2 = new PlayerCombat(this);
playCb2.appendNpcDamageMeleeSpec();
}
if (damageDelay1 > 0) {
damageDelay1--;
}
if (damageDelay1 == 0 && enableDamage) {
PlayerCombat playerCb = new PlayerCombat(this);
playerCb.appendNpcDamageMelee();
}
if (atkDelay > 0) {
atkDelay--;
}
if (atkDelay == 0 && attackingNpc) {
PlayerCombat playCb = new PlayerCombat(this);
playCb.attackNpc();
}
if (buryDelay > 0) {
buryDelay--;
}
if (battleCDelay > 0) {
battleCDelay--;
}
if (battleCDelay == 0) {
battleCount = 0;
battleCDelay = -1;
}
if (pickPocketDelay > 0) {
pickPocketDelay--;
}
if (skullVanishDelay > 0) {
skullVanishDelay--;
}
if (skullVanishDelay == 0 && isSkulled && (InBounty == 0)) {
headIconSkull = -1;
isSkulled = false;
skullVanishDelay = 0;
appearanceUpdateReq = true;
updateReq = true;
}
if (eatDelay > 0) {
eatDelay--;
}
if (drinkDelay > 0) {
drinkDelay--;
}

if (statDelay > 0) {
statDelay -= usingPrayer(8) ? 2 : 1;
} else {
updateStats();
}
if (hpDelay > 0) {
hpDelay -= usingPrayer(9) ? 2 : 1;
} else {
restoreHP();
}

if (poisonDelay > 0) {
poisonDelay--;
}
if (isPoisoned && poisonDelay == 0) {
double intreval = (poisonHitCount / 3) - poisonIntrevals;
if (poisonHitCount == 0) {
poisonDamage = getStartingPoisonDamage(Server.engine.players[enemyIndex]);
} else if (intreval == 1) {
poisonIntrevals++;
poisonDamage -= poisonIntrevals;
}
if (poisonDamage == 0) {
isPoisoned = false;
poisonHitCount = 0;
poisonIntrevals = 0;
getActionSender().sendMessage(this, "The poison wears off.");
return;
}
appendHit(poisonDamage, 1);
poisonDelay = 100;
poisonHitCount++;
}

if (specFillDelay > 0) {
if (specAmount < 1000) {
specFillDelay--;
} else {
specFillDelay = 50;
}
} else {
if (specAmount < 1000) {
if (specAmount - 100 > 900) {
specAmount = 1000;
} else {
specAmount += 100;
}
getActionSender().setConfig2(this, 300, specAmount);
}
specFillDelay = 50;
}

if (animClickDelay > 0) {
animClickDelay--;
}
if (agilityDelay > 0) {
agilityDelay--;
}
if (agilityDelay == 0 && agilityPerforming) {
PlayerAgility pa = new PlayerAgility(this);
pa.resetPerforming();
}
if (deathDelay > 0) {
deathDelay--;
}
if (waitDeathDelay > 0) {
waitDeathDelay--;
}

//if (skillLvl[3] <= 0 && waitDeathDelay == -1 && !randomVariable) {
// waitDeathDelay = 3;
// resetAttack();
// deathEmoteDelay = 3;
// if (duelFight())
// duelDeath = true;
// randomVariable = true;
// isDead = true;
//}

if (deathDelay == 0 && isDead) {
appendDeath();
}
if (combatDelay > 0) {
combatDelay--;
}
if (attackingPlayer) {
attackPlayer();
}
if (damageDelay > 0) {
damageDelay--;
}
if (damageDelay == 0) {
PlayerCombat PC = new PlayerCombat(this);
PC.appendDamages();
}
if (mageDelay > 0) {
mageDelay--;
}
if (specDelay > 0) {
specDelay--;
}
if (specDelay == 0) {
PlayerCombat PC1 = new PlayerCombat(this);
PC1.appendSpecDamage();
}
if (secondSpecDelay > 0) {
secondSpecDelay--;
}
if (secondSpecDelay == 0) {
PlayerCombat PC1 = new PlayerCombat(this);
PC1.appendSecondSpecDamage();
}
if (delayedDamageDelay > 0) {
delayedDamageDelay--;
}
if (delayedDamageDelay == 0) {
PlayerCombat PC1 = new PlayerCombat(this);
PC1.appendDelayedDamage(delayedDamageHit);
}
if (stunned > 0) {
stunned--;
}
if (heightLoad == 0 && heightSave != heightLevel && heightSave != 0) {
setCoords(absX, absY, heightSave);
heightLoad = 1;
}
heightSave = heightLevel;
heightLoad = 1;
if (runEnergyDelay > 0) {
runEnergyDelay--;
} else {
if (runEnergy < 100) {
runEnergy++;
runEnergyUpdateReq = true;
}
runEnergyDelay = 4;
}
if (itemPickup) {
Engine.packets.pickupItem.handlePacket(this, 0, 0);
}
if (playerOption1) {
Engine.packets.playerOption1.handlePacket(this, 0, 0);
}
if (playerOption2) {
Engine.packets.playerOption2.handlePacket(this, 0, 0);
}
if (playerOption3) {
Engine.packets.playerOption3.handlePacket(this, 0, 0);
}
if (npcOption1) {
Engine.packets.npcOption1.handlePacket(this, 0, 0);
}
if (npcOption2) {
Engine.packets.npcOption2.handlePacket(this, 0, 0);
}
if (objectOption1) {
Engine.packets.objectOption1.handlePacket(this, 0, 0);
}
if (objectOption2) {
Engine.packets.objectOption2.handlePacket(this, 0, 0);
}
if (runEnergyUpdateReq) {
getActionSender().setEnergy(this);
runEnergyUpdateReq = false;
}
appendWilderness();
if (teleDelay == 0) {
teleDelay = -1;
if (teletab) {
requestAnim(teleFinishAnim, 0);
requestGFX(teleFinishGFX, teleFinishGFXHeight);
teleDelay = 2;
teleFinishAnim = playerWeapon.getStandEmote(equipment[3]);
teleFinishGFX = -1;
} else {
setCoords(teleX, teleY, teleH);
if (teleFinishAnim != -1) {
requestAnim(teleFinishAnim, 0);
}
if (teleFinishGFX != -1) {
requestGFX(teleFinishGFX, teleFinishGFXHeight);
}
}
if (!teletab) {
teleX = teleY = -1;
}
teletab = false;
}
if (clickDelay == 0) {
clickDelay = -1;
}
}

public void potion(int potionID) {
int root = 0;
int toAdd = 0;
int i = 0;
switch (potionID) {
case 2438:
case 151:
case 153:
case 155:

root = getLevelForXP(0);
toAdd = 0 + (int)Math.round(root * 0.25252525);
if ((skillLvl[0] + toAdd) > root + toAdd) {

skillLvl[0] = root + toAdd;

} else {
skillLvl[0] += toAdd;
}
getActionSender().setSkillLvl(this, 0);
root = getLevelForXP(1);
toAdd = 1 + (int)Math.round(root * 0.25252525);
if ((skillLvl[1] + toAdd) > root + toAdd) {

skillLvl[1] = root + toAdd;

} else {
skillLvl[1] += toAdd;
}
getActionSender().setSkillLvl(this, 1);
root = getLevelForXP(2);
toAdd = 2 + (int)Math.round(root * 0.25252525);
if ((skillLvl[0] + toAdd) > root + toAdd) {

skillLvl[2] = root + toAdd;

} else {
skillLvl[2] += toAdd;
}
getActionSender().setSkillLvl(this, 2);
root = getLevelForXP(4);
toAdd = 4 + (int)Math.round(root * 0.19191919);
if ((skillLvl[0] + toAdd) > root + toAdd) {

skillLvl[4] = root + toAdd;

} else {
skillLvl[4] += toAdd;
}
getActionSender().setSkillLvl(this, 4);
root = getLevelForXP(6);
toAdd = 6 + (int)Math.round(root * 0.25252525);
if ((skillLvl[6] + toAdd) > root + toAdd) {

skillLvl[0] = root + toAdd;

} else {
skillLvl[6] += toAdd;
}
getActionSender().setSkillLvl(this, 6);
break;

case 14229:
case 14231:
case 14233:
case 14235:
root = getLevelForXP(0);
toAdd = 5 + (int)Math.round(root * 0.21);
if ((skillLvl[0] + toAdd) > (root + toAdd)) {
skillLvl[0] = root + toAdd;
} else {
skillLvl[0] += toAdd;
}
getActionSender().setSkillLvl(this, 0);
break;

case 14239:
case 14241:
case 14243:
case 14245:
root = getLevelForXP(2);
toAdd = 5 + (int)Math.round(root * 0.21);
if ((skillLvl[2] + toAdd) > (root + toAdd)) {
skillLvl[2] = root + toAdd;
} else {
skillLvl[2] += toAdd;
}
getActionSender().setSkillLvl(this, 2);
break;

case 14259:
case 14261:
case 14263:
case 14265:
root = getLevelForXP(1);
toAdd = 5 + (int)Math.round(root * 0.21);
if ((skillLvl[1] + toAdd) > (root + toAdd)) {
skillLvl[1] = root + toAdd;
} else {
skillLvl[1] += toAdd;
}
getActionSender().setSkillLvl(this, 1);
break;

case 14249:
case 14251:
case 14253:
case 14255:
root = getLevelForXP(4);
toAdd = 5 + (int)Math.round(root * 0.21);
if ((skillLvl[4] + toAdd) > (root + toAdd)) {
skillLvl[4] = root + toAdd;
} else {
skillLvl[4] += toAdd;
}
getActionSender().setSkillLvl(this, 4);
break;

case 14269:
case 14271:
case 14273:
case 14275:
root = getLevelForXP(6);
toAdd = 5 + (int)Math.round(root * 0.21);
if ((skillLvl[0] + toAdd) > (root + toAdd)) {
skillLvl[6] = root + toAdd;
} else {
skillLvl[6] += toAdd;
}
getActionSender().setSkillLvl(this, 6);
break;

case 2436:
case 145:
case 147:
case 149:
root = getLevelForXP(0);
toAdd = 5 + (int)Math.round(root * 0.1414141414);
if ((skillLvl[0] + toAdd) > (root + toAdd)) {
skillLvl[0] = root + toAdd;
} else {
skillLvl[0] += toAdd;
}
getActionSender().setSkillLvl(this, 0);
break;

case 2440:
case 157:
case 159:
case 161:
root = getLevelForXP(2);
toAdd = 5 + (int)Math.round(root * 0.1414141414);
if ((skillLvl[2] + toAdd) > (root + toAdd)) {
skillLvl[2] = root + toAdd;
} else {
skillLvl[2] += toAdd;
}
getActionSender().setSkillLvl(this, 2);
break;

case 2442:
case 163:
case 165:
case 167:
root = getLevelForXP(1);
toAdd = 5 + (int)Math.round(root * 0.1414141414);
if ((skillLvl[1] + toAdd) > (root + toAdd)) {
skillLvl[1] = root + toAdd;
} else {
skillLvl[1] += toAdd;
}
getActionSender().setSkillLvl(this, 1);
break;

case 2444:
case 169:
case 171:
case 173:
root = getLevelForXP(4);
toAdd = 4 + (int)Math.round(root * 0.0909090909);
if ((skillLvl[4] + toAdd) > (root + toAdd)) {
skillLvl[4] = root + toAdd;
} else {
skillLvl[4] += toAdd;
}
getActionSender().setSkillLvl(this, 4);
break;

case 3040:
case 3042:
case 3044:
case 3046:
if (skillLvl[6] + 4 > getLevelForXP(6) + 4) {
skillLvl[6] = getLevelForXP(6) + 4;
} else {
skillLvl[6] += 4;
}
getActionSender().setSkillLvl(this, 6);
break;

case 2428:
case 121:
case 123:
case 125:
root = getLevelForXP(0);
toAdd = 3 + (int)Math.round(root * 0.0909090909);
if ((skillLvl[0] + toAdd) > (root + toAdd)) {
skillLvl[0] = root + toAdd;
} else {
skillLvl[0] += toAdd;
}
getActionSender().setSkillLvl(this, 0);
break;

case 113:
case 115:
case 117:
case 119:
root = getLevelForXP(2);
toAdd = 3 + (int)Math.round(root *
0.0909090909);
if ((skillLvl[2] + toAdd) > (root + toAdd)) {
skillLvl[2] = root + toAdd;
} else {
skillLvl[2] += toAdd;
}
getActionSender().setSkillLvl(this, 2);
break;

case 2432:
case 133:
case 135:
case 137:
root = getLevelForXP(1);
toAdd = 3 + (int)Math.round(root * 0.0909090909);
if ((skillLvl[1] + toAdd) > (root + toAdd)) {
skillLvl[1] = root + toAdd;
} else {
skillLvl[1] += toAdd;
}
getActionSender().setSkillLvl(this, 1);
break;

case 2434:
case 139:
case 141:
case 143:
root = getLevelForXP(5);
toAdd = 7 + (int)Math.round(root * 0.2424242424);
if ((skillLvl[5] + toAdd) > root) {
if (skillLvl[5] < root) {
skillLvl[5] = root;
}
} else {
skillLvl[5] += toAdd;
}
getActionSender().setSkillLvl(this, 5);
break;

case 2430:
case 127:
case 129:
case 131:
while (i <= 6) {
if (i == 3 || i == 5) {
i++;
}
root = getLevelForXP(i);
toAdd = 10 + (int)Math.round(root * 0.2929292929);
if ((skillLvl[i] + toAdd) > root) {
if (skillLvl[i] < root) {
skillLvl[i] = root;
}
} else {
skillLvl[i] += toAdd;
}
getActionSender().setSkillLvl(this, i);
i++;
}
break;

case 3024:
case 3026:
case 3028:
case 3030:
while (i <= 23) {
if (i == 3) {
i++;
}
root = getLevelForXP(i);
toAdd = 8 + (int)Math.round(root * 0.2424242424);
if ((skillLvl[i] + toAdd) > root) {
if (skillLvl[i] < root) {
skillLvl[i] = root;
}
} else {
skillLvl[i] += toAdd;
}
getActionSender().setSkillLvl(this, i);
i++;
}
break;

case 6685:
case 6687:
case 6689:
case 6691:
while (i <= 6) {
if (i == 5) {
i++;
}
root = getLevelForXP(i);
if (i == 0 || i == 2 || i == 4 || i == 6) {
toAdd = -1 * (2 + (int)Math.round(root * 0.0707070707));
if ((skillLvl[i] + toAdd) < 0) {
skillLvl[i] = 0;
} else {
skillLvl[i] += toAdd;
}
} else {
toAdd = 2 + (int)Math.round(root * (i == 1 ? 0.1919191919 : 0.1414141414));
if (skillLvl[i] + toAdd > root + toAdd) {
skillLvl[i] = root + toAdd;
} else {
skillLvl[i] += toAdd;
}
}
getActionSender().setSkillLvl(this, i);
i++;
}
break;

case 2450:
case 189:
case 191:
case 193:
while (i <= 5) {
if (i == 4) {
i++;
}
root = getLevelForXP(i);
if (i == 5) {
toAdd = 9;
if (skillLvl[i] + toAdd > root) {
if (skillLvl[i] < root) {
skillLvl[i] = root;
}
} else {
skillLvl[i] += toAdd;
}
break;
}
if (i == 1 || i == 3) {
toAdd = -1 * (2 + (int)Math.round(root * 0.0909090909));
if (i == 3) {
append1Hit(-1 * toAdd, 0);
} else {
if ((skillLvl[i] + toAdd) < 0) {
skillLvl[i] = 0;
} else {
skillLvl[i] += toAdd;
}
}
} else {
toAdd = 2 + (int)Math.round(root * (i == 0 ? 0.1919191919 : 0.1111111111));
if (skillLvl[i] + toAdd > root + toAdd) {
skillLvl[i] = root + toAdd;
} else {
skillLvl[i] += toAdd;
}
}
getActionSender().setSkillLvl(this, i);
i++;
}
break;
}
requestAnim(829, 0);
getActionSender().addSoundEffect(this, 2401, 1, 0, 0);
combatDelay = 6;
eatDelay = 3;
drinkDelay = 3;
}

public void food(int foodID) {
int healAmount = 0;
int toDelayCombat = 6;
int toDelayEat = 3;
switch (foodID) {
case 10476:
healAmount = 1 + Misc.random(6);
runEnergy += runEnergy * .10;
runEnergyUpdateReq = true;
if (runEnergy + (runEnergy * .10) > 100) {
runEnergy = 100;
}
break;
case 3008:
case 3010:
case 3012:
case 3014:
runEnergy += runEnergy * .10;
runEnergyUpdateReq = true;
if (runEnergy + (runEnergy * .10) > 100) {
runEnergy = 100;
}
break;
case 3016:
case 3018:
case 3020:
case 3022:
runEnergy += runEnergy * .15;
runEnergyUpdateReq = true;
if (runEnergy + (runEnergy * .15) > 100) {
runEnergy = 100;
}
break;
case 373: healAmount = 14; break;
case 379: healAmount = 12; break;
case 385: healAmount = 20; break;
case 391: healAmount = 22; break;
case 3144:
healAmount = 18;
toDelayCombat = combatDelay;
drinkDelay = 3;
break;
case 7060: healAmount = 22; break;
case 7946: healAmount = 16; break;

}
requestAnim(829, 0);
getActionSender().addSoundEffect(this, 2393, 1, 0, 0);
updateHP(healAmount, true);
getActionSender().sendMessage(this, "You eat the "+Engine.items.getItemName(foodID)+".");
combatDelay = toDelayCombat;
eatDelay = toDelayEat;
}

public String lastKilled = "";
public boolean receivesPVPDrop(Player p, Player opp) {
if (Server.socketListener.getAddress(p.socket.socket) .equals(Server.socketListener.getAddress(opp.socke t.socket))) {
return false;
}
return true;
}

public void appendDeath() {
if (deathDelay == 0 && isDead) {
Player opp = Server.engine.players[hitIndex];

try {
if (rights < 4) {
dropStuff(opp.username);
}
getActionSender().sendMessage(opp, getKillMessage(username));
if (receivesPVPDrop(this, opp)) {
opp.kills++;
opp.totalKills++;

DC++;
opp.KC++;
}
if (InBounty == 0) {
getActionSender().sendMessage(opp, getKillMessage(username));
}
if(InBounty == 1) {
int i = heightLevel;
if(opp != null) {
if (opp.playerId == bhTarget || (playerId == opp.bhTarget)) {
opp.getActionSender().setInterfaceConfig(opp, 653, 9, false);
getActionSender().sendMessage(opp, "You killed "+username+". They were your target, so your Hunter PvP rating increases!");
leftBhTimer = 120;
this.InBounty = 0;
//opp.bhTarget = Engine.BountyHunter.getTargetHigh(opp);
Engine.BountyHunter.removeHigh(this);
Engine.BountyHunter.exit(this, 3);
Engine.BountyHunter.exit(this, 2);
Engine.BountyHunter.exit(this, 1);
}

if(InBounty == 1) {
if(opp != null) {
if (opp.playerId != bhTarget || (playerId != opp.bhTarget)) {
opp.bhLeave = 180;
opp.getActionSender().setInterfaceConfig(opp, 653, 9, false);
getActionSender().sendMessage(opp, "You killed "+username+". They were not your target, so your Rougue PvP rating increases!");
getActionSender().sendMessage(opp, "This means that you got the pickup penalty, pick up anything and you cant leave!");
leftBhTimer = 120;
this.InBounty = 0;
this.bhLeave = 0;
this.bhPickup = 0;
Engine.BountyHunter.removeHigh(this);
Engine.BountyHunter.exit(this, 3);
Engine.BountyHunter.exit(this, 2);
Engine.BountyHunter.exit(this, 1);
}
} else {
//opp.bhTarget = Engine.BountyHunter.getTargetHigh(this);
}
Player p3 = Engine.players[opp.bhTarget];
if(p3 != null) {
opp.getActionSender().setString(opp, "" + p3.username , 653, 8);
} else {
opp.getActionSender().setString(opp, "None" , 653, 8);
}
}
getActionSender().removeOverlay(this);
headIconSkull = -1;
appearanceUpdateReq = updateReq = true;
if(i == 0) {
Engine.BountyHunter.removeLow(this);
} else if(i == 0) {
Engine.BountyHunter.removeMid(this);
} else {
Engine.BountyHunter.removeHigh(this);
}
setCoords(3172, 3675, 0);
} else {
Engine.BountyHunter.exit(this, 3);
Engine.BountyHunter.exit(this, 2);
Engine.BountyHunter.exit(this, 1);
setCoords(3661, 3497, 0);
}
}
if (Server.socketListener.getAddress(socket.socket).e quals(opp.lastKilled)) {
Engine.fileManager.appendData("characters/logs/flagged.txt", opp.username);
}
opp.lastKilled = Server.socketListener.getAddress(socket.socket);
Engine.fileManager.appendData("characters/logs/kills/"+opp.username+".txt", username);
} catch (Exception e) {
}

for (int i = 0; i < skillLvl.length; i++) {
skillLvl[i] = getLevelForXP(i);
getActionSender().setSkillLvl(this, i);
}
for (int i = 0; i < 1000; i++) {
requestAnim(playerWeapon.getStandEmote(equipment[3]), 0);
}

if (opp != null) {
opp.attacking = null;
opp.attackedBy = null;
opp.oppIndex = 0;
opp.hitIndex = 0;
opp.resetAttack();
opp.requestFaceTo(65535);
}

attacking = null;
attackedBy = null;
oppIndex = 0;
hitIndex = 0;
resetAttack();

if (isPVP()) setCoords(3186, 3439, 4); else setCoords(3186, 3439, 0);
getActionSender().sendMessage(this, "Oh dear, you have died!");
getActionSender().removeOverlay(this);
getActionSender().removeShownInterface(this);
getActionSender().setOverlay(this, 653);
getActionSender().setInterfaceConfig(this, 653, 9, false);
getActionSender().setString(this, "None", 653, 8);
getActionSender().setString(this, "Target:", 653, 7);
getActionSender().setString(this, "Target Likelihood:", 653, 10);
getActionSender().setString(this, "0%", 653, 11);


deathDelay = -1;
isDead = false;

magicGraphicDelay = -1;
magicDamageDelay = -1;

initialAttack = false;
isSkulled = false;
headIconSkull = -1;
skullVanishDelay = 0;

isPoisoned = false;
poisonHitCount = 0;
poisonDelay = 0;
teleblocked = false;
teleblockTimer = 0;

specAmount = 1000;
getActionSender().setConfig2(this, 300, 1000);

resetPrayer();

getActionSender().removeOverlay(this);

appearanceUpdateReq = true;
updateReq = true;
}
}

public void resetAttack() {
attackingPlayer = false;
enemyIndex = 0;
oppIndex = 0;
hitOne = false;
hitTwo = false;
hitThree = false;
hitFour = false;
hit1 = 0;
hit2 = 0;
hit3 = 0;
hit4 = 0;
specDelay = -1;
secondSpecDelay = -1;
}

/**
* Get xp based on your level.
* @param skillId The skill level to get the level based off XP for.
* @return Returns the level based on the amount of XP the specified skill has.
*/
public int getLevelForXP(int skillId) {
int exp = skillXP[skillId];
int points = 0;
int output = 0;
for (int lvl = 1; lvl < 100; lvl++) {
points += Math.floor((double)lvl + 300.0 * Math.pow(2.0, (double)lvl / 7.0));
output = (int)Math.floor(points / 4);
if ((output - 1) >= exp) {
return lvl;
}
}
return 99;
}

/**
* Calculates equipment bonus.
*/
public void calculateEquipmentBonus() {
for (int i = 0; i < equipmentBonus.length; i++) {
equipmentBonus[i] = 0;
}
for (int i = 0; i < equipment.length; i++) {
if (equipment[i] > -1) {
for (int j = 0; j < Engine.items.maxListedItems; j++) {
if (Engine.items.itemLists[j] != null) {
if (Engine.items.itemLists[j].itemId == equipment[i]) {
for (int k = 0; k < equipmentBonus.length; k++) {
equipmentBonus[k] += Engine.items.itemLists[j].bonuses[k];
}
break;
}
}
}
}
}
}

/**
* Writes the equipment bonus.
*/
public void setEquipmentBonus() {
String[] bonusNames = Misc.bonusNames;
int id = 35;
for (int i = 0; i < equipmentBonus.length; i++) {
getActionSender().setString(this, bonusNames[i] + ": " + (equipmentBonus[i] >= 0 ? "+" : "") + equipmentBonus[i], 667, id++);
if (id == 45) {
id = 47;
}
}
getActionSender().setString(this, "Summoning: +0", 667, 45);
}

public void openBank() {
getActionSender().setConfig2(this, 563, 4194304);
getActionSender().setConfig2(this, 1248, -2013265920);
getActionSender().showInterface(this, 762);
getActionSender().setInventory(this, 763);
getActionSender().setBankOptions(this);
getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
isBanking = true;
}

public void updateHP(int difference, boolean heal) {
if (skillLvl[3] == 0) {
return;
}
if (heal) {
skillLvl[3] += difference;
if (skillLvl[3] > getLevelForXP(3)) {
skillLvl[3] = getLevelForXP(3);
}
} else if (!heal) {
skillLvl[3] -= difference;
if (skillLvl[3] <= 0) {
skillLvl[3] = 0;
deathEmoteDelay = 3;
isDead = true;
attacking = null;
attackedBy = null;
Engine.playerMovement.resetWalkingQueue(this);
requestFaceTo(65535);
}
}
getActionSender().setSkillLvl(this, 3);
if ((skillLvl[3] <= Math.round(getLevelForXP(3) * 0.10) && skillLvl[3] > 0) && usingPrayer(23)) {
requestGFX(436, 0);
getActionSender().addSoundEffect(this, 2681, 1, 0, 0);
skillLvl[3] += Math.round(getLevelForXP(5) * 0.25);
skillLvl[5] = 0;
getActionSender().setSkillLvl(this, 5);
}
}

/**
* Teleports a player.
* @param x The x coordinate to teleport to.
* @param y The y coordinate to teleport to.
* @param height The height level to teleport to.
* @param delay The delay before the teleport is done.
* @param distance The offset you can teleport to, such as 1 for a max offset of x +/- 1 and y +/- 1.
* @param emoteStart The emote to do right away.
* @param emoteEnd The emote to do after teleporting.
* @param gfxStart The graphic to do right away.
* @param gfxStartH The height level to create the start graphic at.
* @param gfxEnd The graphic to do after the teleport is done.
* @param gfxEndH The finish graphic height.
*/
public void teleportTo(int x, int y, int height, int delay, int distance, int emoteStart, int emoteEnd, int gfxStart,
int gfxStartH, int gfxEnd, int gfxEndH) {
if (teleblocked) {
getActionSender().sendMessage(this, "You are teleport blocked!");
return;
}
if (getWildernessLevel() >= 21 && !lever && !gwd() && !guthanhillArea() && !karilhillArea() && !dharokhillArea() && !ahrimhillArea() && !toraghillArea() && !verachillArea() && !bh1() && !magebank() && !corp()) {
getActionSender().sendMessage(this, "A magical force stops you from teleporting.");
return;
}
itemPickup = false;
playerOption1 = false;
playerOption2 = false;
playerOption3 = false;
npcOption1 = false;
npcOption2 = false;
objectOption1 = false;
objectOption2 = false;
attackingPlayer = false;
clickDelay = delay + 2;
teleDelay = delay;
if (distance > 0) {
int xType = Misc.random(1);
int yType = Misc.random(1);
int xOffset = Misc.random(distance);
int yOffset = Misc.random(distance);
if (xType == 1)
x += -xOffset;
else
x += xOffset;
if(yType == 1)
y += -yOffset;
else
y += yOffset;
}
teleX = x;
teleY = y;
teleH = height;
Engine.playerMovement.resetWalkingQueue(this);
requestAnim(emoteStart, 0);
requestGFX(gfxStart, gfxStartH);
teleFinishGFX = gfxEnd;
teleFinishGFXHeight = gfxEndH;
teleFinishAnim = emoteEnd;
}

/**
* Set the player's coordinates.
* @param x The x coordinate to teleport to.
* @param y The y coordinate to teleport to.
*/
public void setCoords(int x, int y, int height) {
teleportToX = x;
teleportToY = y;
heightLevel = height;
didTeleport = true;
}

/**
* Req an animation for this player.
* @param animId The amination to perform.
* @param animD The delay before doing the animation.
*/
public void requestAnim(int animId, int animD) {
animReq = animId;
animDelay = animD;
animUpdateReq = true;
updateReq = true;
}

/**
* Req an graphic for this player.
* @param gfxId The graphic to perform.
* @param gfxD The delay or height or the gfx depending on the value.
*/
public void requestGFX(int gfxId, int gfxD) {
if (gfxD >= 100) {
gfxD += 6553500;
}
gfxReq = gfxId;
gfxDelay = gfxD;
gfxUpdateReq = true;
updateReq = true;
}

/**
* Req this player faces NPC or player.
* @param faceId The target to face.
*/
public void requestFaceTo(int faceId) {
faceToReq = faceId;
faceToUpdateReq = true;
updateReq = true;
}

int poisonDamage;
int poisonIntrevals = 0;
public int getStartingPoisonDamage(Player p2) {
String name = "";
int damage = 0;
boolean usingRange = false;
if ((p2.equipment[3] >= 839 && p2.equipment[3] <= 861) || (p2.equipment[3] >= 9174 && p2.equipment[3] <= 9185) || p2.equipment[3] == 11235) { //Ranged
name = Engine.items.getItemName(equipment[13]);
usingRange = true;
} else { //Melee
name = Engine.items.getItemName(p2.equipment[3]);
}
if (name.contains("(p++)")) {
damage = usingRange ? 4 : 6;
}
if (name.contains("(p+)")) {
damage = usingRange ? 3 : 5;
}
if (name.contains("(p)")) {
damage = usingRange ? 2 : 4;
}
return damage;
}

public int totalDamageRecoiled;

public void appendNPCHit(int damage, int poison) {
if (damage > skillLvl[3]) {
damage = skillLvl[3];
}
updateHP(damage, false);
if (!hit1UpdateReq) {
hitDiff1 = damage;
poisonHit1 = poison;
hit1UpdateReq = true;
} else {
hitDiff2 = damage;
poisonHit2 = poison;
hit2UpdateReq = true;
}
updateReq = true;
}

public void appendHit(int damage, int poison) {
Player opp = Server.engine.players[hitIndex];
if (opp != null) {
if (opp.isDead) {
return;
}
if (damage > skillLvl[3]) {
damage = skillLvl[3];
}
updateHP(damage, false);
if (autoRetaliate) {
enemyIndex = hitIndex;
attackingPlayer = true;
}
int[] skill = {-1, -1, -1};
if (!usingMage) {
switch (opp.attackStyle()) {
case 1:
skill[0] = 0;
skill[1] = 0;
skill[2] = 0;
break;
case 2:
skill[0] = 2;
skill[1] = 2;
skill[2] = 2;
break;
case 3:
skill[0] = 1;
skill[1] = 1;
skill[2] = 1;
break;
case 4:
skill[0] = 0;
skill[1] = 1;
skill[2] = 2;
break;
case 5:
case 6:
skill[0] = 4;
skill[1] = 4;
skill[2] = 4;
break;
case 7:
opp.appendExperience((damage * 200), 4);
opp.appendExperience((damage * 200), 1);
opp.appendExperience((damage * 500), 3);
break;
}
for (int i : skill) {
if (i != -1) {
opp.appendExperience((damage * 500), i);
}
}
opp.appendExperience((damage
* 500), 3);
}
if (opp.usingPrayer(24)) { //soulsplit effect
int toHitpoints = (int)Math.floor(damage / 5);
int toPrayer = (int)Math.floor(damage / 5);
int casterX = opp.absX;
int casterY = opp.absY;
int offsetX = (opp.playerId) * playerId;
int offsetY = (opp.playerId) * playerId;
if (opp.skillLvl[3] + toHitpoints > opp.getLevelForXP(3))
toHitpoints = opp.getLevelForXP(3) - opp.skillLvl[3];
opp.getActionSender().slopedProjectile(opp, casterY, casterX, offsetY, offsetX, 50, 0, 384, 46, 31, opp.playerId, 1);
getActionSender().slopedProjectile(opp, casterY, casterX, offsetY, offsetX, 50, 0, 384, 46, 31, playerId, 1);
opp.requestAnim(14, 0);
requestGFX(1314, 0);
if (skillLvl[3] - damage <= 0) {
if ((int)Math.floor(damage / 4) + opp.skillLvl[3] <= opp.getLevelForXP(3))
toHitpoints = (int)Math.floor(damage / 4);
else
toHitpoints = opp.getLevelForXP(3) - opp.skillLvl[3];
}
opp.getActionSender().slopedProjectile(opp, casterY, casterX, offsetY, offsetX, 50, 0, 384, 46, 31, opp.playerId, 1);
getActionSender().slopedProjectile(opp, casterY, casterX, offsetY, offsetX, 50, 0, 384, 46, 31, playerId, 1);
opp.requestAnim(14, 0);
requestGFX(1314, 0);
opp.skillLvl[3] += toHitpoints;
opp.getActionSender().setSkillLvl(this, 3);
if (skillLvl[5] - toPrayer < 0)
toPrayer = getLevelForXP(5) - skillLvl[5];
skillLvl[5] -= toPrayer;
getActionSender().setSkillLvl(this, 5);
opp.getActionSender().slopedProjectile(opp, casterY, casterX, offsetY, offsetX, 50, 0, 384, 46, 31, opp.playerId, 1);
getActionSender().slopedProjectile(opp, casterY, casterX, offsetY, offsetX, 50, 0, 384, 46, 31, playerId, 1);
}
if (opp.equipment[5] == 13742) {//Elysian Effect
if ((Misc.random(4) == 2 || Misc.random(4) == 3 || Misc.random(4) == 4 || Misc.random(4) == 0)) {
double damages = damage;
double damageDeduction = ((double)damages)/((double)4);
damage = damage-((int)Math.round(damageDeduction));
}
}
if (opp.equipment[5] == 13740) {//Divine Effect
double damages2 = damage;
double prayer = opp.skillLvl[5];
double possibleDamageDeduction = ((double)damages2)/((double)3.33);//30% of Damage Inflicted
double actualDamageDeduction;
if ((prayer * 2) < possibleDamageDeduction) {
actualDamageDeduction = (prayer * 2);//Partial Effect(Not enough prayer points)
} else {
actualDamageDeduction = possibleDamageDeduction;//Full effect
}
double prayerDeduction = ((double)actualDamageDeduction)/((double)2);//Half of the damage deducted
damage = damage-((int)Math.round(actualDamageDeduction));
opp.skillLvl[5] = opp.skillLvl[5]-((int)Math.round(prayerDeduction));
opp.getActionSender().setSkillLvl(opp, 5);
}
if (vengeance && poison == 0) { //Vengeance
if (damage > 0) {
if (skillLvl[3] > 0) {
opp.append1Hit(((int)Math.floor(damage * 0.75)), 0);
} else {
opp.append1Hit(0, 0);
}
requestForceChat("Taste vengeance!");
vengeance = false;
}
}
if (equipment[12] == 2550 && poison == 0) { //Ring of recoil
if (damage > 0) {
if (skillLvl[3] > 0) {
int recoil = 1 + ((int)Math.floor(damage * 0.10));
opp.append1Hit(recoil, 0);
totalDamageRecoiled += recoil;
if (totalDamageRecoiled >= 40) {
equipment[12] = -1;
equipmentN[12] = 0;
getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
getActionSender().sendMessage(this, "Your ring of recoil has shattered.");
totalDamageRecoiled = 0;
}
} else {
opp.append1Hit(0, 0);
}
}
}
if (opp.barrowsSet(3) && poison == 0) { //Guthans affect
if (Math.random() <= 0.25) {
opp.updateHP(damage, true);
requestGFX(398, 0);
}
}
if (!hit1UpdateReq) {
hitDiff1 = damage;
poisonHit1 = poison;
hit1UpdateReq = true;
} else {
hitDiff2 = damage;
poisonHit2 = poison;
hit2UpdateReq = true;
}
updateReq = true;
}
}

/**
* Append damage.
*/
public void append1Hit(int damage, int poison) {
if (damage > skillLvl[3]) {
damage = skillLvl[3];
}
updateHP(damage, false);
if (!hit1UpdateReq) {
hitDiff1 = damage;
poisonHit1 = poison;
hit1UpdateReq = true;
} else {
hitDiff2 = damage;
poisonHit2 = poison;
hit2UpdateReq = true;
}
updateReq = true;
}

/**
* Block anims.
*/
public int getBlockAnim() {
if (equipment[3] == 4031) {
return 221;
}
if (equipment[5] == 8850) {
return 4177;
}
return 1156;
}

/**
* Block anims.
*/
public int getBlockAnim1() {
if (equipment[3] == 4031) {
return 221;
}
if (equipment[3] == 4151) {
return 1659;
}
if (equipment[3] == 4718 ||
equipment[3] == -1) {
return 424;
}
if (equipment[3] == 4755) {
return 2063;
}
if (equipment[3] == 10887) {
return 5866;
}
if (equipment[3] == 4153) {
return 1666;
}
if (equipment[3] == 11694 ||
equipment[3] == 11696 ||
equipment[3] == 11698 ||
equipment[3] == 11700 ||
equipment[3] == 1307 ||
equipment[3] == 1309 ||
equipment[3] == 1311 ||
equipment[3] == 1313 ||
equipment[3] == 1315 ||
equipment[3] == 1317 ||
equipment[3] == 1319 ||
equipment[3] == 7158 ||
equipment[3] == 11730) {
return 7050;
}
if (equipment[3] == 3204) {
return 420;
}
if (equipment[3] == 12845) {
return 8999;
}
return 404;
}

/**
* Force chat text.
*/
public void requestForceChat(String s) {
forceChat = s;
forceChatUpdateReq = true;
updateReq = true;
}
public boolean quickChat;
public void requestForceChat2(String s) {
quickChat = true;
chatTextUpdateReq = true;
chatText = s;
updateReq = true;
}

public int getArmourDef() {
switch (equipment[4]) {

case 1127: return 80;
case 4712: return 120;
case 4757: return 140;
case 4720: return 140;
case 3140: return 100;
case 10551: return 70;
case 11720: return 215;
case 11724: return 220;
}
return 10;
}

public int getRangeArmourDef() {
switch (equipment[4]) {

case 1135: return 115;
case 2499: return 140;
case 2501: return 165;
case 2503: return 190;
case 11720: return 200;
}
return 40;
}

public int getRangeBonus() {
switch (equipment[3]) {

case 841: return 65;
case 843: return 80;
case 845: return 85;
case 847: return 90;
case 849: return 95;
case 851: return 100;
case 853: return 120;
case 855: return 130;
case 857: return 150;
case 859: return 165;
case 861: return 180;
case 9185: return 280;
case 13879: return 220;
case 13883: return 220;
case 8880: return 280;
case 11235: return 160;
}
return 60;
}

public boolean defile;

public void checkVeracs() {
if (barrowsSet(6)) {
if (Math.random() <= 0.15) {
defile = true;
}
} else {
defile = false;
}
}

public double accuracy = 1;

public double meleeAccuracy(Player opp) {
if (opp == null || this.isDead || opp.isDead || this.disconnected[0] || opp.disconnected[0]) {
return 1;
}
double attack = skillLvl[0];
double defence = opp.skillLvl[1];
int activeAttackBonus = weaponStyle(equipment[3]) - 1;
int activeDefenceBonus = activeAttackBonus + 5;
double attackBonus = equipmentBonus[activeAttackBonus];
double defenceBonus = opp.equipmentBonus[activeDefenceBonus];
if (usingPrayer(2)) {
attack *= 1.05;
}
if (usingPrayer(7)) {
attack *= 1.10;
}
if (usingPrayer(15)) {
attack *= 1.15;
}
if (usingPrayer(25)) {
attack *= 1.15;
}
if (usingPrayer(26)) {
attack *= 1.20;
}
if (attackStyle() == 4) {
attack += 1;
}
if (attackStyle() == 1) {
attack += 3;
}
if (opp.usingPrayer(0)) {
defence *= 1.05;
}
if (opp.usingPrayer(5)) {
defence *= 1.10;
}
if (opp.usingPrayer(13)) {
defence *= 1.15;
}
if (opp.usingPrayer(25)) {
defence *= 1.20;
}
if (opp.usingPrayer(26)) {
defence *= 1.25;
}
if (opp.attackStyle() == 4) {
defence += 1;
}
if (opp.attackStyle() == 3) {
defence += 3;
}
if (attackBonus < 0) {
attackBonus = 0;
}
if (defenceBonus < 0) {
defenceBonus = 0;
}
if (defile) {
defenceBonus = 0;
}
double offensiveAttribute = (attack * 1.5) + attackBonus;
double defensiveAttribute = (defence * 1.5) + defenceBonus;
double difference = Math.abs(offensiveAttribute - defensiveAttribute);
boolean positive = offensiveAttribute > defensiveAttribute;
double interval = difference * 0.0015;
double percentage = 0.55;
if (!positive) {
percentage -= interval;
}
if (positive) {
percentage += interval;
}
if (accuracy != 1) {
percentage *= accuracy;
accuracy = 1;
}
return percentage;
}

public boolean hitPlayer(Player opp) {
return Math.random() <= meleeAccuracy(opp);
}

public double rangeAccuracy(Player opp) {
if (opp == null || this.isDead || opp.isDead || this.disconnected[0] || opp.disconnected[0]) {
return 1;
}
double range = skillLvl[4];
double defence = opp.skillLvl[1];
double rangeBonus = equipmentBonus[4];
double defenceBonus = opp.equipmentBonus[9];
if (usingPrayer(3)) {
range *= 1.05;
}
if (usingPrayer(11)) {
range *= 1.10;
}
if (usingPrayer(20)) {
range *= 1.15;
}
if (attackStyle() == 5) {
range += 1;
}
if (opp.usingPrayer(0)) {
defence *= 1.05;
}
if (opp.usingPrayer(5)) {
defence *= 1.10;
}
if (opp.usingPrayer(13)) {
defence *= 1.15;
}
if (opp.usingPrayer(25)) {
defence *= 1.20;
}
if (opp.usingPrayer(26)) {
defence *= 1.25;
}
if (opp.attackStyle() == 4) {
defence += 1;
}
if (opp.attackStyle() == 3) {
defence += 3;
}
if (rangeBonus < 0) {
rangeBonus = 0;
}
if (defenceBonus < 0) {
defenceBonus = 0;
}
double offensiveAttribute = range + rangeBonus;
double defensiveAttribute = defence + defenceBonus;
double difference = Math.abs(offensiveAttribute - defensiveAttribute);
boolean positive = offensiveAttribute > defensiveAttribute;
double interval = difference * 0.00175;
double percentage = 0.50;
if (!positive) {
percentage -= interval;
}
if (positive) {
percentage += interval;
}
if (accuracy != 1) {
percentage *= accuracy;
accuracy = 1;
}
return percentage;
}

public boolean hitPlayerRange(Player opp) {
return Math.random() <= rangeAccuracy(opp);
}

public boolean barrowsSet(int setID) {
String helmet = Engine.items.getItemName(equipment[0]);
String platebody = Engine.items.getItemName(equipment[4]);
String weapon = Engine.items.getItemName(equipment[3]);
String platelegs = Engine.items.getItemName(equipment[7]);
String set = "";
switch (setID) {
case 1: //Ahrim's
set = "Ahrim";
break;
case 2: //Dharok's
set = "Dharok";
break;
case 3: //Guthan's
set = "Guthan";
break;
case 4: //Karil's
set = "Karil";
break;
case 5: //Torag's
set = "Torag";
break;
case 6: //Verac's
set = "Verac";
break;
}
boolean hasHelmet = helmet.contains(set);
boolean hasPlatebody = platebody.contains(set);
boolean hasWeapon = weapon.contains(set);
boolean hasPlatelegs = platelegs.contains(set);
if (hasHelmet && hasPlatebody && hasWeapon && hasPlatelegs) {
return true;
}
return false;
}
public boolean voidSet(int setID) {
String helmet = Engine.items.getItemName(equipment[0]);
String set = "";
switch (setID) {
case 1: //Melee
set = "Void melee";
break;
case 2: //Range
set = "Void ranger";
break;
case 3: //Mage
set = "Void mage";
break;
}
boolean hasHelmet = helmet.contains(set);
boolean hasTop = equipment[4] == 8839;
boolean hasGloves = equipment[9] == 8842;
boolean hasBottom = equipment[7] == 8840;
if (hasHelmet && hasTop && hasGloves && hasBottom) {
return true;
}
return false;
}

public boolean hasProperArrows(int bow, int arrows) {
if (usingSpecial) {
if (weapon == 861 || weapon == 11235) {
if (equipmentN[13] <= 1) {
getActionSender().sendMessage(this, "You don't have enough ammo!");
return false;
}
}
}
if (bow >= 839 && bow <= 861) {
switch (arrows) {
case 882:
case 884:
case 886:
case 888:
case 890:
case 892: return true;
}
}
if (bow == 11235) {
switch (arrows) {
case 882:
case 884:
case 886:
case 888:
case 890:
case 892:
case 11212:
if (equipmentN[13] > 1) {
return true;
} else {
getActionSender().sendMessage(this, "You don't have enough ammo!");
return false;
}
}
}
if (bow == 13883 || bow == 13879 || bow == 4214 || bow == 868 || bow == 11230) {
return true;
}
if (bow == 9185) {
switch (arrows) {
case 9243:
case 9244: return true;
}
}
if (bow == 8880) {
if (arrows == 8882) return true;
}
if (bow == 4734) {
if (arrows == 4740) return true;
}
return false;
}

public boolean hitNpcRange() {
PlayerCombat playCb = new PlayerCombat(this);
if (getRandom(equipmentBonus[8] + getRangeBonus()) > getRandom(playCb.getNpcDefenceRange())) {
return true;
}
return false;
}

private int getRandom(int range) {
return (int)(Math.random() * (range + 1));
}

/**
* Gives experience to a player.
* @param amount The amount which will gives to the player
* @param skillId the skill Id of the player which the exp will go to.
*/
public void appendExperience(int amount, int skillId) {
if (!getExperience) {
return;
}
int oldLvl = getLevelForXP(skillId);
if (skillXP[skillId] > 200000000) {
return;
}
skillXP[skillId] += amount;
int newLvl = getLevelForXP(skillId);
if (oldLvl < newLvl) {
skillLvl[skillId] += (newLvl - oldLvl);
switch (skillId) {

case 0:
getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Attack level!");
break;

case 1:
getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Defence level!");
break;

case 2:
getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Strength level!");
break;

case 3:
getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new hitpoints level!");
break;

case 4:
getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Ranged level!");
break;

case 5:
getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Prayer level!");
break;

case 6:
getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Magic level!");
break;

case 7:
getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Cooking level!");
break;

case 8:
getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Woodcutting level!");
break;

case 16:
getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Agility level!");
break;

case 17:
getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Thieving level!");
break;

case 18:
getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Slayer level!");
break;

case 19:
getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Farming level!");
break;

case 20:
getActionSender().sendMessage(this, "Congratiolations, You have just advanced a new Runecrafting level!");
break;

default:
getActionSender().sendMessage(this, "This level is unknown, Please report this to an administrator.");
break;
}
requestGFX(1635, 0);
appearanceUpdateReq = true;
updateReq = true;
}
getActionSender().setSkillLvl(this, skillId);
}

/**
* Checks special amount and gets config.
*/
public void checkAmount() {
int amount = specAmount;
getActionSender().setConfig2(this, 300, amount);
}

/**
* Walking request.
*/
public void playerWalk(int x, int y, int emote, int delay) {
int firstX = x - (mapRegionX - 6) * 8;
int firstY = y - (mapRegionY - 6) * 8;
Engine.playerMovement.resetWalkingQueue(this);
Engine.playerMovement.addToWalkingQueue(this, firstX, firstY);
appearanceUpdateReq = true;
updateReq = true;
}

public void WalkTo(int x, int y) {
int firstX = x - (mapRegionX - 6) * 8;
int firstY = y - (mapRegionY - 6) * 8;
Engine.playerMovement.resetWalkingQueue(this);
Engine.playerMovement.addToWalkingQueue(this, firstX, firstY);
appearanceUpdateReq = true;
updateReq = true;
}

public boolean inWilderness() {
return absX >= 3136 && absX <= 3350 && absY >= 3523 && absY <= 3597;
}

/**
* Cross wilderness ditch
*/
public void crossDitch() {
int y = 3520;
if (!wildernessZone(absX, absY)) {
y = 3523;
}
playerWalk(absX, y, 6132, 0);
appearanceUpdateReq = true;
updateReq = true;
}


/**
* Boolean which returns coords ids to get safezone of bounty hunter place.
*/
public boolean pkArenaPart1() {
return absX >= 3067 && absX <= 3134 && absY >= 3650 && absY <= 3698;
}

public boolean pkArenaPart2() {
return absX >= 3135 && absX <= 3144 && absY >= 3672 && absY <= 3714;
}
public boolean pkArenaPart3() {
return absX >= 2442 && absX <= 2458 && absY >= 3535 && absY <= 3546;
}
public boolean inPkArena() {
return pkArenaPart1() && pkArenaPart3() && pkArenaPart2();
}

void updateStats() {
if (isDead) {
return;
}
int skill = 0;
while (skill <= 22) {
if (skill == 3 || skill == 5) {
skill++;
}
if (skillLvl[skill] > getLevelForXP(skill)) {
skillLvl[skill]--;
}
if (skillLvl[skill] < getLevelForXP(skill)) {
skillLvl[skill]++;
}
statDelay = 100;
getActionSender().setSkillLvl(this, skill);
skill++;
}
}
void restoreHP() {
if (isDead) {
return;
}
if (skillLvl[3] > getLevelForXP(3)) {
skillLvl[3]--;
}
if (skillLvl[3] < getLevelForXP(3)) {
skillLvl[3] += equipment[9] == 11133 ? 2 : 1;
}
hpDelay = 100;
getActionSender().setSkillLvl(this, 3);
}

/**
* Unequip and delete all items player has.
*/
public void dropAllStuff() {
if (this == null)
return;
PlayerItems pi = new PlayerItems();
for(int i = 0; i < items.length; i++)
{
if(items[i] == 6570)
break;
if(items[i] >= 0)
{
if(Engine.items.isUntradable((items[i])))
{
Engine.playerItems.deleteItem(this, items[i], pi.getItemSlot(this, items[i]), itemsN[i]);
}
else
{
Engine.playerItems.deleteItem(this, items[i], pi.getItemSlot(this, items[i]), itemsN[i]);
}
}
}
for(int i = 0; i < equipment.length; i++)
{
if(equipment[i] == 6570)
break;
if(equipment[i] >= 0)
{
getActionSender().removeEquipment(this, equipment[i], i);
if(Engine.items.isUntradable((items[0])))
{
Engine.playerItems.deleteItem(this, items[0], pi.getItemSlot(this, items[0]), itemsN[0]);

}
else
{
Engine.playerItems.deleteItem(this, items[0], pi.getItemSlot(this, items[0]), itemsN[0]);
}
}
}
combatType = 0;
}

public boolean arrayContains(int[] array, int value) {
for (int i : array) {
if (value == i) {
return true;
}
}
return false;
}

public int[] removeValueFromArray(int[] array, int value) {
int index = -1;
for (int i = 0; i < array.length; i++) {
if (value == array[i]) {
index = i;
}
}
if (index != -1) {
array[index] = 0;
}
return array;
}

public int[][] removeValueFromArray(int[][] array, int value) {
int indexI = -1;
int indexJ = -1;
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
if (value == array[i][j]) {
indexI = i;
indexJ = j;
}
}
}
if (indexI != -1 && indexJ != -1) {
array[indexI][indexJ] = -1;
}
return array;
}

void dropStuff(String opp) {
try {
int amountOfKeptItems = isSkulled ? (usingPrayer(10) ? 1 : 0) : (usingPrayer(10) ? 4 : 3);
int[] allItems = new int[items.length + equipment.length];
int[] allItemsN = new int[itemsN.length + equipmentN.length];
int[] keptItems = new int[amountOfKeptItems];
int[] toAdd = new int[keptItems.length];
System.arraycopy(items, 0, allItems, 0, items.length);
System.arraycopy(equipment, 0, allItems, items.length, equipment.length);
System.arraycopy(itemsN, 0, allItemsN, 0, itemsN.length);
System.arraycopy(equipmentN, 0, allItemsN, itemsN.length, equipmentN.length);
for (int i = 0; i < keptItems.length; i++) {
int index = 0;
int standing = 0;
for (int j = 0; j < allItems.length; j++) {
if (allItems[j] < 1) {
continue;
}
int price = Engine.items.itemLists[allItems[j]].shopValue;
if (price > standing) {
index = j;
standing = price;
}
}
keptItems[i] = allItems[index];
toAdd[i] = allItems[index];
allItemsN[index]--;
if (allItemsN[index] == 0) {
allItems[index] = 0;
}
}
for(int i = 0; i < items.length; i++) {
if(items[i] > 0) {
if (!arrayContains(keptItems, items[i])) {
if (Engine.items.isUntradable((items[i]))) {
if (items[i] != 13889) {
Engine.items.createGroundItem(items[i], itemsN[i], absX, absY, heightLevel, username);
} else {
getActionSender().sendMessage(this, "Your Vesta's longsword shatters as it hits the ground.");
degrade = 6000;
degrades = false;
}
Engine.playerItems.deleteItem(this, items[i], Engine.playerItems.getItemSlot(this, items[i]), itemsN[i]);
} else {
if (!isPVP()) {
Engine.items.createGroundItem(items[i], itemsN[i], absX, absY, heightLevel, opp);
}
}
} else {
keptItems = removeValueFromArray(keptItems, items[i]);
}
Engine.playerItems.deleteItem(this, items[i], Engine.playerItems.getItemSlot(this, items[i]), itemsN[i]);
}
}
for(int i = 0; i < equipment.length; i++) {
if (equipment[i] > 0) {
getActionSender().removeEquipment(this, equipment[i], i);
if (!arrayContains(keptItems, items[0])) {
if(Engine.items.isUntradable((items[0]))) {
if (items[0] != 13889) {
Engine.items.createGroundItem(items[0], itemsN[0], absX, absY, heightLevel, username);
} else {
getActionSender().sendMessage(this, "Your Vesta's longsword shatters as it hits the ground.");
degrade = 6000;
degrades = false;
}
Engine.playerItems.deleteItem(this, items[0], Engine.playerItems.getItemSlot(this, items[0]), itemsN[0]);
} else {
if (!isPVP()) {
Engine.items.createGroundItem(items[0], itemsN[0], absX, absY, heightLevel, opp);
}
}
} else {
keptItems = removeValueFromArray(keptItems, items[0]);
}
Engine.playerItems.deleteItem(this, items[0], Engine.playerItems.getItemSlot(this, items[0]), itemsN[0]);
}
}
for (int i : toAdd) {
if (i > 0) {
Engine.playerItems.addItem(this, i, 1);
}
}
Engine.items.createGroundItem(526, 1, absX, absY, heightLevel, opp);
int[] lostItems = allItems;
if (isPVP() && receivesPVPDrop(this, Server.engine.players[Server.engine.getIdFromName(opp)])) {
PVPDrop(opp, lostItems);
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("Null drop: "+opp);
return;
}
}

public int totalValue(int[] items) {
int totalValue = 0;
try {
int[] allItems = new int[items.length + equipment.length];
System.arraycopy(items, 0, allItems, 0, items.length);
System.arraycopy(equipment, 0, allItems, items.length, equipment.length);

for (int i : allItems) {
totalValue += getItemValue(i);
}
} catch (Exception e) {
e.printStackTrace();
return 0;
}
return totalValue;
}


void PVPDrop(String player, int[] lostItems) {
Player dropFor = Server.engine.players[Server.engine.getIdFromName(player)];
try {
if (dropFor.setDrop != 0) {
Engine.items.createGroundItem(dropFor.setDrop, 1, absX, absY, heightLevel, player);
dropFor.setDrop = 0;
}
if (Double.isInfinite(dropFor.PVPPotential) || Double.isNaN(dropFor.PVPPotential)) {
dropFor.PVPPotential = 0.0;
}
double chance = 0.00;
int randomDrops = 0;
for (int i : lostItems) {
if (Math.random() <= 0.75) {
lostItems = removeValueFromArray(lostItems, i);
} else {
if (getItemValue(i) >= 3000) {
randomDrops++;
} else if (Math.random() <= 0.35) {
randomDrops++;
}
}

}
for (int i : lostItems) {
if (i == 0 || Engine.items.isUntradable(i)) {
continue;
}
Engine.items.createGroundItem(i, 1, absX, absY, heightLevel, player);
}
int[] potentialDrops = {1145,1147,2605,2613,2619,2627,2657,2673,3385,3486 ,3749,3751,3753,3755,4716,4724,4745,4753,5574,6128 ,6131,6137,10350,10589,10606,10828,11200,11335,107 3,1079,1091,1093,1123,1127,2599,2601,2607,2609,261 5,2617,2623,2625,2653,2655,2661,2669,2671,3474,347 6,3480,3481,3483,3485,3670,3476,3674,3676,4087,458 5,4720,4722,4728,4749,4751,4759,5575,5576,6129,661 7,10346,10348,11720,11722,11724,1199,1201,2603,261 1,2621,2629,2659,2667,2675,3488,10352,11726,11728, 11730,11720,11718,11694,11696,11698,11700,14484,13 887,13893,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,11 233,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,10 456,10460,10468,10474,10786,2663,3479,4151,6762,10 384,10386,10388,10390,10440,10446,10452,10458,1046 4,10470,10784,6760,10376,10378,10380,10382,10442,1 0448,1454,10462,10466,10472,9672,9674,9676,9678,31 22,4153,6809,10564,10330,10332,10334,10336,10338,1 0340,10342,10344,6731,6733,6735,6737,9185,8880,170 4,1706,1708,1710,1712,1725,1727,1729,1731,6585,103 54,10356,10358,10360,10362,10364,10366,10719,10736 ,10738,6889,4129,4131,2579,6914,6912,139,141,143,1 69,171,173,175,177,179,2430,2442,2444,3040,3042,30 44,3046,145,147,149,157,159,161,163,165,167,181,18 3,185,2436,2440,2448,3024,3026,3028,3030,6568,6524 ,6526,6523,6525,6522,6527,6528,11126,11124,11122,1 1120,11118,11133}; //PVP Drops
for (int i = 0; i < randomDrops; i++) {
int item = potentialDrops[(int)Math.floor(Math.random() * potentialDrops.length)];
chance = getPVPDropPercentage(item, totalValue(lostItems), dropFor.PVPPotential);
if (Math.random() <= chance) {
Engine.items.createGroundItem(item, 1, absX, absY, heightLevel, player);
dropFor.PVPPotential -= ((1.00 - chance) / 10);
} else {
dropFor.PVPPotential += ((1.00 - chance) / 10);
}
}
} catch (Exception e) {
}
}

double getPVPDropPercentage(int item, int risk, double potential) {
double base = 0.10 + potential * (hotZone(absX, absY) ? 3.00 : 1.50);
double ratio = getItemValue(item) / 1457000;
double value = base / ratio;
if (value > 0.95) {
value = 0.95;
}
return value;
}

void drainPrayer() {
if (usingPrayer) {
if (drainDelay == 0) {
if (skillLvl[5] <= 1) {
resetPrayer();
skillLvl[5]--;
getActionSender().setSkillLvl(this, 5);
appearanceUpdateReq = true;
updateReq = true;
getActionSender().sendMessage(this, "You are out of prayer points. Please restore them at an prayer altar.");
return;
}
skillLvl[5]--;
getActionSender().setSkillLvl(this, 5);
}
drainDelay = 8;
appearanceUpdateReq = true;
updateReq = true;
}
}

public void appendWilderness() {
wildyLevel = getWildernessLevel();
if (savedLevel != wildyLevel) {
savedLevel = wildyLevel;
if (wildyLevel > 0) {
addWilderness();
} else {
removeWilderness();
}
}
}
public void removeWilderness() {
getActionSender().setPlayerOption(this, "Null", 1, true);
getActionSender().removeOverlay(this);
getActionSender().removeShownInterface(this);
getActionSender().setOverlay(this, 653);
getActionSender().setInterfaceConfig(this, 653, 9, false);
getActionSender().setString(this, "None", 653, 8);
getActionSender().setString(this, "Target:", 653, 7);
getActionSender().setString(this, "Target Likelihood:", 653, 10);
getActionSender().setString(this, "0%", 653, 11);
getActionSender().setInterfaceConfig(this, 745, 6, true);
getActionSender().setInterfaceConfig(this, 745, 3, false);
updateReq = true;
appearanceUpdateReq = true;
}
public void addWilderness() {
getActionSender().setPlayerOption(this, "Attack", 1, true);
if (!isPVP()) {
getActionSender().setOverlay(this, 381);
} else if (gwd()) {
getActionSender().setPlayerOption(this, "Null", 1, true);
getActionSender().removeOverlay(this);
getActionSender().removeShownInterface(this);
getActionSender().setOverlay(this, 601);
} else if (enterHigh()) {
getActionSender().removeOverlay(this);
getActionSender().removeShownInterface(this);
getActionSender().setOverlay(this, 653);
} else if (bh1()) {
getActionSender().setPlayerOption(this, "Null", 1, true);
getActionSender().removeOverlay(this);
getActionSender().removeShownInterface(this);
getActionSender().setOverlay(this, 653);
getActionSender().setString(this, "Bh", 653, 8);
getActionSender().setString(this, "World Of Welf:", 653, 7);
getActionSender().setString(this, "", 653, 10);
getActionSender().setString(this, "", 653, 11);
} else if (guthanhillArea()) {
getActionSender().setPlayerOption(this, "Null", 1, true);
getActionSender().removeOverlay(this);
getActionSender().removeShownInterface(this);
getActionSender().setOverlay(this, 653);
getActionSender().setString(this, "Guthan", 653, 8);
getActionSender().setString(this, "World Of Welf:", 653, 7);
getActionSender().setString(this, "", 653, 10);
getActionSender().setString(this, "", 653, 11);
} else if (karilhillArea()) {
getActionSender().setPlayerOption(this, "Null", 1, true);
getActionSender().removeOverlay(this);
getActionSender().removeShownInterface(this);
getActionSender().setOverlay(this, 653);
getActionSender().setString(this, "Karil", 653, 8);
getActionSender().setString(this, "World Of Welf:", 653, 7);
getActionSender().setString(this, "", 653, 10);
getActionSender().setString(this, "", 653, 11);
} else if (dharokhillArea()) {
getActionSender().setPlayerOption(this, "Null", 1, true);
getActionSender().removeOverlay(this);
getActionSender().removeShownInterface(this);
getActionSender().setOverlay(this, 653);
getActionSender().setString(this, "Dharok", 653, 8);
getActionSender().setString(this, "World Of Welf:", 653, 7);
getActionSender().setString(this, "", 653, 10);
getActionSender().setString(this, "", 653, 11);
} else if (ahrimhillArea()) {
getActionSender().setPlayerOption(this, "Null", 1, true);
getActionSender().removeOverlay(this);
getActionSender().removeShownInterface(this);
getActionSender().setOverlay(this, 653);
getActionSender().setString(this, "Ahrim", 653, 8);
getActionSender().setString(this, "World Of Welf:", 653, 7);
getActionSender().setString(this, "", 653, 10);
getActionSender().setString(this, "", 653, 11);
} else if (toraghillArea()) {
getActionSender().setPlayerOption(this, "Null", 1, true);
getActionSender().removeOverlay(this);
getActionSender().removeShownInterface(this);
getActionSender().setOverlay(this, 653);
getActionSender().setString(this, "Torag", 653, 8);
getActionSender().setString(this, "World Of Welf:", 653, 7);
getActionSender().setString(this, "", 653, 10);
getActionSender().setString(this, "", 653, 11);
} else if (verachillArea()) {
getActionSender().setPlayerOption(this, "Null", 1, true);
getActionSender().removeOverlay(this);
getActionSender().removeShownInterface(this);
getActionSender().setOverlay(this, 653);
getActionSender().setString(this, "Verac", 653, 8);
getActionSender().setString(this, "World Of Welf:", 653, 7);
getActionSender().setString(this, "", 653, 10);
getActionSender().setString(this, "", 653, 11);
} else if (magebank()) {
getActionSender().setPlayerOption(this, "Null", 1, true);
getActionSender().removeOverlay(this);
getActionSender().removeShownInterface(this);
getActionSender().setOverlay(this, 653);
getActionSender().setInterfaceConfig(this, 653, 9, false);
} else if (corp()) {
getActionSender().setPlayerOption(this, "Null", 1, true);
getActionSender().removeOverlay(this);
getActionSender().removeShownInterface(this);
getActionSender().setOverlay(this, 775);
} else {
getActionSender().setInterfaceConfig(this, 745, 3, true);
getActionSender().setInterfaceConfig(this, 745, 6, false);
int max = combatLevel + wildyLevel;
if (max > 126) {
max = 126;
}
int min = (combatLevel - wildyLevel) + (((combatLevel % 10 >= 5) && ((combatLevel - wildyLevel) % 10 < 5) || (combatLevel >= 114)) ? 2 : 1);
if (min < 3) {
min = 3;
}
String range = min+" - "+max;
getActionSender().setInterfaceConfig(this, 745, 3, true);
}
} public int wildernessLevels(int coordY) {
wildyLevel = (coordY - 3254 / 7);
if (wildyLevel < 1)
wildyLevel = 1;
return wildyLevel;
}
public boolean inEdge() {
return absX >= 3089 && absX <= 3100 && absY >= 3847 && absY <= 3500;
}


/**
* Dharok's equipment check.
*/
public boolean fullDharok() {
return equipment[3] == 4718 && equipment[4] == 4720 && equipment[7] == 4722 && equipment[0] == 4716;
}

/**
* Verac's equipment check.
*/
public boolean fullVerac() {
return equipment[3] == 4755 && equipment[4] == 4757 && equipment[7] == 4759 && equipment[0] == 4753;
}

/**
* Guthan equipment chck
*/
public boolean hasGuthanEquipment() {
return equipment[3] == 4726 && equipment[4] == 4728 && equipment[7] == 4730 && equipment[0] == 4724;
}

/**
* Safezone.
*/
public boolean inClan() {
return absX >= 3264 && absY >= 3672 && absX <= 3279 && absY <= 3695;
}

/**
* clan wars arena
*/
public boolean inClanFight() {
return absX >= 3258 && absY >= 3710 && absX <= 3330 && absY <= 3842;
}

public void addClanWarsScreen() {
getActionSender().setString(this, ""+Server.engine.getWhiteClanPlayerCount(whiteCount) +"", 265, 6);
getActionSender().setString(this, ""+Server.engine.getBlackClanPlayerCount(blackCount) +"", 265, 7);
getActionSender().setOverlay(this, 265);
}

public int distanceToPoint(int pointX, int pointY) {
return (int) Math.sqrt(Math.pow(absX - pointX, 2) + Math.pow(absY - pointY, 2));
}

public boolean fullVoidKnightRange() {
return equipment[0] == 11675 && equipment[4] == 8839 && equipment[7] == 8840;
}

public boolean fullArmadyl() {
return equipment[0] == 11718 && equipment[4] == 11720 && equipment[7] == 11722;
}

public boolean saraChamber() {
return absX >= 2889 && absX <= 2907 && absY >= 5258 && absY <= 5276;
}

public boolean zammyChamber() {
return absX >= 2919 && absX <= 2935 && absY >= 5319 && absY <= 5330;
}

public boolean graardorChamber() {
return absX >= 2864 && absX <= 2876 && absY >= 5351 && absY <= 5369;
}

public boolean armadylChamber() {
return absX >= 2823 && absX <= 2843 && absY >= 5295 && absY <= 5310;
}

public boolean armadylChamber1() {
return absX >= 2825 && absX <= 2841 && absY >= 5297 && absY <= 5307;
}

public boolean inMageArena() {
return absX >= 3079 && absX <= 3126 && absY >= 3906 && absY <= 3951;
}

public boolean inDuelArena() {
return absX >= 3349 && absX <= 3388 && absY >= 3262 && absY <= 3280;
}

public boolean gwd() {
return absX >= 2819 && absX <= 2946 && absY >= 5254 && absY <= 5362;
}
public boolean enterHigh() {
return absX >= 3075 && absX <= 3188 && absY >= 3762 && absY <= 3654;
}

public boolean insara() {
return absX >= 2368 && absX <= 2394 && absY >= 9480 && absY <= 9499;
}

public boolean inzammy() {
return absX >= 2408 && absX <= 2434 && absY >= 9511 && absY <= 9538;
}

public boolean castlewars() {
return absX >= 2367 && absX <= 2440 && absY >= 3064 && absY <= 3140;
}

public boolean corp() {
return absX >= 2918 && absX <= 2975 && absY >= 4357 && absY <= 4412;
}
public boolean bh1() {
return absX >= 3152 && absX <= 3192 && absY >= 3667 && absY <= 4412;
}
/**
* barrows hill 1 - Guthan
*/
public boolean guthanhillArea() {
return (absX >= 3574 && absX <= 3581 && absY >= 3279 && absY <= 3285);
}
/**
* barrows hill 2 - Karil
*/
public boolean karilhillArea() {
return (absX >= 3562 && absX <= 3569 && absY >= 3272 && absY <= 3278);
}
/**
* barrows hill 3 - Dharok
*/
public boolean dharokhillArea() {
return (absX >= 3572 && absX <= 3578 && absY >= 3295 && absY <= 3301);
}
/**
* barrows hill 4 - Ahrim
*/
public boolean ahrimhillArea() {
return (absX >= 3563 && absX <= 3574 && absY >= 9683 && absY <= 9688);
}
/**
* barrows hill 5 - Torag
*/
public boolean toraghillArea() {
return (absX >= 3565 && absX <= 3556 && absY >= 9688 && absY <= 3285);
}
/**
* barrows hill 6 - Verac
*/
public boolean verachillArea() {
return (absX >= 3553 && absX <= 3560 && absY >= 3294 && absY <= 3301);
}

public boolean magebank() {
return absX >= 2527 && absX <= 2553 && absY >= 4707 && absY <= 3703;
}

public boolean inJadCave() {
return absX >= 2375 && absX <= 2425 && absY >= 5128 && absY <= 5169;
}

/**
* Sets the strings for kill counts for god wars dungeon.
*/
public void setGodWarsStrings() {
if (zammyChamber() || addZamorakCheckEventGodWars())
for (int i = 7; i < 11; i++)
for (int k = 0; k < 5; k++)
if (this != null)
getActionSender().setString(this, ""+godWarsKills[k]+"", 598, i);
else
for (int s = 7; s < 11; s++)
for (int d = 0; d < 5; d++)
if (this != null)
getActionSender().setString(this, ""+godWarsKills[d]+"", 601, s);
}

public ActionSender getActionSender() {
return Engine.actionSender;
}

public DuelArena getDuelClass() {
return duelArena;
}

public FightCave getFightClass() {
return fCave;
}

public WarriorGuild getWarriorClass() {
return warriorGuild;
}

public QuestDevelopment getQuestClass() {
return quest;
}

public TestWorldLoader getWorldLoader() {
return worldLoader;
}

public ByteVector getByteVector() {
return stream;
}

public boolean duelFight() {
return absX >= 3361 && absX <= 3392 && absY >= 3223 && absY <= 3241;
}

public boolean slayerTower() {
return absX >= 3402 && absX <= 3458 && absY >= 3529 && absY <= 3581;
}

public void appendPotion() {
if (explodeDelay == 0) {
if (explodeType == 1) {
appendHit(25, 0);
requestForceChat("Ow!");
getActionSender().sendMessage(this, "The unidentified liquid potion exploded!");
}
explodeType = 0;
explodeDelay = -1;
}
}

public boolean castleLobby() {
return absX >= 2435 && absX <= 2449 && absY >= 3079 && absY <= 3099;
}

public boolean castleArea() {
return absX >= 2358 && absX <= 2438 && absY >= 3066 && absY <= 3142;
}

public boolean correctDistance(int j, int k, int l, int i1, int j1)
{
for(int k1 = 0; k1 <= j1; k1++)
{
for(int l1 = 0; l1 <= j1; l1++)
{
if(j + k1 == l && (k + l1 == i1 || k - l1 == i1 || k == i1))
return true;
if(j - k1 == l && (k + l1 == i1 || k - l1 == i1 || k == i1))
return true;
if(j == l && (k + l1 == i1 || k - l1 == i1 || k == i1))
return true;
}

}

return false;
}

public int getLoginSpecial() {
if (specAmount <= 0) {
return 0;
} else {
return specAmount;
}
}

public int getLoginSpellbook() {
if (spellbook <= 0) {
return 192;
} else {
return spellbook;
}
}

public PlayerFletching getFletchingClass() {
return fletchingClass;
}

/**
* Edgeville 1 V 1
*/
public boolean inEdgePk() {
return absX >= 3040 && absX <= 3118 && absY >= 3522 && absY <= 3553;
}

/**
* Checking if combat level difference is correct for attacking in wild.
*/
public boolean combatDifference(int cbLvl) {
return wildLevel >= combatLevel && combatLevel + cbLvl >= wildLevel || cbLvl < combatLevel && combatLevel - wildLevel <= cbLvl || cbLvl == combatLevel;
}

/**
* Update the wilderness levels.
*/
void addWildernessUpdating() {
getActionSender().setString(this, "Level: "+getWildernessLevel(), 381, 1);
if (updatedLevel != wildernessZone(absX, absY)) {
updatedLevel = wildernessZone(absX, absY);
if (updatedLevel && !gwd() && !inClan() && !clanWarsFightArea()) {
getActionSender().setOverlay(this, 381);
} else {
wildyLevel = 0;
getActionSender().removeOverlay(this);
}
}
}

public String getMessageString(int economyId) {
switch (economyId) {

case 4153:
return "Granite mauls are now disabled, Please kill Gargoyles in the Slayer tower.";

case 4151:
case 11235:
return "Abyssal whips and Dark bows are disabled, Please go to Slayer tower.";

case 2440:
case 2434:
case 6685:
return "You cannot spawn the super strength potion, Prayer potion and Brews anymore, Please steal potions from the stalls at home.";

case 385:
case 391:
return "You cannot spawn food anymore, Please steal food from the stalls at home.";

case 10581:
return "Please go to the Slayer Tower for a Keris dagger.";

case 11690:
case 11702:
case 11704:
case 11706:
case 11708:
return "You can only get a God hilt or Godsword blade by Defeating the Generals of the Gods in the God wars Dungeon.";

case 11718:
case 11720:
case 11722:
case 12670:
case 12671:
return "You can only get a piece of Armadyl armour by Visitting Armadyl's Eyrie in the Godwars dungeon.";

case 11724:
case 11726:
case 11728:
return "You can only get a piece of Bandos armour by Visitting Bandos's Stronghold in the Godwars dungeon.";

case 3140:
return "You can only get a Dragon chainbody by Killing the Kalphite Queen in her Kalphite Lair.";

case 6570:
case 10566:
case 10637:
return "Please visit The fight cave for a Fire cape.";

case 11694:
case 11696:
case 11698:
case 11700:
return "Please visit the Godwars dungeon to get this item.";

default:
return "";
}
}

/**
* Loads objects at Map region loading.
*/
public void loadStaticObjects() {
getActionSender().addStaticObject(15277, 0, 3102, 5536, -1, 10);//cb ring space
getActionSender().addStaticObject(13137, 0, 3108, 5533, -1, 10);//cb ring space
getActionSender().addStaticObject(15349, 0, 2991, 3435, 0, 10);
getActionSender().addStaticObject(15349, 0, 2991, 3435, 0, 10);
getActionSender().addStaticObject(31077, 0, 2858, 2959, 0, 10);//tin ore
getActionSender().addStaticObject(31080, 0, 2857, 2959, 0, 10);//copper ore
getActionSender().addStaticObject(31071, 0, 2856, 2959, 0, 10);//iron ore
getActionSender().addStaticObject(31068, 0, 2855, 2959, 0, 10);//Coal
getActionSender().addStaticObject(31086, 0, 2854, 2959, 0, 10);//mithril ore
getActionSender().addStaticObject(31083, 0, 2850, 2959, 0, 10);//adamant ore
getActionSender().addStaticObject(2107, 0, 2849, 2959, 0, 10);//runite ore
getActionSender().addStaticObject(1278, 0, 2251, 3183, 0, 10);//normal tree
getActionSender().addStaticObject(1281, 0, 2251, 3180, 0, 10);//oak tree
getActionSender().addStaticObject(1308, 0, 2257, 3183, 0, 10);//willow tree
getActionSender().addStaticObject(1307, 0, 2260, 3186, 0, 10);//maple tree
getActionSender().addStaticObject(8513, 0, 2249, 3186, 0, 10);//yew tree
getActionSender().addStaticObject(1306, 0, 2263, 3184, 0, 10);//magic tree
getActionSender().addStaticObject(10284, 0, 3565, 3287, 0, 10);//chest barrows
getActionSender().addStaticObject(22439, 0, 3164, 3467, 0, 10);//wall
getActionSender().addStaticObject(22439, 0, 3165, 3467, 0, 10);//wall
getActionSender().addStaticObject(22439, 0, 3163, 3467, 0, 10);//wall
getActionSender().addStaticObject(22439, 0, 3190, 3487, -1, 10);//wall
getActionSender().addStaticObject(22439, 0, 3190, 3488, -1, 10);//wall
getActionSender().addStaticObject(22439, 0, 3190, 3489, -1, 10);//wall
getActionSender().addStaticObject(34382, 0, 3000, 3376, 0, 10);//silver stall
getActionSender().addStaticObject(11402, 0, 3165, 3487, 0, 10);//Bank booth

getActionSender().addStaticObject(11402, 2, 3509, 9497, 0, 10);
getActionSender().addStaticObject(23610, 2, 3509, 9497, 0, 10);
getActionSender().addStaticObject(11402, 2, 3164, 3495, 0, 10);
//getActionSender().addStaticObject(3831, 0, 3184, 3446, 0, 10);
}
public void addObject(Player p, int objectId, int height, int objectX, int objectY, int face, int type) {
getActionSender().addObject(p, 9224, 4, 3190, 3452, 0, 10);
}


/**
* Zammys part of god wars area check boolean
*/
public boolean addZamorakCheckEventGodWars() {
return absX >= 2879 && absX <= 2945 && absY >= 5342 && absY <= 5364;
}

/**
* Update the player.
*/
public void updatePlayer(boolean updateIsNeccesary) {
appearanceUpdateReq = updateReq = updateIsNeccesary;
}

public int getX() {
return absX;
}

public int getY() {
return absY;
}

public int getHeight() {
return heightLevel;
}

public int getPlayerId() {
return playerId;
}

public void convertPlayerToNpc(int npcType) {
this.npcType = npcType;
}

void restorePrayer() {
if (isDead) {
return;
}
if (skillLvl[5] > getLevelForXP(5)) {
skillLvl[5]--;
}
if (skillLvl[5] < getLevelForXP(5)) {
skillLvl[5] += equipment[9] == 11133 ? 2 : 1;
}
getActionSender().setSkillLvl(this, 5);
}
public void updatePlayerAppearance(int walkAnim, int standAnim, int runAnim) {
standEmote = standAnim;
walkEmote = walkAnim;
runEmote = runAnim;
}

public void appendToIPBanned(Player player) {
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter("./data/banned/bannedhosts.dat", true));
bw.write(Server.socketListener.getAddress(player.s ocket.socket));
bw.newLine();
bw.flush();
Server.socketListener.loadBannedHosts();
player.disconnected[0] = true;
player.disconnected[1] = true;
} catch (IOException ioe) {
} finally {
if (bw != null) {
try {
bw.close();
} catch (IOException ioe2) {
}
}
}
}
public void appendToBanned(String player) {
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter("./data/banned/bannedusers.dat", true));
bw.write(player);
bw.newLine();
bw.flush();
Server.loadBannedUsers();
} catch (IOException ioe) {
} finally {
if (bw != null) {
try {
bw.close();
} catch (IOException ioe2) {
}
}
}
}

String Directory = "./data/banned/bannedusers.dat";
String MaxBan[] = new String[10000];
String UserThatBan = new String();
int Ban = 0;

public void UnBanPlayer(String Player) {
try {
BufferedReader dataStream = new BufferedReader(new FileReader("./data/banned/bannedusers.dat"));
while ((UserThatBan = dataStream.readLine()) != null) {
if(UserThatBan.equalsIgnoreCase(Player)) {
} else
if(!UserThatBan.equalsIgnoreCase(Player)) {
MaxBan[Ban] = UserThatBan;
Ban++;
}
}
} catch(Exception e) {
e.printStackTrace();
}
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter(Directory, false));
bw.write("");
bw.flush();
bw.close();
} catch(Exception e) {
e.printStackTrace();
}
try {
bw = new BufferedWriter(new FileWriter("./data/banned/bannedusers.dat", true));
for(int a = 0; a < MaxBan.length; a++) {
if(MaxBan[a] != null) {
bw.write(MaxBan[a]);
bw.newLine();
bw.flush();
}
}
bw.close();
} catch(Exception e) {
e.printStackTrace();
}
Server.loadBannedUsers();
}

public boolean nonMultiPlace() {
return absX >= 3400 && absX <= 3457 && absY >= 3527 && absY <= 3579 && heightLevel == 2;
}

public int neededSpecialAmount() {
switch (equipment[3]) {
case 1215:
case 1231:
case 5680:
case 5698:
case 1305:
case 1434:
case 13889:
case 1249:
return 250;
case 10887:
case 11694:
case 11698:
case 4151:
return 500;
case 11235:
return 550;
case 11700:
return 600;
case 11696:
case 11730:
return 1000;
default:
return 0;
}
}

public int weaponType;

public int attackStyle() {

/*
* Melee weapon styles
* 1 : accurate
* 2 : agressive
* 3 : defensive
* 4 : controlled
*
* Ranged weapon styles
* 5 : accurate
* 6 : rapid
* 7 : longrange
*/

switch (weaponType) {
case 0: return fightStyle;
case 1: return fightStyle;
case 2:
if (fightStyle == 1) {
return 1;
}
if (fightStyle == 3) {
return 2;
}
if (fightStyle == 2) {
return 3;
}
case 3:
if (fightStyle == 1) {
return 1;
}
if (fightStyle == 2) {
return 2;
}
if (fightStyle == 3) {
return 4;
}
if (fightStyle == 4) {
return 3;
}
case 4:
if (fightStyle == 1) {
return 5;
}
if (fightStyle == 3) {
return 6;
}
if (fightStyle == 2) {
return 7;
}
case 5: break;
case 6: return fightStyle;
case 7:
if (fightStyle == 1) {
return 1;
}
if (fightStyle == 2 || fightStyle == 3) {
return 2;
}
if (fightStyle == 4) {
return 3;
}
case 8:
if (fightStyle == 1) {
return 1;
}
if (fightStyle == 4 || fightStyle == 3) {
return 2;
}
if (fightStyle == 2) {
return 3;
}
case 9:
if (fightStyle == 1) {
return 4;
}
if (fightStyle == 2) {
return 2;
}
if (fightStyle == 3) {
return 3;
}
case 10:
if (fightStyle == 1) {
return 1;
}
if (fightStyle == 2) {
return 2;
}
if (fightStyle == 3) {
return 4;
}
if (fightStyle == 4) {
return 3;
}
case 11:
if (fightStyle == 1) {
return 1;
}
if (fightStyle == 4) {
return 2;
}
if (fightStyle == 3) {
return 4;
}
if (fightStyle == 2) {
return 3;
}
case 12:
if (fightStyle == 1 || fightStyle == 2) {
return fightStyle;
}
if (fightStyle == 3) {
return 4;
}
if (fightStyle == 4) {
return 3;
}
}
return 8;
}

public int weaponStyle(int weaponID) {
switch (weaponID) {
case 4151: return 2;
case 4153: return 3;
case 1277:
case 1279:
case 1281:
case 1283:
case 1285:
case 1287:
case 1289:
case 1291:
case 1293:
case 1295:
case 1297:
case 1299:
case 1301:
case 1303:
case 1305:
case 1329:
case 1331:
case 1337:
case 4587:
if (fightStyle != 3) {
return 2;
} else {
return 1;
}
case 1434:
case 4755:
case 10887:
if (fightStyle != 3) {
return 3;
} else {
return 1;
}
case 1215:
case 1231:
case 5680:
case 5698:
if (fightStyle != 3) {
return 1;
} else {
return 2;
}
case 1307:
case 1309:
case 1311:
case 1313:
case 1315:
case 1317:
case 1319:
case 1349:
case 1351:
case 1353:
case 1355:
case 1357:
case 1359:
case 1361:
case 1363:
case 1365:
case 1367:
case 1369:
case 1371:
case 1373:
case 1375:
case 1377:
case 4718:
case 6739:
case 7158:
case 11694:
case 11696:
case 11698:
case 11700:
case 11730:
if (fightStyle != 3) {
return 2;
} else {
return 3;
}
}
return 1;
}

public int getAttackSound() {
String weapon = Engine.items.getItemName(equipment[3]);
if (weapon.equals("Abyssal whip")) {
return 2720;
}
if (weapon.contains("godsword") || weapon.equals("Saradomin sword")) {
switch (fightStyle) {
case 1:
case 2:
case 4: return 3846;
case 3: return 3882;
}
}
if (weapon.equals("Granite maul")) {
return 2714;
}
return -1;
}

public int getSpecialAttackSound() {
return -1;
}

public ClanWars getClanWarsHandler() {
return clanWars;
}

public boolean clanWarsFightArea() {
return absX >= 3263 && absX <= 3327 && absY >= 3713 && absY <= 3840;
}

/**
* Prepare player for removal.
*/
public void destruct() {
long me = Misc.stringToLong(username);
for(Player p : Engine.players) {
if(p == null) continue;
if(p.friends.contains(me)) {
p.getActionSender().sendFriend(p, me, 0);
}
}
stream = null;
try {
socket.input.close();
socket.output.close();
socket.socket.close();
} catch (Exception e) {
}
socket.input = null;
socket.output = null;
socket.socket = null;
socket = null;
absX = absY = mapRegionX = mapRegionY = -1;
}

}

Nathan'
June 19th, 2010, 10:22
change the setOverlay to the id of the bounty hounter target interface

aksl8
June 22nd, 2010, 19:37
o
ooo

riches321
June 22nd, 2010, 19:40
aks u jsutspam spam spam spam spam and double, trpipel post every enrd l2post

Nathan
June 22nd, 2010, 19:43
o
ooo

agreed with riches. if u keep spamming. i request a ban for aksl8.