Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 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.util.UserInput;
- import net.com.codeusa.test.TestWorldLoader;
- import net.com.codeusa.model.misc.*;
- import net.com.codeusa.model.combat.*;
- import net.com.codeusa.*;
- 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.PlayerSave;
- import net.com.codeusa.event.*;
- import net.com.codeusa.net.packethandler.MagicOnPlayer;
- import net.com.codeusa.model.items.PlayerWeapon;
- import net.com.codeusa.content.*;
- public class Player implements Entity {
- public UserInput input = new UserInput(this);
- public int buryDelay = 0;
- public boolean noteItems = false;
- public int poisonTicks;
- public List<Long> friends = new ArrayList<Long>(200);
- public boolean spellCharged;
- public List<Long> ignores = new ArrayList<Long>(100);
- public int autocastSpell = 0;
- public boolean autocast = false;
- public int stunned;
- public int autocastSpellbook = 0;
- public boolean maging;
- public boolean hitOne;
- public int count;
- public boolean usedLogout;
- public boolean switching;
- 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 alchDelay = 0;
- public long stairsDelay = System.currentTimeMillis();
- public long picklockDelay = System.currentTimeMillis();
- public double rangedMax;
- public String OriginalAttacker;
- public int startChatting;
- public int attackedByCount;
- public String attacking;
- public String attackedBy;
- 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 int[] ikod = new int[3];
- public boolean successfulCast;
- public boolean usingMage;
- public boolean orb;
- public int weapon;
- public int strengthBonus;
- public int oppIndex;
- public int hitIndex;
- public boolean getExperience = true;
- public int NPCspecDelay = -1;
- public int secondNPCSpecDelay = -1;
- public int damageNPCDelay = -1;
- public int combatNPCDelay = -1;
- public int rangeNPCDmgDelay;
- public int rangeNPCDmgDelay2;
- public int lastIndex;
- public int justSwitched;
- public boolean alreadyAttacked;
- public boolean bountyInterface = false;
- public int BhTimer;
- public int teleMenu;
- public int leftBhTimer = 0;
- public int attackedByNpcCount;
- public int bhPickup;
- public int optionId;
- public int bhLeave;
- public int shops;
- public int checking;
- public int getIndex;
- public int waitShit;
- public int bhTarget = 0;
- public int switchSpells = 0;
- public int fleeTimer = 0;
- public int bhLeave1;
- public int amount;
- public boolean inBounty = false;
- public int serverMsg;
- public int skullId;
- public int pickedUp;
- public int InBounty = 0;
- public transient int hitDelay = 0;
- public int direction = 0;
- public int followPlayer;
- public boolean followingPlayer;
- public int playFollow;
- public boolean DFSSpecial;
- public long lastDFS;
- public int DFSDelay = -1;
- public int points = 0; //bandos
- public int apoints = 0; //armadyl
- public int spoints = 0; //saradomin
- public int zpoints = 0; //zamorak
- public boolean wildWarned = false;
- public boolean swapAsNote = false;
- public boolean initialAttack;
- public int attackedInSingle;
- public int PlayerItems;
- public boolean dboltspecial;
- public boolean diamondboltspecial;
- public boolean morriganjavs;
- public boolean morriganaxes;
- public String nameSet;
- public int setDrop;
- public int KC;
- public int DC;
- public int summoningon = 0;
- public boolean underAttack = false;
- public boolean inWild = false;
- public boolean safed = false;
- public boolean summoning = false;
- public String chatName;
- public final String ACTIVE_CHAT_DEFAULT = "Reborn525";
- public String activeChat = ACTIVE_CHAT_DEFAULT;
- public final String ACTIVE_CHAT_OWNER_DEFAULT = "Public Channel";
- public String activeChatOwner = ACTIVE_CHAT_OWNER_DEFAULT;
- public double bhkills;
- public int totalKills;
- public int kills;
- public boolean teleblocked;
- public int teleblockTimer;
- public boolean teletab;
- public int leverTeleportX;
- public int leverTeleportY;
- public int totalDamageRecoiled;
- public int leverTeleportH;
- public int leverTeleportDelay = -1;
- public boolean lever;
- public int Donator;
- public int miasmicSpell;
- 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 boolean specdeleh;
- public int secondSpecDelay = -1;
- public int delayedDamageDelay = -1;
- public int delayedDamageHit = -1;
- public boolean expectSpec;
- public boolean autoRetaliate = false;
- 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;
- public int freezeDelay;
- public int vengeanceDelay;
- public int lunarDelay;
- public boolean vengeance;
- public int spellbookSwapTimer;
- public boolean spellbookSwap;
- public boolean usedSpellbookSwap;
- public int mageDelay;
- public boolean fadeAway;
- public int enemyFadeAwayDelay = -1;
- public int fightStyle = 1;
- public int headIconSkull = -1;
- public boolean isSkulled;
- public int skullVanishDelay;
- public int rangeDmgDelay = -1;
- public int rangeDmgDelay2 = -1;
- public boolean timerStarted;
- public long PVPTimer;
- public boolean timerStarted2;
- public int wildTimer = 0;
- public int wildLevel;
- public boolean updatedLevel;
- public int savedLevel;
- public int maxArrays = 10;
- public boolean[] optionArray = new boolean[maxArrays];
- public TestWorldLoader worldLoader = new TestWorldLoader(this);
- public int nextDamageDelay = -1;
- public int nextGraphicDelay = -1;
- public int wildernessLevel;
- public int autoCastDmgDelay = -1;
- public int autoCastDelay;
- public int[] autoCast = new int[3];
- public boolean castAuto;
- public boolean usingAutoCast;
- public boolean disturbSara;
- public int deathEmoteDelay = -1;
- public int crystalShots;
- public int equipSpecDelay;
- public boolean isBanking;
- 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 mute;
- public int slayerAmount1;
- public int slayerType1;
- public int slayerAmount;
- public int damageSpecDelay = -1;
- public boolean enableSpecDamage;
- public int damageDelay1 = -1;
- public boolean enableDamage;
- public int atkDelay;
- public boolean attackingNpc;
- public int attackNpc;
- public int npcClick2;
- public int wildyLevel;
- public int statDelay = 100;
- public int hpDelay = 100;
- public int animClickDelay;
- public boolean usingPrayer;
- public int drainDelay;
- public boolean rangedPrayer;
- public boolean meleePrayer;
- public boolean magicPrayer;
- public boolean retriPrayer;
- public boolean redempPrayer;
- public int slayerTask;
- public int headIconPrayer = -1;
- public double drainCount = 0;
- public int playerId = 0;
- public ByteVector stream = new ByteVector(500, 5000);
- public PlayerSocket socket;
- public boolean online = false;
- public String username = "null";
- public String password = "";
- public int rights = 0;
- public int jailed = 0;
- public int starter = 0;
- public boolean[] disconnected = new boolean[2];
- public int mapRegionX = 0;
- public int mapRegionY = 0;
- public int currentX = 0;
- public int currentY = 0;
- public int absX = 0;
- public int absY = 0;
- public int heightLevel = 0;
- public int spellbook = 192;
- public int walkDir = -1;
- public int runDir = -1;
- public boolean isRunning = false;
- public boolean mapRegionDidChange = false;
- public boolean didTeleport = false;
- public int teleportToX = -1;
- public int teleportToY = -1;
- public boolean updateReq = false;
- public int walkingQueueSize = 50;
- public int wQueueReadPtr = 0;
- public int wQueueWritePtr = 0;
- public int[] walkingQueueX = new int[walkingQueueSize];
- public int[] walkingQueueY = new int[walkingQueueSize];
- public int[] walkingQueue = new int[walkingQueueSize];
- public Player[] playerList = new Player[Engine.players.length];
- public byte[] playersInList = new byte[Engine.players.length];
- public int playerListSize = 0;
- public boolean chatTextUpdateReq = false;
- public String chatText = "";
- public int chatTextEffects = 0;
- public boolean appearanceUpdateReq = false;
- public boolean animUpdateReq = false;
- public int animReq = -1;
- public int animDelay = 0;
- public boolean gfxUpdateReq = false;
- public int gfxReq = -1;
- public int gfxDelay = 0;
- public boolean faceToUpdateReq = false;
- public int faceToReq = -1;
- public boolean hit1UpdateReq = false;
- public boolean hit2UpdateReq = false;
- public int hitDiff1 = 0;
- public int hitDiff2 = 0;
- public int poisonHit1 = 0;
- public int poisonHit2 = 0;
- public int[] skillLvl = new int[25];
- public int[] skillXP = new int[25];
- public int combatLevel = 0;
- public int[] equipment = new int[14];
- public int[] equipmentN = new int[14];
- public int[] equipmentBonus = new int[12];
- public int[] color = new int[5];
- public int[] look = new int[7];
- public int npcType = -1;
- public int gender = 0;
- public int runEmote = 0x338;
- public int walkEmote = 0x333;
- public int standEmote = 0x328;
- public NPC[] npcList = new NPC[Engine.npcs.length];
- public byte[] npcsInList = new byte[Engine.npcs.length];
- public int npcListSize = 0;
- public boolean rebuildNPCList = false;
- public int[] items = new int[28];
- public int[] itemsN = new int[28];
- public int interfaceId = -1;
- public int chatboxInterfaceId = -1;
- public int loginStage = 0;
- public int clickX = 0;
- public int clickY = 0;
- public int clickId = 0;
- public int eatDelay;
- public int drinkDelay;
- public boolean itemPickup = false;
- public boolean runEnergyUpdateReq = false;
- public int runEnergy = 100;
- public int runEnergyDelay = 0;
- public boolean playerOption1 = false;
- public boolean playerOption2 = false;
- public boolean playerOption3 = false;
- public boolean npcOption1 = false;
- public boolean objectOption1 = false;
- public PrayerSystem prayerSystem = new PrayerSystem(this);
- public PlayerWeapon playerWeapon = new PlayerWeapon(this);
- public boolean objectOption2 = false;
- public boolean npcOption2 = false;
- public String forceChat = "";
- public boolean forceChatUpdateReq = false;
- 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;
- public int clickDelay = -1;
- public long loginTimeout = System.currentTimeMillis();
- public int[] bankItems = new int[500];
- public int[] bankItemsN = new int[500];
- public double immunityTimer;
- public int logoutTimer;
- public int restoreSpecialTimer;
- public String attackedByNpc;
- public void spellCharging(final Player p) {
- EventManager.getSingleton().addEvent(
- new Event() {
- public void execute(EventContainer c) {
- p.spellCharged = false;
- p.message("Your charge on your godspells has ended.");
- c.stop();
- }
- }, 300000);
- };
- public boolean npcHitPlayerRange(NPC n) {
- return Math.random() <= npcRangeAccuracy(n);
- }
- public boolean hitNPC(NPC n) {
- return Math.random() <= npcMeleeAccuracy(n);
- }
- public void setShop(Player p, int shopId) {
- ShopHandler sh = new ShopHandler();
- p.getActionSender().removeShownInterface(p);
- getActionSender().showInterface(p, 620);
- getActionSender().setInventory(p, 621);
- getActionSender().setTab(p, 80, 621);
- Object[] setshopparams = new Object[]{shopId, 93};
- int shi = 621 << 16;
- int ship = (620 << 16) + 24;
- Object[] invparams = new Object[]{"", "", "", "", "Sell X", "Sell 10", "Sell 5", "Sell 1", "Value", -1, 0, 7, 4, 93, shi};
- Object[] shopparams = new Object[]{"", "", "", "", "Buy X", "Buy 10", "Buy 5", "Buy 1", "Value", -1, 0, 4, 10, 31, ship};
- getActionSender().runScript(p, 25, setshopparams, "vg");
- getActionSender().runScript(p, 150, invparams, "IviiiIsssssssss");
- getActionSender().runScript(p, 150, shopparams, "IviiiIsssssssss");
- getActionSender().setAccessMask(p, 1278, 0, 621, 0, 28);
- getActionSender().setInterfaceConfig(p, 620, 23, true);
- getActionSender().setInterfaceConfig(p, 620, 24, false);
- getActionSender().setInterfaceConfig(p, 620, 29, true);
- getActionSender().setInterfaceConfig(p, 620, 25, false);
- getActionSender().setInterfaceConfig(p, 620, 27, false);
- getActionSender().setInterfaceConfig(p, 620, 26, true);
- getActionSender().setAccessMask(p, 1278, 24, 620, 0, 40);
- }
- public double npcMeleeAccuracy(NPC n) {
- if (n == null || this.isDead || n.isDead || this.disconnected[0]) {
- return 1;
- }
- double attack = skillLvl[0];
- int activeAttackBonus = weaponStyle(equipment[3]) - 1;
- int activeDefenceBonus = activeAttackBonus + 5;
- double attackBonus = equipmentBonus[activeAttackBonus];
- 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 (attackBonus < 0) {
- attackBonus = 0;
- }
- if (defile) {
- }
- double offensiveAttribute = (attack * 1.5) + attackBonus;
- double difference = Math.abs(offensiveAttribute);
- boolean positive = true;
- 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 double npcRangeAccuracy(NPC n) {
- if (n == null || this.isDead || n.isDead || this.disconnected[0]) {
- return 1;
- }
- double range = skillLvl[4];
- double rangeBonus = equipmentBonus[4];
- if (usingPrayer(3)) {
- range *= 1.05;
- }
- if (usingPrayer(11)) {
- range *= 1.10;
- }
- if (usingPrayer(20)) {
- range *= 1.15;
- }
- if (attackStyle() == 5) {
- range += 1;
- }
- if (rangeBonus < 0) {
- rangeBonus = 0;
- }
- double offensiveAttribute = range + rangeBonus;
- double difference = Math.abs(offensiveAttribute);
- boolean positive = true;
- 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;
- }
- String[][] itemPrices = {{"Warrior helm", "536"}, {"Purple sweets", "12"}, {"Armadyl godsword", "1500000"}, {"Statius's warhammer", "50000"}, {"Dragon med helm", "605"}, {"Statius's platelegs", "0"}, {"Statius's full helm", "0"}, {"Statius's platebody", "0"}, {"Black dragonhide", "33"}, {"Dragon med helm", "605"}, {"Vesta's longsword", "0"}, {"Dragon bones", "30"}, {"Enchanted robe", "495"}, {"Dragonfire shield", "212000"}, {"Mystic robe top", "720"}, {"Enchanted top", "741"}, {"Enchanted hat", "89"}, {"Adamant knife", "2"}, {"Adamant knife(p)", "4"}, {"Draconic visage", "217000"}, {"Mystic hat", "92"},{"Mystic robe bottom", "480"}, {"Mystic boots", "59"}, {"Mystic gloves", "59"}, {"Adamant knife(p+)", "5"}, {"Adamant knife(p++)", "13"}, {"Adamant dart", "1"}, {"Adamant dart(p)", "3"}, {"Adamant dart(p+)", "4"}, {"Adamant dart(p++)", "12"}, {"Tzhaar-ket-em", "891"}, {"Barrelchest anchor", "2300"}, {"Crystal bow full", "9000"}, {"Crystal shield full", "9000"}, {"Rune chainbody", "315"}, {"Zamorakian spear", "14395"}, {"Saradomin staff", "800"}, {"Guthix staff", "800"}, {"Zamorak staff", "800"}, {"Bolt rack", "2"}, {"Santa hat", "131601"}, {"Tuna potato", "20"}, {"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", "15000"}, {"Fighter Torso", "15000"}, {"Armadyl godsword", "675018"}, {"Bandos godsword", "188580"}, {"Saradomin godsword", "496437"}, {"Zamorak godsword", "267983"}, {"Dragon med helm", "885"}, {"Dragon sq shield", "5630"}, {"Dragon dagger", "292"}, {"Dragon dagger(p)", "305"}, {"Dragon dagger(p+)", "312"}, {"Drag dagger(p++)", "350"}, {"Dragon spear", "451"}, {"Dragon spear(p)", "460"}, {"Dragon spear(p+)", "465"}, {"Dragon spear(p++)", "506"}, {"Dragon longsword", "956"}, {"Dragon battleaxe", "1200"}, {"Dragon mace", "298"}, {"Dragon claws", "563332"}, {"Dragon chainbody", "50565"}, {"Dragon halberd", "1948"}, {"Dragon platelegs", "6323"}, {"Dragon plateskirt", "1979"}, {"Dragon scimitar", "998"}, {"Dragon platebody", "99230"}, {"Dragon axe", "16880"}, {"Dragon 2h sword", "8921"}, {"Dragon bolts (e)", "46"}, {"Diamond bolts (e)", "8"}, {"Dragon arrow", "29"}, {"Dragon arrow(p)", "31"}, {"Dragon arrow(p+)", "32"}, {"Dragon arrow(p++)", "40"}, {"Dragon fire arrows", "26"}, {"Dragonfire shield", "177038"}, {"Dragon full helm", "125349"}, {"Dragon boots", "2407"}, {"Dragon dart", "6"}, {"Dragon dart(p)", "8"}, {"Dragon dart(p+)", "9"}, {"Dragon dart(p++)", "17"}, {"Dragon bones", "24"}, {"Big bones", "3"}, {"Astral rune", "1"}, {"Blood rune", "3"}, {"Death rune", "3"}, {"Law rune", "3"}, {"Nature rune", "2"}, {"Soul rune", "3"}, {"Rune arrow", "2"}, {"Rune arrow(p)", "4"}, {"Rune arrow(p+)", "5"}, {"Rune arrow(p++)", "13"}, {"Rune fire arrows", "2"}, {"Rune c'bow", "95"}, {"Rune dart", "2"}, {"Rune dart(p)", "4"}, {"Rune dart(p+)", "5"}, {"Rune dart(p++)", "13"}, {"Rune fire arrows", "2"}, {"Rune full helm (t)", "3160"}, {"Rune full helm(g)", "4792"}, {"Rune kiteshield (g)", "4307"}, {"Rune kiteshield (t)", "2838"}, {"Rune platebody (g)", "6296"}, {"Rune platebody (t)", "3995"}, {"Rune platelegs (g)", "6296"}, {"Rune platelegs (t)", "2076"}, {"Rune plateskirt (g)", "639"}, {"Rune plateskirt (t)", "569"}, {"Rune full helm", "211"}, {"Rune boots", "460"}, {"Rune kiteshield", "499"}, {"Rune med helm", "114"}, {"Rune platebody", "578"}, {"Rune platelegs", "507"}, {"Rune plateskirt", "443"}, {"Rune sq shield", "230"}, {"Rune thrownaxe", "3"}, {"Gilded full helm", "3957"}, {"Gilded kiteshield", "4460"}, {"Gilded platebody", "15019"}, {"Gilded platelegs", "5902"}, {"Gilded plateskirt", "1618"}, {"Guthix full helm", "38888"}, {"Guthix kiteshield", "3763"}, {"Guthix platebody", "6185"}, {"Guthix platelegs", "2935"}, {"Guthix plateskirt", "577"}, {"Saradomin full", "8430"}, {"Saradomin kite", "8776"}, {"Saradomin plate", "16213"}, {"Saradomin legs", "3694"}, {"Saradomin skirt", "1003"}, {"Zamorak full helm", "5814"}, {"Zamorak kiteshield", "6221"}, {"Zamorak platebody", "11047"}, {"Zamorak platelegs", "3534"}, {"Zamorak plateskirt", "991"}, {"Adam full helm(g)", "1121"}, {"Adam full helm(t)", "601"}, {"Adam kiteshield (g)", "1159"}, {"Adam kiteshield (t)", "414"}, {"Adam platebody (g)", "2009"}, {"Adam platebody (t)", "908"}, {"Adam platelegs (g)", "792"}, {"Adam plateskirt (t)", "152"}, {"Adamant arrow", "1"}, {"Adamant arrow(p)", "3"}, {"Adamant arrow(p+)", "4"}, {"Adamant arrow(p++)", "12"}, {"Adamant fire arrows", "9"}, {"Adamant javelin", "1"}, {"Adamant javelin(p)", "3"}, {"Adamant javelin(p+)", "4"}, {"Adamant javelin(p++)", "12"}, {"Adamant chainbody", "27"}, {"Adamant boots", "20"}, {"Adamant full helm", "23"}, {"Adamant kiteshield", "31"}, {"Adamant platebody", "98"}, {"Adamant platelegs", "37"}, {"Adamant plateskirt", "37"}, {"Adamant med helm", "12"}, {"Adamant thrownaxe", "1"}, {"Adamant spear", "10"}, {"Adamant spear(p)", "20"}, {"Adamant spear(p+)", "25"}, {"Adamant spear(p++)", "66"}, {"Spined boots", "36"}, {"Spined gloves", "17"}, {"Spined body", "45"}, {"Spined chaps", "21"}, {"Spined helm", "358"}, {"Rock-shell boots", "11"}, {"Rock-shell gloves", "28"}, {"Rock-shell helm", "209"}, {"Rock-shell legs", "486"}, {"Rock-shell plate", "397"}, {"Skeletal boots", "194"}, {"Skeletal bottoms", "238"}, {"Skeletal gloves", "432"}, {"Skeletal helm", "58"}, {"Skeletal top", "267"}, {"Archers ring", "5783"}, {"Berserker ring", "18367"}, {"Seer's ring", "599"}, {"Warrior ring", "1163"}, {"Toktz-xil-ul", "3"}, {"Toktz-ket-xil", "2108"}, {"Toktz-mej-tal", "1092"}, {"Toktz-xil-ak", "1231"}, {"Toktz-xil-ek", "739"}, {"Toktz-ket-em", "935"}, {"Tzhaar-ket-om", "1579"}, {"Obsidian cape", "1864"}, {"Berserker necklace", "1787"}, {"Granite maul", "1458"}, {"Granite body", "490"}, {"Granite helm", "274"}, {"Granite legs", "1999"}, {"Granite shield", "348"}, {"Amulet of defence", "7"}, {"Amulet of fury", "25823"}, {"Amulet of glory", "386"}, {"Amulet of glory(1)", "386"}, {"Amulet of glory(2)", "386"}, {"Amulet of glory(3)", "386"}, {"Amulet of glory(4)", "386"}, {"Amulet of glory(t)", "2090"}, {"Amulet of glory(t1)", "2090"}, {"Amulet of glory(t2)", "2090"}, {"Amulet of glory(t3)", "2090"}, {"Amulet of glory(t4)", "2090"}, {"Amulet glory(t2)", "2090"}, {"Amulet glory(t3)", "2090"}, {"Amulet glory(t4)", "2090"}, {"Amulet of magic", "5"}, {"Amulet of magic(t)", "1042"}, {"Amulet of power", "31"}, {"Amulet of strength", "15"}, {"3rd age amulet", "561623"}, {"Strength amulet(t)", "5439"}, {"Antipoison(1)", "1"}, {"Antipoison(2)", "3"}, {"Antipoison(3)", "4"}, {"Antipoison(4)", "5"}, {"Antipoison+(1)", "23"}, {"Antipoison+(2)", "45"}, {"Antipoison+(3)", "68"}, {"Antipoison+(4)", "90"}, {"Antipoison++(1)", "37"}, {"Antipoison++(2)", "74"}, {"Antipoison++(3)", "110"}, {"Antipoison++(4)", "147"}, {"Super attack(1)", "2"}, {"Super attack(2)", "4"}, {"Super attack(3)", "5"}, {"Super attack(4)", "7"}, {"Super strength(1)", "10"}, {"Super strength(2)", "20"}, {"Super strength(3)", "30"}, {"Super strength(4)", "40"}, {"Super defence(1)", "2"}, {"Super defence(2)", "4"}, {"Super defence(3)", "5"}, {"Super defence(4)", "8"}, {"Saradomin brew(1)", "7"}, {"Saradomin brew(2)", "15"}, {"Saradomin brew(3)", "22"}, {"Saradomin brew(4)", "29"}, {"Zamorak brew(1)", "12"}, {"Zamorak brew(2)", "24"}, {"Zamorak brew(3)", "36"}, {"Zamorak brew(4)", "48"}, {"Super restore(1)", "36"}, {"Super restore(2)", "72"}, {"Super restore(3)", "108"}, {"Super restore(4)", "144"}, {"Super antipoison(1)", "3"}, {"Super antipoison(2)", "6"}, {"Super antipoison(3)", "9"}, {"Super antipoison(4)", "11"}, {"Prayer potion(1)", "21"}, {"Prayer potion(2)", "42"}, {"Prayer potion(3)", "64"}, {"Prayer potion(4)", "85"}, {"3rd age mage hat", "40672"}, {"3rd age robe", "42061"}, {"3rd age robe top", "64426"}, {"3rd age full helmet", "55938"}, {"3rd age kiteshield", "84861"}, {"3rd age platebody", "84993"}, {"3rd age platelegs", "75609"}, {"3rd age range coif", "28814"}, {"3rd age range legs", "42202"}, {"Pottery statuette", "25014"}, {"Stone statuette", "25014"}, {"3rd age range top", "501644"}, {"Golden statuette", "13046"}, {"Imp statue", "25015"}, {"3rd age vambraces", "210575"}, {"Ahrim's hood", "608"}, {"Ahrim's robeskirt", "7747"}, {"Ahrim's robetop", "3582"}, {"Ahrim's staff", "511"}, {"Torag's hammers", "960"}, {"Torag's helm", "4919"}, {"Torag's platebody", "2196"}, {"Torag's platelegs", "3563"}, {"Karil's coif", "428"}, {"Karil's crossbow", "1265"}, {"Karil's leatherskirt", "2165"}, {"Karil's leathertop", "11627"}, {"Dharok's greataxe", "2181"}, {"Dharok's helm", "32601"}, {"Dharok's platebody", "2247"}, {"Dharok's platelegs", "3242"}, {"Verac's brassard", "2181"}, {"Verac's flail", "1592"}, {"Verac's helm", "19233"}, {"Verac's plateskirt", "5590"}, {"Guthan's chainskirt", "2090"}, {"Guthan's helm", "21675"}, {"Guthan's platebody", "2160"}, {"Guthan's warspear", "13720"}, {"Saradomin sword", "71022"}, {"Ava's accumulator", "113"}, {"Archer helm", "553"}, {"Berserker helm", "773"}, {"Farseer helm", "536"}, {"Helm of neitiznot", "521"}, {"Infinity boots", "8277"}, {"Infinity bottoms", "3089"}, {"Infinity gloves", "1957"}, {"Infinity hat", "6382"}, {"Infinity top", "4317"}, {"Master wand", "4265"}, {"Teacher wand", "432"}, {"Mage's book", "19198"}, {"Initiate cuisse", "47"}, {"Initiate hauberk", "59"}, {"Initiate sallet", "34"}, {"Proselyte cuisse", "61"}, {"Proselyte hauberk", "75"}, {"Proselyte sallet", "46"}, {"Proselyte tasset", "61"}, {"Bandos boots", "8567"}, {"Bandos chestplate", "137022"}, {"Bandos tassets", "119478"}, {"Armadyl chestplate", "110821"}, {"Large statues", "30085"}, {"Medium statues", "35086"}, {"Small statues", "5247"}, {"Guardian statue", "7500"}, {"Statuette", "53086"}, {"Armadyl helmet", "48086"}, {"Armadyl plateskirt", "119685"}, {"Black d'hide body", "80"}, {"Black d'hide chaps", "62"}, {"Black d'hide vamb", "25"}, {"Zamorak d'hide", "12302"}, {"Zamorak chaps", "1175"}, {"Zamorak bracers", "5754"}, {"Zamorak coif", "2072"}, {"Saradomin d'hide", "9908"}, {"Saradomin chaps", "1005"}, {"Saradomin bracers", "4112"}, {"Saradomin coif", "1172"}, {"Guthix chaps", "279"}, {"Guthix coif", "1044"}, {"Guthix dragonhide", "949"}, {"Guthix bracers", "138"}, {"Guthix cloak", "6229"}, {"Guthix crozier", "29"}, {"Guthix mitre", "972"}, {"Guthix mjolnir", "60"}, {"Guthix robe legs", "993"}, {"Guthix robe top", "1095"}, {"Guthix stole", "144"}, {"Zamorak cloak", "10332"}, {"Zamorak crozier", "54"}, {"Zamorak mitre", "1382"}, {"Zamorak mjolnir", "91"}, {"Zamorak robe legs", "1626"}, {"Zamorak robe top", "1967"}, {"Zamorak stole", "864"}, {"Saradomin cloak", "9206"}, {"Saradomin crozier", "51"}, {"Saradomin mitre", "1634"}, {"Saradomin mjolnir", "113"}, {"Saradomin robe legs", "1071"}, {"Saradomin robe top", "1242"}, {"Saradomin stole", "650"}, {"Dark bow", "7900"}, {"Blue partyhat", "3166068"}, {"Green partyhat", "971385"}, {"Purple partyhat", "833622"}, {"Red partyhat", "1173043"}, {"White partyhat", "1638634"}, {"Yellow partyhat", "928302"}, {"Blue h'ween mask", "123047"}, {"Green h'ween mask", "102486"}, {"Red h'ween mask", "166275"}, {"Scythe", "273844"}, {"Bunny ears", "170376"}, {"Easter egg", "46282"}, {"Pumpkin", "53056"}, {"Raw manta ray", "10"}, {"Shark", "8"}, {"Cooked karambwan", "6"}, {"Rune knife", "5"}, {"Rune knife(p)", "7"}, {"Rune knife(p+)", "8"}, {"Rune knife(p++)", "16"}, {"Attack cape(t)", "990"}, {"Attack cape(t)", "990"}, {"Attack hood", "10"}, {"Strength cape", "990"}, {"Strength cape(t)", "990"}, {"Strength hood", "10"}, {"Defence cape", "990"}, {"Defence cape(t)", "990"}, {"Defence hood", "10"}, {"Ranging cape", "990"}, {"Ranging cape(t)", "990"}, {"Ranging hood", "10"}, {"Prayer cape", "990"}, {"Prayer cape(t)", "990"}, {"Prayer hood", "10"}, {"Magic cape", "990"}, {"Magic cape(t)", "990"}, {"Magic hood", "10"}, {"Runecraft cape", "990"}, {"Runecraft cape(t)", "990"}, {"Runecrafting hood", "10"}, {"Hitpoints cape", "990"}, {"Hitpoints cape(t)", "990"}, {"Hitpoints hood", "10"}, {"Agility cape", "990"}, {"Agility cape(t)", "990"}, {"Agility hood", "10"}, {"Herblore cape", "990"}, {"Herblore cape(t)", "990"}, {"Herblore hood", "10"}, {"Thieving cape", "990"}, {"Thieving cape(t)", "990"}, {"Thieving hood", "10"}, {"Crafting cape", "990"}, {"Crafting cape(t)", "990"}, {"Crafting hood", "10"}, {"Fletching cape", "990"}, {"Fletching cape(t)", "990"}, {"Fletching hood", "10"}, {"Slayer cape", "990"}, {"Slayer cape(t)", "990"}, {"Slayer hood", "10"}, {"Construct. cape", "990"}, {"Construct. cape(t)", "990"}, {"Construct. hood", "10"}, {"Mining cape", "990"}, {"Mining cape(t)", "990"}, {"Mining hood", "10"}, {"Smithing cape", "990"}, {"Smithing cape(t)", "990"}, {"Smithing hood", "10"}, {"Fishing cape", "990"}, {"Fishing cape(t)", "990"}, {"Fishing hood", "10"}, {"Cooking cape", "990"}, {"Cooking cape(t)", "990"}, {"Cooking hood", "10"}, {"Firemaking cape", "990"}, {"Firemaking cape(t)", "990"}, {"Firemaking hood", "10"}, {"Woodcutting cape", "990"}, {"Woodcut. cape(t)", "990"}, {"Woodcutting hood", "10"}, {"Farming cape", "990"}, {"Farming cape(t)", "990"}, {"Farming hood", "10"}, {"Quest point cape", "990"}, {"Quest point hood", "10"}, {"Summoning cape", "990"}, {"Summoning cape(t)", "990"}, {"Summoning hood", "10"}, {"Robin hood hat", "20395"}, {"Ranger boots", "66372"}, {"Arcane spirit shield", "100536"}, {"Blessed spirit shield", "4138700"}, {"Spirit Terrorbird", "80"}, {"Divine spirit shield", "4439090"}, {"Elysian spirit shield", "4027272"}, {"Spectral spirit shield", "0"}, {"Holy elixir", "60000"}, {"Spirit shield", "626"}, {"Vesta's longsword", "0"}, {"Pack yack pouch", "10000"}, {"Spirit wolf pouch", "500"}};
- String[][] killPrices = {{"Void knight top", "20"}, {"Void knight robe", "20"}, {"Void knight mace", "5"}, {"Void knight gloves", "0"}, {"Void mage helm", "0"}, {"Void ranger helm", "10"}, {"Void melee helm", "10"}, {"Runner hat", "10"}, {"Healer hat", "10"}, {"Ranger hat", "10"}, {"Runner boots", "10"}, {"Penance gloves", "10"}, {"Penance skirt", "10"}, {"Fighter torso", "30"}, {"Fire cape", "40"}, {"Zuriel's staff", "20"}, {"Zuriel's hood", "20"}, {"Zuriel's robe bottom", "20"}, {"Zuriel's robe top", "20"}, {"Statius's platelegs", "20"}, {"Statius's platelegs", "26"}, {"Statius's platebody", "28"}, {"Statius's full helm", "29"}, {"Statius's warhammer", "45"}, {"Statius's platelegs", "45"}, {"Bandos tassets", "0"}, {"Vesta's chainbody", "50"}, {"Vesta's plateskirt", "50"}, {"Vesta's longsword", "150"}, {"Armadyl chestplate", "0"}, {"Armadyl plateskirt", "0"}, {"Armadyl helmet", "0"}, {"Morrigan's leather body", "20"}, {"Corrupt Zuriel's hood", "20"}, {"Corrupt Zuriel's robetop", "20"}, {"Corrupt Zuriel's robebottom", "20"}, {"Corrupt Zuriel's staff", "20"}, {"Corrupt Vesta's chainbody", "50"}, {"Corrupt Vesta's plateskirt", "50"}, {"Corrupt Statius's hammer", "20"}, {"Corrupt Statius's full helm", "20"}, {"Corrupt Statius's platebody", "20"}, {"Corrupt Statius's platelegs", "20"}, {"Morrigan's leather chaps", "20"}, {"Morrigan's coif", "20"}, {"Infinity boots", "0"}, {"Master wand", "0"}, {"Mage's book", "0"}, {"Amulet of fury", "0"}, {"Rune defender", "0"}, {"Adamant defender", "0"}, {"Mithril defender", "0"}};
- int[][] otherPrices = {{6572, 20000}, {4089, 203},{4090, 203}, {4091, 513}, {12007, 900}, {12008, 900}, {389, 10}, {383, 8}, {377, 3}, {371, 3}, {363, 2}, {335, 2}, {317, 2}, {331, 3}, {4092, 513},{4093, 313}, {4094, 313},{4095, 902},{4096, 902},{4097, 402},{4098, 402}, {12480, 100000}, {11286, 150000}, {1632, 2500}, {1624, 120}, {1622, 250}, {1620, 400}, {1618, 550}, {6571, 20000}, {12094, 50000}, {12093, 50000}, {12047, 500}, {12048, 500}, {1631, 2500}, {1623, 120}, {1621, 250}, {1619, 400}, {1617, 550}, {13742, 3816000}, {13743, 3816000}, {13736, 35000}, {13737, 35000}, {13740, 3816000}, {13741, 3816000}, {13738, 1168008}, {13739, 1168008}, {13734, 1000}, {13735, 1000}, {7456, 3}, {7457, 5}, {7458, 10}, {7459, 15}, {7460, 20}, {7461, 1000}, {7462, 1000}, {10551, 10000}};
- int[][] killRequirments = {{8844, 0}, {8845, 0}, {8846, 0}, {8847, 0}, {8848, 0}, {8849, 0}, {8850, 0}, {10887, 0}, {4214, 0}, {4225, 0}, {2412, 0}, {2413, 0}, {2414, 0}, {2415, 0}, {2416, 0}, {2417, 0}, {7453, 0}, {7454, 0}, {7455, 0}, {7456, 0}, {7457, 0}, {7458, 0}, {7459, 0}, {7460, 0}, {7461, 0}, {7462, 0}};
- 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 getXPForLevel(int level) {
- int points = 0;
- int output = 0;
- for (int lvl = 1; lvl <= level; lvl++) {
- points += Math.floor((double) lvl + 300.0 * Math.pow(2.0, (double) lvl / 7.0));
- if (lvl >= level) {
- return output;
- }
- output = (int) Math.floor(points / 4);
- }
- return 0;
- }
- 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 long getItemValue2(int item) {
- if (item == 995) {
- return 1;
- }
- int value = 0;
- long value2 = 0;
- for (String[] s : itemPrices) {
- String name = Engine.items.getItemName(item);
- if (name.equals(s[0])) {
- value = 100 * Integer.parseInt(s[1]);
- value2 = 100 * Integer.parseInt(s[1]);
- }
- }
- for (int[] i : otherPrices) {
- if (item == i[0]) {
- value = 100 * i[1];
- value2 = 100 * i[1];
- }
- }
- if (Engine.items.stackable(item) && value == 0) {
- value = 1;
- value2 = 1;
- }
- return value2;
- }
- public void message(String message) {
- getActionSender().sendMessage(this, message);
- }
- public void leverTeleport(String location) {
- if (teleblockTimer >= 0) {
- getActionSender().sendMessage(this, "You are teleport blocked!");
- return;
- }
- if (jailed > 0) {
- 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")) { //Changed To Edge
- x = 3090;//x = 2561;
- y = 3474;//y = 3311;
- }
- if (location.equals("Mage Bank (Inside)")) {
- x = 2539;
- y = 4712;
- }
- if (location.equals("Mage Bank (Outside)")) {
- x = 3090;
- y = 3956;
- h = 0;
- }
- if (location.equals("Mage Arena (Inside)")) {
- x = 3105;
- y = 3951;
- }
- if (location.equals("Mage Arena (Outside)")) {
- x = 3105;
- y = 3956;
- }
- }
- getActionSender().removeShownInterface(this);
- requestAnim(2140, 0);
- leverTeleportX = x;
- leverTeleportY = y;
- leverTeleportH = h;
- leverTeleportDelay = 2;
- lever = true;
- }
- public void teletab(String city) {
- int x = absX;
- int y = absY;
- int h = heightLevel;
- int r = 0;
- teletab = true;
- if (teleblockTimer >= 0) {
- getActionSender().sendMessage(this, "You are teleport blocked!");
- return;
- }
- if (getWildernessLevel2() >= 21) {
- getActionSender().sendMessage(this, "A magical force stops you from teleporting.");
- return;
- }
- if (city != null) {
- if (city.equals("Varrock")) {
- x = 3210;
- y = 3421;
- r = 4;
- }
- if (city.equals("Home")) {
- x = 3093;//p.setCoords(3222, 3219, 0);
- y = 3490;
- ;
- r = 0;
- }
- 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;
- }
- if (city.equals("WatchTower")) {
- x = 2547;
- y = 3112;
- r = 1;
- }
- }
- getActionSender().removeShownInterface(this);
- x += getRandom(r);
- y += getRandom(r);
- teletabTo(x, y, h, 3, 0, 9597, 4071, 1680, 0, 678, 0);
- }
- public void teletabTo(int x, int y, int height, int delay, int distance, int emoteStart, int emoteEnd, int gfxStart,
- int gfxStartH, int gfxEnd, int gfxEndH) {
- if (isDead) {
- return;
- }
- if (teleblockTimer >= 0) {
- getActionSender().sendMessage(this, "You are teleport blocked!");
- return;
- }
- if (jailed > 0) {
- getActionSender().sendMessage(this, "You are jailed!");
- 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;
- }
- 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 isPVP() {
- return heightLevel == 0;
- }
- public boolean DoorArea(int x, int y) {
- if ((x >= 2794 && x <= 2794 && y >= 5650 && y <= 5650) ||
- (x >= 2826 && x <= 2826 && y >= 5665 && y <= 5665) ||
- (x == 2843 && y == 5680) ||
- (x == 2851 && y == 5685) ||
- (x == 2860 && y == 5692) ||
- (x == 2862 && y == 5696) ||
- (x == 2866 && y == 5716) ||
- (x == 2864 && y == 5738) ||
- (x == 2861 && y == 5768) ||
- (x == 2851 && y == 5785) ||
- (x == 2850 && y == 5794) ||
- (x == 2815 && y == 5806) ||
- (x == 2773 && y == 5808) ||
- (x == 2757 && y == 5808) ||
- (x == 2737 && y == 5802) ||
- (x == 2843 && y == 5801) ||
- (x == 2726 && y == 5795) ||
- (x == 2707 && y == 5783) ||
- (x == 2702 && y == 5765) ||
- (x == 2705 && y == 5759) ||
- (x == 2740 && y == 5649) ||
- (x == 2752 && y == 5652) ||
- (x == 2772 && y == 5648) ||
- (x == 2703 && y == 5717) ||
- (x == 2702 && y == 5704) ||
- (x == 2707 && y == 5690) ||
- (x == 2703 && y == 5717) ||
- (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 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 >= 3201 && x <= 3201 && y >= 3204 && y <= 3233)) {
- return true;
- }
- return false;
- }
- public String getKillMessage(String player) {
- String[][] selection = {{"You just took a steamy shit on ", "'s forehead."},
- {"You cum in ", "'s eye."},
- {"Well done, you've slayed ", "."},
- {"You gwas all over ", "."},
- {"", "'s nan was clearly no match for you."},
- {"You wipe your ass with ", "."},
- {"Ooh, ", "'s nan just bent over and took it hard."},
- {"", " has fallen before your mighty penis."},
- {"", " is now your african slave."}};
- int index = (int)Math.floor(Math.random() * 9);
- return selection[index][0] + player + selection[index][1];
- }
- public boolean falseBh() {
- return absX >= 3071 && absX <= 3197 && absY >= 3668 && absY <= 3779;
- }
- public boolean falseBh1() {
- return absX >= 2650 && absX <= 2890 && absY >= 5640 && absY <= 5900;
- }
- 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 > 3667 && y < 3752) ||
- (x > 3203 && x < 3331 && y > 3519 && y < 3666) ||
- (x > 3134 && x < 3328 && y > 3519 && y < 3667) ||
- (x > 2945 && x < 2961 && y > 3812 && y < 3828) ||
- (x > 3145 && x < 3217 && y > 3904 && y < 3966) ||//Deserted Keep
- (x > 2982 && x < 3010 && y > 3913 && y < 3929) ||
- (x > 3203 && x < 3392 && y > 3904 && y < 4031) ||
- (x > 3149 && x < 3331 && y > 3799 && y < 3850) ||
- (x > 3064 && x < 3391 && y > 3864 && y < 3903) ||
- (x > 2497 && x < 2549 && y > 4680 && y < 4725) ||
- (x > 3265 && x < 3330 && y > 3710 && y < 3840) ||
- (x > 2923 && x < 2973 && y > 4359 && y < 4412) ||
- (x > 3006 && x < 3072 && y > 3601 && y < 3713)) {
- return true;
- }
- return false;
- }
- public boolean picklock() {
- return absX >= 3038 && absX <= 3044 && absY >= 3949 && absY <= 3959;
- }
- public boolean wildernessZone(int x, int y) {
- if (!isPVP()) {
- if ((x >= 3042 && x <= 3263 && y >= 3525 && y <= 3667) ||
- (x >= 3042 && x <= 3395 && y >= 3702 && y <= 4000) ||
- (x >= 3280 && x <= 3395 && y >= 3671 && y <= 4000) ||
- (x >= 3193 && x <= 3279 && y >= 3667 && y <= 3671) ||
- (x >= 3195 && x <= 3263 && y >= 3672 && y <= 4000) ||
- (x >= 3042 && x <= 3147 && y >= 3663 && y <= 4000) ||
- (x >= 3042 && x <= 3196 && y >= 3703 && y <= 4000) ||
- (x >= 3047 && x <= 3175 && y >= 3704 && y <= 4000) ||
- (x >= 3264 && x <= 3279 && y >= 3525 && y <= 3671) ||
- (x >= 3325 && x <= 33395 && y >= 3525 && y <= 4000) ||
- (x >= 3005 && x <= 3068 && y >= 10303 && y <= 10359) ||
- (x >= 3325 && x <= 3275 && y >= 3525 && y <= 3534) ||
- (x >= 3264 && x <= 3378 && y >= 3530 && y <= 3671) ||
- (x >= 2946 && x <= 3041 && y >= 3525 && y <= 4000) ||
- (x >= 2495 && x <= 2525 && y >= 4680 && y <= 4736)) {
- return true;
- }
- return false;
- }
- if (isPVP()) {
- if ((x >= 3091 && x <= 3098 && y >= 3488 && y <= 3499) ||
- (x >= 3135 && x <= 3192 && y >= 3668 && y <= 3702) ||
- (x >= 3179 && x <= 3194 && y >= 3432 && y <= 3446) ||
- (x >= 2526 && x <= 2551 && y >= 4709 && y <= 4726) ||
- (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 >= 2526 && x <= 2550 && y >= 4709 && y <= 4725) ||
- (x >= 3367 && x <= 3379 && y >= 3082 && y <= 3083) ||
- (x >= 3371 && x <= 3374 && y >= 3081 && y <= 3084) ||
- (x >= 2883 && x <= 2965 && y >= 4372 && y <= 4417) ||//corp
- (x >= 2806 && x <= 2812 && y >= 3438 && y <= 3445) ||//Catherby Bank
- (x >= 2609 && x <= 2616 && y >= 3088 && y <= 3097) ||//Yanille Bank
- (x >= 3265 && x <= 3272 && y >= 3161 && y <= 3173) ||//Al Karid Bank
- (x >= 3201 && x <= 3201 && y >= 3204 && y <= 3233)) {
- 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;
- }
- }
- return true;
- }
- return false;
- }
- public void Hello13(final Player p) {
- EventManager.getSingleton().addEvent(new Event() {
- public void execute(EventContainer c) {
- if (wildTimer > 0) {
- wildTimer--;
- getActionSender().setString(p, " Time left: "+wildTimer, 494, 2);
- }
- if (!p.Safezone(absX, absY)) {
- timerStarted2 = false;
- wildTimer = 0;
- int max = combatLevel + wildyLevel;
- if (max > 138)
- max = 138;
- 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().setString(p," "+range, 494, 2);
- c.stop();
- }
- if (wildTimer == 0 && p.Safezone(absX, absY)) {
- getActionSender().setString(p, "", 494, 2);
- c.stop();
- }
- }
- }, 1000);
- };
- 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 (level < 0 || absX < 2945) {
- level = 0;
- }
- if (level < 0 || absY > 4000 && absY < 8000) {
- level = 0;
- }
- if (level < 0 || absX > 3390) {
- level = 0;
- }
- if (!isPVP()) {
- //getActionSender().setPlayerOption(this, "Null", 1, true);
- 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 int getWildernessLevel2() {
- 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 (level < 0 || absX < 2945) {
- level = 0;
- }
- if (level < 0 || absY > 4000 && absY < 8000) {
- level = 0;
- }
- if (level < 0 || absX > 3390) {
- level = 0;
- }
- if (!isPVP()) {
- //getActionSender().setPlayerOption(this, "Null", 1, true);
- return level;
- }
- 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 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
- };
- /**
- * Summoning variables
- */
- public int summonTeleDelay = -1;
- public int summonDrainDelay = -1;
- public boolean callFamiliar;
- public boolean familiarDissMiss;
- public boolean summonedFamiliar;
- public int[] regularStaffs = {
- 1381
- };
- public int[] otherStaffs = {
- 4675
- };
- public int[] hugeNpcs = {
- 50, 1155, 1157, 1158, 1160, 2745, 6222, 6203
- };
- public int[] slayerType = {
- 1615, 5363, 55, 54, 941, 2783
- };
- public int[] slayerArray = {
- Misc.random(49)
- };
- 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 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 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 / 175;
- }
- 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 int[] strangeItems = {
- 6570
- };
- public int[] rangeBows = {
- 841, 843, 845, 847, 849, 851, 853,
- 855, 857, 859, 861,6724, 9174, 9176, 9177,
- 9179, 9181, 9183, 9185
- };
- public int[] rangeArrows = {
- 882, 884, 886, 888, 890, 892
- };
- public int[] godSwords = {
- 11694, 11696, 11698, 11700
- };
- 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;
- }
- }
- 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 void processTimers() { //Processes evenly at 1000 milliseconds
- if (freezeDelay > 0) {
- freezeDelay--;
- if (freezeDelay == 0) {
- immunityTimer = 2.5;
- freezeDelay = -1;
- }
- }
- if (immunityTimer > 0)
- immunityTimer--;
- if (vengeanceDelay > 0)
- vengeanceDelay--;
- if (spellbookSwap) {
- getActionSender().setTab(this, 79, spellbook);
- spellbookSwap = false;
- usedSpellbookSwap = false;
- }
- if (attackedByNpc != null) {
- count++;
- if (count == 4) {
- NPC n = Server.engine.npcs[attackNpc];
- if (n != null) {
- if (attackedByNpcCount >= 1)
- attackedByNpcCount = 0;
- attackedByNpc = null;
- n.underAttack = false;
- n.playerIndex = 0;
- count = 0;
- }
- }
- }
- if (attackedBy != null) {
- count++;
- if (count == 6) {
- NPC n = Server.engine.npcs[attackNpc];
- if (n != null) {
- if (attackedByNpc != null)
- attackedByNpc = null;
- if (n.playerIndex != 0)
- n.playerIndex = 0;
- }
- attacking = null;
- attackedBy = null;
- attackedByCount--;
- count = 0;
- }
- }
- if (cantPray > 0)
- cantPray--;
- if (stunned > 0)
- stunned--;
- if (logoutTimer > 0)
- logoutTimer--;
- if (restoreSpecialTimer > 0)
- restoreSpecialTimer--;
- }
- public int cantPray;
- public void attackPlayer() {
- PlayerCombat pc = new PlayerCombat(this);
- pc.attackPlayer();
- }
- private int getAttackingDistance() {
- return 7;
- }
- public void process() {
- if (alchDelay > 0) {
- alchDelay--;
- }
- if (teleblockTimer > 0)
- teleblockTimer--;
- if (teleblockTimer == 0) {
- teleblocked = false;
- teleblockTimer = -1;
- getActionSender().sendMessage(this, "The teleport block has worn off.");
- }
- if (justSwitched >= 0)
- justSwitched--;
- if (justSwitched == 0) {
- getActionSender().setItems(this, 387, 28, 94, equipment, equipmentN);
- calculateEquipmentBonus();
- setEquipmentBonus();
- }
- if (leverTeleportDelay > 0)
- leverTeleportDelay--;
- if (leverTeleportDelay == 0) {
- teleportTo(leverTeleportX, leverTeleportY, leverTeleportH, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
- lever = false;
- leverTeleportDelay--;
- }
- if (followingPlayer)
- Engine.playerFollow.followPlayer(this);
- if (magicGraphicDelay > 0) {
- magicGraphicDelay--;
- } else if (magicGraphicDelay == 0) {
- Player opp = Server.engine.players[magicOppIndex];
- PlayerMagic playerMagic = new PlayerMagic(this);
- playerMagic.appendGraphic(spellbook, spell);
- /*if (opp != null) {
- if (Misc.getDistance(absX, absY, opp.absX, opp.absY) > getAttackingDistance() - 1) {
- if (freezeDelay == 0) {
- if (opp.absX - absX > 7 && opp.absY - absY > 7) {
- playerWalk(absX + ((opp.absX - absX) - 7), absY + ((opp.absY - absY) - 7), 0, 0);
- } else if (opp.absX - absX > 7 && absY - opp.absY > 7) {
- playerWalk(absX + ((opp.absX - absX) - 7), absY - ((absY - opp.absY) - 7), 0, 0);
- } else if (absX - opp.absX > 7 && opp.absY - absY > 7) {
- playerWalk(absX - ((absX - opp.absX) - 7), absY + ((opp.absY - absY) - 7), 0, 0);
- } else if (absX - opp.absX > 7 && absY - opp.absY > 7) {
- playerWalk(absX - ((absX - opp.absX) - 7), absY - ((absY - opp.absY) - 7), 0, 0);
- } else if (opp.absX - absX > 7) {
- playerWalk(absX + ((opp.absX - absX) - 7), absY, 0, 0);
- } else if (absX - opp.absX > 7) {
- playerWalk(absX - ((absX - opp.absX) - 7), absY, 0, 0);
- } else if (opp.absY - absY > 7) {
- playerWalk(absX, absY + ((opp.absY - absY) - 7), 0, 0);
- } else if (absY - opp.absY > 7) {
- playerWalk(absX, absY - ((absY - opp.absY) - 7), 0, 0);
- }
- }
- }
- }*/
- magicGraphicDelay--;
- }
- if (magicDamageDelay > 0) {
- magicDamageDelay--;
- } else if (magicDamageDelay == 0) {
- Player opp = Server.engine.players[magicOppIndex];
- PlayerMagic playerMagic = new PlayerMagic(this);
- playerMagic.appendDamage(spellbook, spell);
- /*if (opp != null) {
- if (Misc.getDistance(absX, absY, opp.absX, opp.absY) > getAttackingDistance() - 1) {
- if (freezeDelay == 0) {
- if (opp.absX - absX > 7 && opp.absY - absY > 7) {
- playerWalk(absX + ((opp.absX - absX) - 7), absY + ((opp.absY - absY) - 7), 0, 0);
- } else if (opp.absX - absX > 7 && absY - opp.absY > 7) {
- playerWalk(absX + ((opp.absX - absX) - 7), absY - ((absY - opp.absY) - 7), 0, 0);
- } else if (absX - opp.absX > 7 && opp.absY - absY > 7) {
- playerWalk(absX - ((absX - opp.absX) - 7), absY + ((opp.absY - absY) - 7), 0, 0);
- } else if (absX - opp.absX > 7 && absY - opp.absY > 7) {
- playerWalk(absX - ((absX - opp.absX) - 7), absY - ((absY - opp.absY) - 7), 0, 0);
- } else if (opp.absX - absX > 7) {
- playerWalk(absX + ((opp.absX - absX) - 7), absY, 0, 0);
- } else if (absX - opp.absX > 7) {
- playerWalk(absX - ((absX - opp.absX) - 7), absY, 0, 0);
- } else if (opp.absY - absY > 7) {
- playerWalk(absX, absY + ((opp.absY - absY) - 7), 0, 0);
- } else if (absY - opp.absY > 7) {
- playerWalk(absX, absY - ((absY - opp.absY) - 7), 0, 0);
- }
- } else {
- return;
- }
- }
- }*/
- magicDamageDelay--;
- }
- if (magicAffectDelay > 0) {
- magicAffectDelay--;
- } else if (magicAffectDelay == 0) {
- Player opp = Server.engine.players[magicOppIndex];
- PlayerMagic playerMagic = new PlayerMagic(this);
- playerMagic.appendAffect(spellbook, spell);
- /*if (opp != null) {
- if (Misc.getDistance(absX, absY, opp.absX, opp.absY) > getAttackingDistance() - 1) {
- if (freezeDelay == 0) {
- if (opp.absX - absX > 7 && opp.absY - absY > 7) {
- playerWalk(absX + ((opp.absX - absX) - 7), absY + ((opp.absY - absY) - 7), 0, 0);
- } else if (opp.absX - absX > 7 && absY - opp.absY > 7) {
- playerWalk(absX + ((opp.absX - absX) - 7), absY - ((absY - opp.absY) - 7), 0, 0);
- } else if (absX - opp.absX > 7 && opp.absY - absY > 7) {
- playerWalk(absX - ((absX - opp.absX) - 7), absY + ((opp.absY - absY) - 7), 0, 0);
- } else if (absX - opp.absX > 7 && absY - opp.absY > 7) {
- playerWalk(absX - ((absX - opp.absX) - 7), absY - ((absY - opp.absY) - 7), 0, 0);
- } else if (opp.absX - absX > 7) {
- playerWalk(absX + ((opp.absX - absX) - 7), absY, 0, 0);
- } else if (absX - opp.absX > 7) {
- playerWalk(absX - ((absX - opp.absX) - 7), absY, 0, 0);
- } else if (opp.absY - absY > 7) {
- playerWalk(absX, absY + ((opp.absY - absY) - 7), 0, 0);
- } else if (absY - opp.absY > 7) {
- playerWalk(absX, absY - ((absY - opp.absY) - 7), 0, 0);
- }
- } else {
- return;
- }
- }
- }*/
- magicAffectDelay--;
- }
- if (cuedSpells > 0 && combatDelay == 0) {
- try {
- Player opp = Server.engine.players[magicOppIndex];
- PlayerMagic playerMagic = new PlayerMagic(this);
- playerMagic.combatMagic(opp, spellbook, cuedSpell);
- /*if (opp != null) {
- if (Misc.getDistance(absX, absY, opp.absX, opp.absY) > getAttackingDistance() - 1) {
- if (freezeDelay == 0) {
- if (opp.absX - absX > 7 && opp.absY - absY > 7) {
- playerWalk(absX + ((opp.absX - absX) - 7), absY + ((opp.absY - absY) - 7), 0, 0);
- } else if (opp.absX - absX > 7 && absY - opp.absY > 7) {
- playerWalk(absX + ((opp.absX - absX) - 7), absY - ((absY - opp.absY) - 7), 0, 0);
- } else if (absX - opp.absX > 7 && opp.absY - absY > 7) {
- playerWalk(absX - ((absX - opp.absX) - 7), absY + ((opp.absY - absY) - 7), 0, 0);
- } else if (absX - opp.absX > 7 && absY - opp.absY > 7) {
- playerWalk(absX - ((absX - opp.absX) - 7), absY - ((absY - opp.absY) - 7), 0, 0);
- } else if (opp.absX - absX > 7) {
- playerWalk(absX + ((opp.absX - absX) - 7), absY, 0, 0);
- } else if (absX - opp.absX > 7) {
- playerWalk(absX - ((absX - opp.absX) - 7), absY, 0, 0);
- } else if (opp.absY - absY > 7) {
- playerWalk(absX, absY + ((opp.absY - absY) - 7), 0, 0);
- } else if (absY - opp.absY > 7) {
- playerWalk(absX, absY - ((absY - opp.absY) - 7), 0, 0);
- }
- } else {
- return;
- }
- }
- }*/
- 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();
- }
- }
- if (disconnected[0] && !disconnected[1] && attackedBy != null) {
- logoutTimer = 9999;
- }
- if (disconnected[0] && !disconnected[1] && (isDead || attackedBy == null && logoutTimer > 15)) {
- logoutTimer = 15;
- }
- if (disconnected[0] && (usedLogout || logoutTimer == 0)) {
- try {
- if (heightLevel != 0) heightLevel = heightLevel;
- Engine.fileManager.saveCharacter(this);
- } catch (Exception e) {
- }
- disconnected[1] = true;
- }
- if (deathEmoteDelay > 0) {
- deathEmoteDelay--;
- }
- if (deathEmoteDelay == 0) {
- requestAnim(9055, 0); //836, 2261
- 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(getLevelForXP(5) * 0.25)), 0);
- }
- }
- } catch (Exception e) {
- }
- } else {
- try {
- Server.engine.players[hitIndex].append1Hit(getRandom((int)Math.floor(getLevelForXP(5) * 0.25)), 0);
- } catch (Exception e) {
- }
- }
- }
- isDead = true;
- deathDelay = 4;
- deathEmoteDelay = -1;
- }
- if (clickDelay > 0) {
- clickDelay--;
- }
- if (teleDelay > 0) {
- teleDelay--;
- }
- if (equipSpecDelay > 0) {
- equipSpecDelay--;
- }
- 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 (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 (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 (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 (waitDeathDelay > 0) {
- waitDeathDelay--;
- }
- if (deathDelay > 0) {
- deathDelay--;
- }
- 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 (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);
- loadStaticObjects();
- if (teleFinishAnim != -1) {
- requestAnim(teleFinishAnim, 0);
- }
- if (teleFinishGFX != -1) {
- requestGFX(teleFinishGFX, teleFinishGFXHeight);
- }
- }
- if (!teletab) {
- teleX = teleY = -1;
- }
- teletab = false;
- }
- if (clickDelay == 0) {
- clickDelay = -1;
- Engine.items.saveItems(this);
- //loadStaticObjects();
- }
- }
- public void potion(int potionID) {
- int root = 0;
- int toAdd = 0;
- int i = 0;
- switch (potionID) {
- 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 2446:
- case 175:
- case 177:
- case 179:
- Engine.poison.startPoison(this, 0);
- 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 = 4;
- eatDelay = 3;
- drinkDelay = 2;
- }
- private int multi;
- private int savedEP = -1;
- private int savedEP2 = -1;
- public void appendWilderness() {
- wildyLevel = getWildernessLevel();
- if (savedLevel != wildyLevel) {
- savedLevel = wildyLevel;
- if (wildyLevel > 0) {
- addWilderness();
- } else {
- savedEP = -1;
- removeWilderness();
- }
- }
- if (!wildernessZone(absX, absY) && (savedEP == -1 || savedEP2 != EPAmount)) {
- getActionSender().setOverlay(this, 494);
- if (EPAmount >= 0 && EPAmount <= 20)
- getActionSender().setString(this, "<col=8B0000>EP: "+EPAmount+"<col=8B0000>%",494,1);
- if (EPAmount >= 21 && EPAmount <= 40)
- getActionSender().setString(this, "<col=FF4500>EP: "+EPAmount+"<col=FF4500>%",494,1);
- if (EPAmount >= 41 && EPAmount <= 60)
- getActionSender().setString(this, "<col=FFFF00>EP: "+EPAmount+"<col=FFFF00>%",494,1);
- if (EPAmount >= 61 && EPAmount <= 80)
- getActionSender().setString(this, "<col=9ACD32>EP: "+EPAmount+"<col=9ACD32>%",494,1);
- if (EPAmount >= 81 && EPAmount <= 100)
- getActionSender().setString(this, "<col=00FF00>EP: "+EPAmount+"<col=00FF00>%",494,1);
- getActionSender().setString(this, "", 494, 0);
- getActionSender().setString(this,"", 494, 2);
- savedEP = 0;
- savedEP2 = EPAmount;
- if (EPAmount > 100)
- EPAmount = 100;
- }
- if (multiwayCombatZone(absX, absY) && multi == 0) {
- getActionSender().setInterfaceConfig(this, 745, 1, false);
- multi = 1;
- }
- if (!multiwayCombatZone(absX, absY) && multi == 1) {
- getActionSender().setInterfaceConfig(this, 745, 1, true);
- multi = 0;
- }
- }
- public void food(int foodID) {
- int healAmount = 0;
- int toDelayCombat = 6;
- int toDelayEat = 3;
- switch (foodID) {
- 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;
- case 10476:
- healAmount = 1 + Misc.random(2);
- runEnergy += runEnergy * .10;
- runEnergyUpdateReq = true;
- if (runEnergy + (runEnergy * .10) > 100) {
- runEnergy = 100;
- }
- 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 boolean receivesPVPDrop(Player p, Player opp) {
- if (Server.socketListener.getAddress(p.socket.socket).equals(Server.socketListener.getAddress(opp.socket.socket))) {
- return false;
- }
- return true;
- }
- public void appendDeath() {
- if (deathDelay == 0 && isDead) {
- Player opp = Server.engine.players[hitIndex];
- String killer = getDealtDamage().getKiller();
- try {
- if (rights < 4) {
- dropStuff(opp.username);
- }
- getActionSender().sendMessage(opp, "You have defeated " +username+".");
- if (receivesPVPDrop(this, opp)) {
- opp.kills++;
- opp.totalKills++;
- opp.bhkills++;
- DC++;
- opp.KC++;
- }
- } 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);
- }
- attackNpc = 0;
- attackedInSingle = 0;
- attacking = null;
- attackedBy = null;
- oppIndex = 0;
- hitIndex = 0;
- resetAttack();
- setCoords(3093, 3490, 0);
- Engine.poison.startPoison(this, 0);
- getActionSender().sendMessage(this, "Oh dear, you have died.");
- magicGraphicDelay = -1;
- magicDamageDelay = -1;
- teleblockTimer = -1;
- deathDelay = -1;
- isDead = false;
- initialAttack = false;
- isSkulled = false;
- resetPrayer();
- headIconSkull = -1;
- skullVanishDelay = 0;
- specAmount = 1000;
- getActionSender().setConfig2(this, 300, 1000);
- 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;
- }
- }
- }
- }
- }
- }
- public void calculateIKOD() {
- 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 = (int)Math.round(1.10 * (1 * getItemValue(allItems[j])));
- 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 < keptItems.length; i++) {
- ikod[i] = keptItems[i];
- if (ikod[i] == 0) ikod[i] = 6564;
- }
- }
- /**
- * 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().setString(this, "Bank of Reborn 525" , 762, 24);
- 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 (isDead) {
- return;
- }
- if (teleblockTimer >= 0) {
- getActionSender().sendMessage(this, "You are teleport blocked!");
- return;
- }
- if (jailed > 0) {
- getActionSender().sendMessage(this, "You are jailed!");
- return;
- }
- if (getWildernessLevel() >= 21) {
- }
- 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;
- loadStaticObjects();
- }
- /**
- *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 client : Engine.players) {
- if(client == null) continue;
- if(client.friends.contains(me)) {
- client.getActionSender().sendFriend(client, me, 66);
- }
- }
- }
- public int getWorld(long friend) {
- for(Player client : Engine.players) {
- if(client != null && client.online) {
- if(Misc.stringToLong(client.username) == friend) {
- return 66;
- }
- }
- }
- return 0;
- }
- /**
- * 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;
- }
- 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 int vengDelay;
- public int damagez;
- 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];
- damagez = skillLvl[3];
- }
- damagez = damage;
- if (opp.equipment[5] == 13742) {//Elysian Effect
- if (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);
- }
- 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 * 133), 3);
- break;
- }
- for (int i : skill) {
- if (i != -1) {
- opp.appendExperience((damage * 133), i);
- }
- }
- opp.appendExperience((damage * 133), 3);
- }
- if (opp.equipment[3] == 5698)
- Engine.poison.checkForPoison(opp, this);
- opp.getDealtDamage().appendDamage(username,damage);
- if (opp.usingPrayer(24) && poison == 0) { //Smite
- if (skillLvl[5] - (int)Math.round(damage * 0.25) > 0) {
- skillLvl[5] -= (int)Math.round(damage / 4);
- getActionSender().setSkillLvl(this, 5);
- } else {
- skillLvl[5] = 0;
- getActionSender().setSkillLvl(this, 5);
- }
- }
- if (vengeance && poison == 0) { //Vengeance
- if (damage > 0) {
- //vengUpdate(this);
- long vengDelay = System.currentTimeMillis();
- if (System.currentTimeMillis() - vengDelay >= 600) {
- if (skillLvl[3] > 0) {
- opp.append1Hit(((int)Math.floor(damagez * 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;
- }
- }
- public void vengUpdate(final Player p) {
- EventManager.getSingleton().addEvent(new Event() {
- public void execute(EventContainer c) {
- Player opp = Server.engine.players[hitIndex];
- if (p == null || !p.online || opp == null || !opp.online) {
- c.stop();
- return;
- }
- if (skillLvl[3] > 0) {
- opp.append1Hit(((int)Math.floor(damagez * 0.75)), 0);
- } else {
- opp.append1Hit(0, 0);
- }
- c.stop();
- }
- }, 600);
- };
- public int EPUpdating;
- public int EPUpdates;
- public void EPUpdate(final Player p) {
- EventManager.getSingleton().addEvent(
- new Event() {
- public void execute(EventContainer c) {
- if (p == null || !p.online) {
- c.stop();
- return;
- }
- EPUpdating++;
- if (EPAmount > 100)
- EPAmount = 100;
- if (EPUpdating == 10) {
- EPAmount += 25;
- if (EPAmount > 100)
- EPAmount = 100;
- EPUpdating = 0;
- }
- if (!wildernessZone(absX, absY)) {
- EPUpdates = 0;
- c.stop();
- }
- }
- }, 60000);
- };
- public void append1Hit(int damage, int poison) {
- if (damage > skillLvl[3]) {
- damage = skillLvl[3];
- damagez = skillLvl[3];
- }
- updateHP(damage, false);
- if (!hit1UpdateReq) {
- hitDiff1 = damage;
- damagez = damage;
- poisonHit1 = poison;
- hit1UpdateReq = true;
- } else {
- hitDiff2 = damage;
- damagez = 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;
- }
- 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 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 int calculateMeleeDefence() {
- int defenceLevel = skillLvl[1];
- int i = equipmentBonus[bestMeleeDef()];
- if (usingPrayer(0))
- defenceLevel += getLevelForXP(1) * 0.05;
- if (usingPrayer(5))
- defenceLevel += getLevelForXP(1) * 0.1;
- if (usingPrayer(13))
- defenceLevel += getLevelForXP(1) * 0.15;
- if (usingPrayer(25))
- defenceLevel += getLevelForXP(1) * 0.2;
- if (usingPrayer(26)) {
- defenceLevel += getLevelForXP(1) * 0.25;
- }
- return (int)(defenceLevel + (defenceLevel * 0.15) + (i + i * 0.05));
- }
- public int bestMeleeDef() {
- if(equipmentBonus[5] > equipmentBonus[6] && equipmentBonus[5] > equipmentBonus[7])
- return 5;
- if(equipmentBonus[6] > equipmentBonus[5] && equipmentBonus[6] > equipmentBonus[7])
- return 6;
- return equipmentBonus[7] <= equipmentBonus[5] || equipmentBonus[7] <= equipmentBonus[6] ? 5 : 7;
- }
- 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 int mageDefence() {
- int defence = skillLvl[1]/2 + skillLvl[6]/2;
- if (usingPrayer(0))
- defence += skillLvl[1] * 0.05;
- if (usingPrayer(5))
- defence += skillLvl[1] * 0.10;
- if (usingPrayer(13))
- defence += skillLvl[1] * 0.15;
- if (usingPrayer(25))
- defence += skillLvl[1] * 0.20;
- if (usingPrayer(26))
- defence += skillLvl[1] * 0.25;
- return (int) (defence + equipmentBonus[8] + (equipmentBonus[8] / 3));
- }
- 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 == 6724) {
- 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 == 4214 || bow == 868 || bow == 11230 || bow == 13879 || bow == 13883) {
- return true;
- }
- if (bow == 9185) {
- switch (arrows) {
- case 9243:
- case 9244: 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 DamageDealt damageDealt = new DamageDealt();
- public DamageDealt getDealtDamage(){
- return damageDealt;
- }
- private void resetDealtDamage(){
- getDealtDamage().dealtDamage.clear();
- }
- 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, "Congratulations, you have just advanced a new Attack level!");
- break;
- case 1:
- getActionSender().sendMessage(this, "Congratulations, you have just advanced a new Defence level!");
- break;
- case 2:
- getActionSender().sendMessage(this, "Congratulations, you have just advanced a new Strength level!");
- break;
- case 3:
- getActionSender().sendMessage(this, "Congratulations, you have just advanced a new hitpoints level!");
- break;
- case 4:
- getActionSender().sendMessage(this, "Congratulations, you have just advanced a new Ranged level!");
- break;
- case 5:
- getActionSender().sendMessage(this, "Congratulations, you have just advanced a new Prayer level!");
- break;
- case 6:
- getActionSender().sendMessage(this, "Congratulations, you have just advanced a new Magic level!");
- break;
- case 7:
- getActionSender().sendMessage(this, "Congratulations, you have just advanced a new Cooking level!");
- break;
- case 8:
- getActionSender().sendMessage(this, "Congratulations, you have just advanced a new Woodcutting level!");
- break;
- case 16:
- getActionSender().sendMessage(this, "Congratulations, you have just advanced a new Agility level!");
- break;
- case 17:
- getActionSender().sendMessage(this, "Congratulations, you have just advanced a new Thieving level!");
- break;
- case 18:
- getActionSender().sendMessage(this, "Congratulations, you have just advanced a new Slayer level!");
- break;
- case 19:
- getActionSender().sendMessage(this, "Congratulations, you have just advanced a new Farming level!");
- break;
- case 20:
- getActionSender().sendMessage(this, "Congratulations, 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 int packetSize;
- public void playerWalk(int x, int y, int emote, int delay) {
- Engine.playerMovement.resetWalkingQueue(this);
- int numPath = (packetSize - 5) / 2;
- numPath = 100;
- int[] pathX = new int[numPath];
- int[] pathY = new int[numPath];
- int firstX = x - (mapRegionX - 6) * 8;
- int firstY = y - (mapRegionY - 6) * 8;
- stream.readSignedByteC();
- for (int i = 0; i < numPath; i++) {
- pathX[i] = stream.readSignedByte();//stream.readSignedByte()
- pathY[i] = stream.readSignedByteS();;//stream.readSignedByteS();
- }
- Engine.playerMovement.addToWalkingQueue(this, firstX, firstY);
- for (int i = 0; i < numPath; i++) {
- pathX[i] += firstX;
- pathY[i] += firstY;
- }
- appearanceUpdateReq = true;
- updateReq = true;
- //Engine.playerMovement.addToWalkingQueue(this, firstX, firstY);
- }
- public void WalkingTo(int i, int j) {
- int k = i - (mapRegionX - 6) * 8;
- int l = j - (mapRegionY - 6) * 8;
- Engine.playerMovement.resetWalkingQueue(this);
- Engine.playerMovement.addToWalkingQueue(this, k, l);
- appearanceUpdateReq = true;
- updateReq = true;
- }
- public boolean inWilderness() {
- return absX >= 3136 && absX <= 3350 && absY >= 3523 && absY <= 3597;
- }
- /**
- * 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 inPkArena() {
- return pkArenaPart1() && 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]);
- }
- }
- }
- }
- 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;
- }
- public void keptItems(Player p) {
- 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;
- }
- }
- p.getActionSender().showInterface(p, 255);
- for (int i : toAdd) {
- getActionSender(). setString(p, "LOL" +i, 255, 3);
- getActionSender(). setString(p, "LOL" +i, 255, 4);
- getActionSender(). setString(p, "LOL" +i, 255, 5);
- getActionSender(). setString(p, "LOL" +i, 255, 6);
- }
- }
- private int worthStuff;
- 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];
- int[] dropAllowed = {385,391,7060,2440,158,158,159,160,161,162,2436,145,146,147, 148,149,150,6685,6686,
- 6587,6888,6689,6690,6692,3024,3026,3028,3030,2444,169,170,171,172,173,174,2434,
- 139,140,141,142,143,144}
- 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;
- }
- }
- worthStuff = priceCheck();
- for(int i = 0; i < items.length; i++) {
- if (items[i] > 0) {
- if (!arrayContains(keptItems, items[i])) {
- if (Engine.items.isUntradable((items[i]))) {
- Engine.items.createGroundItem(items[i], itemsN[i], absX, absY, heightLevel, username);
- Engine.playerItems.deleteItem(this, items[i], Engine.playerItems.getItemSlot(this, items[i]), itemsN[i]);
- } else {
- for (int b = 0; b < dropAllowed.length; b++) {
- if (dropAllowed[b] == items[i]) {
- 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] != 13290) {
- Engine.items.createGroundItem(items[0], itemsN[0], absX, absY, heightLevel, username);
- }
- 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);
- worthStuff -= getItemValue(i);
- }
- }
- int[] lostItems = allItems;
- if (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 double PVPPotential;
- 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;
- }
- void PVPDrop(String player, int[] lostItems) {
- Player dropFor = Server.engine.players[Server.engine.getIdFromName(player)];
- try {
- int[] newest = {4716, 4722, 4718, 4720, 4708, 4710, 4712, 4714, 4745, 4747, 4749, 4751, 4736, 4738};
- int[] broken = {4884, 4902, 4890, 4896, 4860, 4866, 4872, 4878, 4956, 4962, 4968, 4974, 4944, 4950};
- for (int x = 0; x < newest.length; x++) {
- if (x == newest[x])
- x = broken[x];
- }
- Engine.items.createGroundItem(526, 1, absX, absY, heightLevel, player);
- 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 (i == 0 || Engine.items.isUntradable(i)) {
- continue;
- }
- if (dropFor.priceCheck() > 76000 && worthStuff > 76000) {
- if (dropFor.EPAmount >= 20 && dropFor.EPAmount <= 40) {
- if (Misc.random(5) == 1) {
- for (int x = 0; x < newest.length; x++) {
- if (i == newest[x])
- i = broken[x];
- }
- Engine.items.createGroundItem(i, 1, absX, absY, heightLevel, player);
- }
- }
- if (dropFor.EPAmount >= 41 && dropFor.EPAmount <= 60) {
- if (Misc.random(3) == 1) {
- for (int x = 0; x < newest.length; x++) {
- if (i == newest[x])
- i = broken[x];
- }
- Engine.items.createGroundItem(i, 1, absX, absY, heightLevel, player);
- }
- }
- if (dropFor.EPAmount >= 61 && dropFor.EPAmount <= 80) {
- if (Misc.random(2) == 1) {
- for (int x = 0; x < newest.length; x++) {
- if (i == newest[x])
- i = broken[x];
- }
- Engine.items.createGroundItem(i, 1, absX, absY, heightLevel, player);
- }
- }
- if (dropFor.EPAmount >= 81 && dropFor.EPAmount <= 100) {
- if (Misc.random(1) == 1) {
- for (int x = 0; x < newest.length; x++) {
- if (i == newest[x])
- i = broken[x];
- }
- Engine.items.createGroundItem(i, 1, absX, absY, heightLevel, player);
- }
- }
- }
- }
- if (dropFor.priceCheck() > 76000 && worthStuff > 76000) {
- if (dropFor.EPAmount >= 20 && dropFor.EPAmount <= 40) {
- dropFor.EPAmount -= Misc.random(28);
- if (dropFor.EPAmount < 0)
- dropFor.EPAmount = 0;
- }
- if (dropFor.EPAmount >= 41 && dropFor.EPAmount <= 60) {
- dropFor.EPAmount -= Misc.random(35);
- if (dropFor.EPAmount < 0)
- dropFor.EPAmount = 0;
- }
- if (dropFor.EPAmount >= 61 && dropFor.EPAmount <= 80) {
- dropFor.EPAmount -= Misc.random(55);
- if (dropFor.EPAmount < 0)
- dropFor.EPAmount = 0;
- }
- if (dropFor.EPAmount >= 81 && dropFor.EPAmount <= 100) {
- dropFor.EPAmount -= Misc.random(73);
- if (dropFor.EPAmount < 0)
- dropFor.EPAmount = 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.25) {
- randomDrops++;
- }
- }
- }
- int[] potentialDrops = {7060,1127,1079,4587,4151,4153,1712,3105,11732,9036,3486,3749,3751,3753,3755,4884,4908,4956,4753,5574,9038,6128,6131,6137,10350,10589,10606,10828,11200,11335,1073,1079,1091,1093,1123,1127,2599,2601,2607,2609,2615,2617,2623,2625,2653,2655,2661,2669,2671,3474,3476,3480,3481,3483,3485,3670,3476,3674,3676,4087,4585,4720,4722,4920,4968,4974,4759,5575,5576,6129,6617,10346,10348,11720,11722,11724,1199,1201,2603,2611,2621,2629,2659,2667,2675,3488,10352,11726,11728,11730,11720,11718,11694,11696,11698,11700,11283,1187,1215,1231,1249,1263,1305,1377,1434,3101,3140,3204,4087,3587,5680,5698,6739,7158,9244,11212,11217,4618,6785,6888,11227,11228,11229,11230,11231,11233,11234,11732,4091,4093,4095,4097,4099,4101,4103,4105,4107,4109,4111,4113,4115,4117,6916,6918,6920,6922,6924,4860,4866,4878,4872,4755,4757,4914,4926,4962,4732,4734,4735,4950,4740,4890,2491,2497,2503,10370,10386,6764,10368,10372,10374,10444,10450,10456,10460,10468,10474,10786,2663,3479,4151,6762,10384,10386,10388,10390,10440,10446,10452,10458,10464,10470,10784,6760,10376,10378,10380,9034,10382,10442,10448,1454,10462,10466,10472,9672,9674,9676,9678,3122,4153,8082,8083,8084,6809,10564,10330,10332,10334,10336,10338,10340,10342,10344,6731,6733,6735,6737,9185,1704,1706,1708,1710,1712,1725,1727,1729,1731,6585,10354,10356,10358,10360,10362,10364,10366,10719,10736,10738,6889,4129,4131,2579,6914,6912,139,141,143,169,171,173,175,177,179,2430,2442,2444,3040,3042,3044,3046,145,147,149,157,159,161,163,165,167,181,183,185,2436,2440,2448,3024,3026,3028,3030,6568,6524,6526,6523,6525,6522,6527,6528,11126,11124,11122,11120,11118,11133}; //PVP Drops
- int[] junkK = {325,1145,361,325,325,555,554,556,1725,1891,1891,1891};
- for (int i = 0; i < randomDrops; i++) {
- int item = potentialDrops[(int)Math.floor(Math.random() * potentialDrops.length)];
- int junk = junkK[(int)Math.floor(Math.random() * junkK.length)];
- chance = getPVPDropPercentage(item, totalValue(lostItems), dropFor.PVPPotential);
- if (dropFor.priceCheck() > 76000 && worthStuff > 76000) {
- if (Math.random() <= chance) {
- Engine.items.createGroundItem(item, 1, absX, absY, heightLevel, player);
- dropFor.PVPPotential -= ((1.00 - chance) / 10);
- PVPPotential += ((1.00 - chance) / 10);
- } else {
- dropFor.PVPPotential += ((1.00 - chance) / 10);
- }
- } else {
- Engine.items.createGroundItem(junk, 1, absX, absY, heightLevel, player);
- }
- }
- worthStuff = 0;
- } 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;
- }
- private int priceCheck() {
- int priceCheck = -1;
- for (int i = 0; i < equipment.length; i++) {
- priceCheck += getItemValue(equipment[i]) * equipmentN[i];
- }
- for (int i = 0; i < items.length; i++) {
- priceCheck += getItemValue(items[i]) * itemsN[i];
- }
- return priceCheck;
- }
- public int EPAmount;
- 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 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 removeWilderness() {
- getActionSender().setPlayerOption(this, "Null", 1, true);
- getActionSender().setInterfaceConfig(this, 745, 6, true);
- getActionSender().setInterfaceConfig(this, 745, 3, false);
- }
- public void addWilderness() {
- getActionSender().setPlayerOption(this, "Attack", 1, true);
- if (wildernessZone(absX, absY)) {
- }
- if (isPVP()) {
- 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().setString(this,""+range, 494, 2);
- }
- }
- public int wildernessLevels(int coordY) {
- wildyLevel = (coordY - 3254 / 7);
- if (wildyLevel < 1)
- wildyLevel = 1;
- return wildyLevel;
- }
- public boolean inEdge() {
- return absX >= 3040 && absX <= 3125 && absY >= 3523 && absY <= 3551;
- }
- public boolean fullDharok() {
- return equipment[3] == 4718 && equipment[4] == 4720 && equipment[7] == 4722 && equipment[0] == 4716;
- }
- public boolean fullVerac() {
- return equipment[3] == 4755 && equipment[4] == 4757 && equipment[7] == 4759 && equipment[0] == 4753;
- }
- public boolean hasGuthanEquipment() {
- return equipment[3] == 4726 && equipment[4] == 4728 && equipment[7] == 4730 && equipment[0] == 4724;
- }
- 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 godWarsDung() {
- return absX >= 2819 && absX <= 2946 && absY >= 5254 && absY <= 5362;
- }
- public boolean inJadCave() {
- return absX >= 2375 && absX <= 2425 && absY >= 5128 && absY <= 5169;
- }
- 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 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 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 boolean inEdgePk() {
- return absX >= 3040 && absX <= 3118 && absY >= 3522 && absY <= 3553;
- }
- public boolean combatDifference(int cbLvl) {
- return wildLevel >= combatLevel && combatLevel + cbLvl >= wildLevel || cbLvl < combatLevel && combatLevel - wildLevel <= cbLvl || cbLvl == combatLevel;
- }
- void addWildernessUpdating() {
- getActionSender().setString(this, "Level: " + getWildernessLevel(), 380, 1);
- getActionSender().setString(this, "Level: " + getWildernessLevel(), 380, 1);
- getActionSender().setString(this, "Level: " + getWildernessLevel(), 380, 2);
- getActionSender().setString(this, "Level: " + getWildernessLevel(), 380, 3);
- if (updatedLevel != wildernessZone(absX, absY)) {
- updatedLevel = wildernessZone(absX, absY);
- if (updatedLevel) {
- getActionSender().setOverlay(this, 380);
- } else {
- wildyLevel = 0;
- getActionSender().removeOverlay(this);
- }
- }
- }
- public boolean burakZone() {
- return absX >= 3040 && absX <= 3329 && absY >= 3523 && absY <= 3524;
- }
- public boolean specialZone() {
- return absX == 2995 && absY <= 3533 && absY >= 3530;
- }
- public void crossDitch() {
- int y = 3520;
- if (!burakZone()) {
- y = 3523;
- }
- if (specialZone()) {
- playerWalk(2998, absY + 3, 6132, 0);
- appearanceUpdateReq = true;
- updateReq = true;
- return;
- }
- playerWalk(absX, y, 6132, 0);
- appearanceUpdateReq = true;
- updateReq = true;
- }
- public void loadStaticObjects() {
- //3091 3956
- //getActionSender().addStaticObject(26972, 0, 3090, 3474, 0, 10);
- getActionSender().addStaticObject(5959, 0, 3090, 3474, 0, 4);
- }
- 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;
- }
- 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.socket.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[1000];
- 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:
- 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 boolean clanWarsFightArea() {
- return absX >= 3263 && absX <= 3327 && absY >= 3713 && absY <= 3840;
- }
- public boolean bountySafe1() {
- return absX >=3173 && absX <=3193 && absY >=3669 && absY <=3701;
- }
- public boolean bountySafe2() {
- return absX >=3154 && absX <=3173 && absY >=3669 && absY <=3690;
- }
- public boolean bountySafe3() {
- return absX >=3145 && absX <=3167 && absY >=3662 && absY <=3668;
- }
- public boolean bountySafe4() {
- return absX >=3143 && absX <=3154 && absY >=3669 && absY <=3675;
- }
- public boolean bountySafe5() {
- return absX >=3136 && absX <=3145 && absY >=3652 && absY <=3662;
- }
- public boolean bountySafe(){
- return bountySafe1() || bountySafe2() || bountySafe3() || bountySafe4() || bountySafe5();
- }
- public void destruct() {
- 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;
- 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);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement