Thread: 2 Things, [PI]

Page 1 of 3 123 LastLast
Results 1 to 10 of 22
  1. #1 2 Things, [PI] 
    Registered Member
    Join Date
    Sep 2012
    Posts
    63
    Thanks given
    15
    Thanks received
    2
    Rep Power
    11
    The first thing, eating food and drinking pots just sends me "Nothing interesting happens"
    My Clickitem.java
    Spoiler for ClickItem.java:
    Code:
    package server.model.players.packets;
    
    import server.model.players.*;
    
    /**
     * Clicking an item, bury bone, eat food etc
     **/
    public class ClickItem implements PacketType {
    
    	@Override
    	public void processPacket(Client c, int packetType, int packetSize) {
    		int junk = c.getInStream().readSignedWordBigEndianA();
    		int itemSlot = c.getInStream().readUnsignedWordA();
    		int itemId = c.getInStream().readUnsignedWordBigEndian();
    		if (itemId != c.playerItems[itemSlot] - 1) {
    			return;
    		}
    		if(c.getPrayer().buryBone(itemId, itemSlot))
    			return;
    		if(Food.eatFood(c, itemId, itemSlot))
    			return;
    		c.sendMessage("Nothing interesting happens.");
    	}
    
    }


    My Food.java
    Spoiler for Food.java:
    Code:
    package server.model.players;
    
    public class Food {
    	public static int eatAnim = 829;
    	public static int eatSound = 317;
    	public static int eatTick = 3;
    	public static boolean eatFood(Client c, int foodId, int itemSlot) {
    		if(heals(foodId) == 0)
    			return false;
    		if(c.foodTimer > c.tick)
    			return true;	
    		if (c.duelRule[6]) {
    			c.sendMessage("You may not eat in this duel.");
    			return true;
    		}
    		c.getCombat().resetPlayerAttack();
    		c.attackTimer += 2;
    		c.startAnimation(829);	
    		c.getPA().sound(eatSound);
    		c.getItems().deleteItem(foodId, itemSlot, 1);
    		if (c.playerLevel[3] < c.getLevelForXP(c.playerXP[3])) {
    			c.playerLevel[3] += heals(foodId);
    			if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
    				c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
    		}
    		c.getPA().refreshSkill(3);
    		if(givesItem(foodId) != 0)
    			c.getItems().addItem(givesItem(foodId), 1);
    		c.sendMessage("You eat the "+c.getItems().getItemName(foodId).toLowerCase()+".");
    		c.foodTimer = c.tick + eatTick;
    		return true;
    	}
    	public static int heals(int foodId) {
    		switch(foodId) {
    			case 379:
    				return 12;
    			case 385:
    				return 20;
    			case 2301:
    			case 2303:
    				return 11;
    		}
    		return 0;
    	}
    	public static int givesItem(int foodId) {
    		switch(foodId) {
    			case 2301:
    				return 2303;
    		}
    		return 0;
    	}
    }


    My Potions.java
    Spoiler for Potions.java:
    Code:
    package server.model.players;
    
    /**
     * @author Sanity
     */
    
    public class Potions {
    
    	private Client c;
    	
    	public Potions(Client c) {
    		this.c = c;
    	}
    	
    	public void handlePotion(int itemId, int slot) {
    		if (c.duelRule[5]) {
    			c.sendMessage("You may not drink potions in this duel.");
    			return;
    		}
    		if (System.currentTimeMillis() - c.potDelay >= 1500) {
    			c.potDelay = System.currentTimeMillis();
    			c.foodDelay = c.potDelay;
    			c.getCombat().resetPlayerAttack();
    			c.attackTimer++;
    			switch (itemId) {
    				case 6685:	//brews
    				doTheBrew(itemId, 6687, slot);
    				break;
    				case 6687:
    				doTheBrew(itemId, 6689, slot);
    				break;
    				case 6689:
    				doTheBrew(itemId, 6691, slot);
    				break;
    				case 6691:
    				doTheBrew(itemId, 229, slot);
    				break;
    				case 2436:
    				drinkStatPotion(itemId,145,slot,0,true); //sup attack
    				break;
    				case 145:
    				drinkStatPotion(itemId,147,slot,0,true);
    				break;
    				case 147:
    				drinkStatPotion(itemId,149,slot,0,true);
    				break;
    				case 149:
    				drinkStatPotion(itemId,229,slot,0,true);
    				break;
    				case 2440:
    				drinkStatPotion(itemId,157,slot,2,true); //sup str
    				break;
    				case 157:
    				drinkStatPotion(itemId,159,slot,2,true);
    				break;
    				case 159:
    				drinkStatPotion(itemId,161,slot,2,true);
    				break;
    				case 161:
    				drinkStatPotion(itemId,229,slot,2,true);
    				break;
    				case 2444:
    				drinkStatPotion(itemId,169,slot,4,false); //range pot
    				break;
    				case 169:
    				drinkStatPotion(itemId,171,slot,4,false);
    				break;
    				case 171:
    				drinkStatPotion(itemId,173,slot,4,false);
    				break;
    				case 173:
    				drinkStatPotion(itemId,229,slot,4,false);
    				break;
    				case 2432:
    				drinkStatPotion(itemId,133,slot,1,false); //def pot
    				break;
    				case 133:
    				drinkStatPotion(itemId,135,slot,1,false);
    				break;
    				case 135:
    				drinkStatPotion(itemId,137,slot,1,false);
    				break;
    				case 137:
    				drinkStatPotion(itemId,229,slot,1,false);
    				break;
    				case 113:
    				drinkStatPotion(itemId,115,slot,2,false); //str pot
    				break;
    				case 115:
    				drinkStatPotion(itemId,117,slot,2,false);
    				break;
    				case 117:
    				drinkStatPotion(itemId,119,slot,2,false);
    				break;
    				case 119:
    				drinkStatPotion(itemId,229,slot,2,false);
    				break;
    				case 2428:
    				drinkStatPotion(itemId,121,slot,0,false); //attack pot
    				break;
    				case 121:
    				drinkStatPotion(itemId,123,slot,0,false);
    				break;
    				case 123:
    				drinkStatPotion(itemId,125,slot,0,false);
    				break;
    				case 125:
    				drinkStatPotion(itemId,229,slot,0,false);
    				break;
    				case 2442:
    				drinkStatPotion(itemId,163,slot,1,true); //super def pot
    				break;
    				case 163:
    				drinkStatPotion(itemId,165,slot,1,true);
    				break;
    				case 165:
    				drinkStatPotion(itemId,167,slot,1,true);
    				break;
    				case 167:
    				drinkStatPotion(itemId,229,slot,1,true);
    				break;
    				case 3024:
    				drinkPrayerPot(itemId,3026,slot,true); //sup restore
    				break;
    				case 3026:
    				drinkPrayerPot(itemId,3028,slot,true);
    				break;
    				case 3028:
    				drinkPrayerPot(itemId,3030,slot,true);
    				break;
    				case 3030:
    				drinkPrayerPot(itemId,229,slot,true);
    				break;
    				case 2434:
    				drinkPrayerPot(itemId,139,slot,false); //pray pot
    				break;
    				case 139:
    				drinkPrayerPot(itemId,141,slot,false);
    				break;
    				case 141:
    				drinkPrayerPot(itemId,143,slot,false);
    				break;
    				case 143:
    				drinkPrayerPot(itemId,229,slot,false);
    				break;
    				case 2446:
    				drinkAntiPoison(itemId,175,slot,30000); //anti poisons
    				break;
    				case 175:
    				drinkAntiPoison(itemId,177,slot,30000);
    				break;
    				case 177:
    				drinkAntiPoison(itemId,179,slot,30000);
    				break;
    				case 179:
    				drinkAntiPoison(itemId,229,slot,30000);
    				break;
    				case 2448:
    				drinkAntiPoison(itemId,181,slot,300000); //anti poisons
    				break;
    				case 181:
    				drinkAntiPoison(itemId,183,slot,300000);
    				break;
    				case 183:
    				drinkAntiPoison(itemId,185,slot,300000);
    				break;
    				case 185:
    				drinkAntiPoison(itemId,229,slot,300000);
    				break;
    				case 2452:
    				antifirePot(itemId,2454,slot); //Antifire
    				break;
    				case 2454:
    				antifirePot(itemId,2456,slot);
    				break;
    				case 2456:
    				antifirePot(itemId,2458,slot);
    				break;
    				case 2458:
    				antifirePot(itemId,229,slot);
    				break;				
    			}
    		}	
    	}
    	
    	public void antifirePot(int itemId, int replaceItem, int slot){ //Antifire
    		c.startAnimation(829);
    		c.playerItems[slot] = replaceItem + 1;
    		c.antiFirePot = true;
    		c.antiFirePotion();
    		c.sendMessage("@red@Your immunity against dragon fire has been increased.");
    		c.getItems().resetItems(3214);
    		
    	}
    	
    	public void drinkAntiPoison(int itemId, int replaceItem, int slot, long delay) {
    		c.startAnimation(829);
    		c.playerItems[slot] = replaceItem + 1;
    		c.getItems().resetItems(3214);
    		curePoison(delay);
    	}
    	
    	public void curePoison(long delay) {
    		c.poisonDamage = 0;
    		c.poisonImmune = delay;
    		c.lastPoisonSip = System.currentTimeMillis();
    	}
    	
    	public void drinkStatPotion(int itemId, int replaceItem, int slot, int stat, boolean sup) {
    		c.startAnimation(829);
    		c.playerItems[slot] = replaceItem + 1;
    		c.getItems().resetItems(3214);
    		enchanceStat(stat,sup);
    	}
    	
    	public void drinkPrayerPot(int itemId, int replaceItem, int slot, boolean rest) {
    		c.startAnimation(829);
    		c.playerItems[slot] = replaceItem + 1;
    		c.getItems().resetItems(3214);
    		c.playerLevel[5] += (c.getLevelForXP(c.playerXP[5]) * .33);
    		if (rest)
    			c.playerLevel[5] += 1;
    		if (c.playerLevel[5] > c.getLevelForXP(c.playerXP[5]))
    			c.playerLevel[5] = c.getLevelForXP(c.playerXP[5]);
    		c.getPA().refreshSkill(5);
    		if (rest)
    			restoreStats();
    	}
    	
    	public void restoreStats() {
    		for (int j = 0; j <= 6; j++) {
    			if (j == 5 || j == 3)
    				continue;
    			if (c.playerLevel[j] < c.getLevelForXP(c.playerXP[j])) {
    				c.playerLevel[j] += (c.getLevelForXP(c.playerXP[j]) * .33);
    				if (c.playerLevel[j] > c.getLevelForXP(c.playerXP[j])) {
    					c.playerLevel[j] = c.getLevelForXP(c.playerXP[j]);				
    				}
    				c.getPA().refreshSkill(j);
    				c.getPA().setSkillLevel(j, c.playerLevel[j], c.playerXP[j]);
    			}			
    		}
    	}
    	
    	public void doTheBrew(int itemId, int replaceItem, int slot) {
    		if (c.duelRule[6]) {
    			c.sendMessage("You may not eat in this duel.");
    			return;
    		}
    		c.startAnimation(829);
    		c.playerItems[slot] = replaceItem + 1;
    		c.getItems().resetItems(3214);
    		int[] toDecrease = {0,2,4,6};
    		
    		int[] toIncrease = {1,3};
    		for (int tD : toDecrease) {
    			c.playerLevel[tD] -= getBrewStat(tD, .10);
    			if (c.playerLevel[tD] < 0)
    				c.playerLevel[tD] = 1;
    			c.getPA().refreshSkill(tD);
    			c.getPA().setSkillLevel(tD, c.playerLevel[tD], c.playerXP[tD]);
    		}
    		c.playerLevel[1] += getBrewStat(1, .20);		
    		if (c.playerLevel[1] > (c.getLevelForXP(c.playerXP[1])*1.2 + 1)) {
    			c.playerLevel[1] = (int)(c.getLevelForXP(c.playerXP[1])*1.2);
    		}
    		c.getPA().refreshSkill(1);
    		
    		c.playerLevel[3] += getBrewStat(3, .15);
    		if (c.playerLevel[3] > (c.getLevelForXP(c.playerXP[3])*1.17 + 1)) {
    			c.playerLevel[3] = (int)(c.getLevelForXP(c.playerXP[3])*1.17);
    		}
    		c.getPA().refreshSkill(3);
    	}
    	
    	public void enchanceStat(int skillID, boolean sup) {
    		c.playerLevel[skillID] += getBoostedStat(skillID, sup);
    		c.getPA().refreshSkill(skillID);
    	}
    	
    	public int getBrewStat(int skill, double amount) {
    		return (int)(c.getLevelForXP(c.playerXP[skill]) * amount);
    	}
    	
    	public int getBoostedStat(int skill, boolean sup) {
    		int increaseBy = 0;
    		if (sup)
    			increaseBy = (int)(c.getLevelForXP(c.playerXP[skill])*.20);
    		else
    			increaseBy = (int)(c.getLevelForXP(c.playerXP[skill])*.13) + 1;
    		if (c.playerLevel[skill] + increaseBy > c.getLevelForXP(c.playerXP[skill]) + increaseBy + 1) {
    			return c.getLevelForXP(c.playerXP[skill]) + increaseBy - c.playerLevel[skill];
    		}
    		return increaseBy;
    	}
    	
    	public boolean isPotion(int itemId) {
    		String name = c.getItems().getItemName(itemId);
    		return name.contains("(4)") || name.contains("(3)") || name.contains("(2)") || name.contains("(1)");	
    	}
    }


    And my second problem, where would I look to change NPC death animations? I just need the java I could find that in.

    My NPCHandler.java
    Spoiler for NPCHandler.java:
    Code:
    package server.model.npcs;
    
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.ArrayList;
    
    import server.Config;
    import server.Server;
    import server.model.players.Client;
    import server.util.Misc;
    import server.world.map.VirtualWorld;
    import server.event.EventManager;
    import server.event.Event;
    import server.event.EventContainer;
    
    public class NPCHandler {
    	public static int maxNPCs = 10000;
    	public static int maxListedNPCs = 10000;
    	public static NPCDrops drop[] = new NPCDrops[3500];
    	public static NPC npcs[] = new NPC[maxNPCs];
    	public static NPCList NpcList[] = new NPCList[maxListedNPCs];
    
    	public NPCHandler() {
    		for(int i = 0; i < maxNPCs; i++) {
    			npcs[i] = null;
    		}
    		for(int i = 0; i < maxListedNPCs; i++) {
    			NpcList[i] = null;
    		}
    		for(int i = 0; i < 3500; i ++) {
    			NPCDrops newNpc = new NPCDrops(i);
    			drop[i] = newNpc;
    		}
    		loadDrops("./Data/CFG/npcdrops.cfg");
    		loadNPCList("./Data/CFG/npc.cfg");
    		loadNPCSounds("./Data/CFG/npcsounds.cfg");
    		loadAutoSpawn("./Data/CFG/spawn-config.cfg");
    	}
    	
    	public void multiAttackGfx(int i, int gfx) {
    		if (npcs[i].projectileId < 0)
    			return;
    		for (int j = 0; j < Server.playerHandler.players.length; j++) {
    			if (Server.playerHandler.players[j] != null) {
    				Client c = (Client)Server.playerHandler.players[j];
    				if (c.heightLevel != npcs[i].heightLevel)
    					continue;
    				if (Server.playerHandler.players[j].goodDistance(c.absX, c.absY, npcs[i].absX, npcs[i].absY, 15)) {
    					int nX = Server.npcHandler.npcs[i].getX() + offset(i);
    					int nY = Server.npcHandler.npcs[i].getY() + offset(i);
    					int pX = c.getX();
    					int pY = c.getY();
    					int offX = (nY - pY)* -1;
    					int offY = (nX - pX)* -1;
    					c.getPA().createPlayersProjectile(nX, nY, offX, offY, 50, getProjectileSpeed(i), npcs[i].projectileId, 43, 31, -c.getId() - 1, 65);					
    				}
    			}		
    		}
    	}
    	
    	public boolean switchesAttackers(int i) {
    		switch(npcs[i].npcType) {
    			case 2551:
    			case 2552:
    			case 2553:
    			case 2559:
    			case 2560:
    			case 2561:
    			case 2563:
    			case 2564:
    			case 2565:
    			case 2892:
    			case 2894:
    			return true;
    		
    		}
    	
    		return false;
    	}
    	
    	public void multiAttackDamage(int i) {
    		int max = getMaxHit(i);
    		for (int j = 0; j < Server.playerHandler.players.length; j++) {
    			if (Server.playerHandler.players[j] != null) {
    				Client c = (Client)Server.playerHandler.players[j];
    				if (c.isDead || c.heightLevel != npcs[i].heightLevel)
    					continue;
    				if (Server.playerHandler.players[j].goodDistance(c.absX, c.absY, npcs[i].absX, npcs[i].absY, 15)) {
    					if (npcs[i].attackType == 2) {
    						if (!c.prayerActive[16]) {
    							if (Misc.random(500) + 200 > Misc.random(c.getCombat().mageDef())) {
    								int dam = Misc.random(max);
    								c.dealDamage(dam);
    								c.handleHitMask(dam);							
    							} else {
    								c.dealDamage(0);
    								c.handleHitMask(0);							
    							}
    						} else {
    							c.dealDamage(0);
    							c.handleHitMask(0);
    						}
    					} else if (npcs[i].attackType == 1) {
    						if (!c.prayerActive[17]) {
    							int dam = Misc.random(max);
    							if (Misc.random(500) + 200 > Misc.random(c.getCombat().calculateRangeDefence())) {
    								c.dealDamage(dam);
    								c.handleHitMask(dam);							
    							} else {
    								c.dealDamage(0);
    								c.handleHitMask(0);
    							}
    						} else {
    							c.dealDamage(0);
    							c.handleHitMask(0);							
    						}
    					}
    					if (npcs[i].endGfx > 0) {
    						c.gfx0(npcs[i].endGfx);					
    					}
    				}
    				c.getPA().refreshSkill(3);
    			}		
    		}
    	}
    	
    	public int getClosePlayer(int i) {
    		for (int j = 0; j < Server.playerHandler.players.length; j++) {
    			if (Server.playerHandler.players[j] != null) {
    				if (j == npcs[i].spawnedBy)
    					return j;
    				if (goodDistance(Server.playerHandler.players[j].absX, Server.playerHandler.players[j].absY, npcs[i].absX, npcs[i].absY, 2 + distanceRequired(i) + followDistance(i)) || isFightCaveNpc(i)) {
    					if ((Server.playerHandler.players[j].underAttackBy <= 0 && Server.playerHandler.players[j].underAttackBy2 <= 0) || Server.playerHandler.players[j].inMulti())
    						if (Server.playerHandler.players[j].heightLevel == npcs[i].heightLevel)
    							return j;
    				}
    			}	
    		}
    		return 0;
    	}
    	
    	public int getCloseRandomPlayer(int i) {
    		ArrayList<Integer> players = new ArrayList<Integer>();
    		for (int j = 0; j < Server.playerHandler.players.length; j++) {
    			if (Server.playerHandler.players[j] != null) {
    				if (goodDistance(Server.playerHandler.players[j].absX, Server.playerHandler.players[j].absY, npcs[i].absX, npcs[i].absY, 2 + distanceRequired(i) + followDistance(i)) || isFightCaveNpc(i)) {
    					if ((Server.playerHandler.players[j].underAttackBy <= 0 && Server.playerHandler.players[j].underAttackBy2 <= 0) || Server.playerHandler.players[j].inMulti())
    						if (Server.playerHandler.players[j].heightLevel == npcs[i].heightLevel)
    							players.add(j);
    				}
    			}	
    		}
    		if (players.size() > 0)
    			return players.get(Misc.random(players.size() -1));
    		else
    			return 0;
    	}
    	
    	public int npcSize(int i) {
    		switch (npcs[i].npcType) {
    		case 2883:
    		case 2882:
    		case 2881:
    			return 3;
    		}
    		return 0;
    	}
    	
    	public boolean isAggressive(int i) {
    		switch (npcs[i].npcType) {
    			case 2550:
    			case 2551:
    			case 2552:
    			case 2553:
    			case 2558:
    			case 2559:
    			case 2560:
    			case 2561:
    			case 2562:
    			case 2563:
    			case 2564:
    			case 2565:
    			case 2892:
    			case 2894:
    			case 2881:
    			case 2882:
    			case 2883:
    			return true;		
    		}
    		if (npcs[i].inWild() && npcs[i].MaxHP > 0)
    			return true;
    		if (isFightCaveNpc(i))
    			return true;
    		return false;
    	}
    	
    	public boolean isFightCaveNpc(int i) {
    		switch (npcs[i].npcType) {
    			case 2627:
    			case 2630:
    			case 2631:
    			case 2741:
    			case 2743: 
    			case 2745:
    			return true;		
    		}
    		return false;
    	}
    	
    	/**
    	* Summon npc, barrows, etc
    	**/
    	public void spawnNpc(Client c, int npcType, int x, int y, int heightLevel, int WalkingType, int HP, int maxHit, int attack, int defence, boolean attackPlayer, boolean headIcon) {
    		// first, search for a free slot
    		int slot = -1;
    		for (int i = 1; i < maxNPCs; i++) {
    			if (npcs[i] == null) {
    				slot = i;
    				break;
    			}
    		}
    		if(slot == -1) {
    			//Misc.println("No Free Slot");
    			return;		// no free slot found
    		}
    		NPC newNPC = new NPC(slot, npcType);
    		newNPC.absX = x;
    		newNPC.absY = y;
    		newNPC.makeX = x;
    		newNPC.makeY = y;
    		newNPC.heightLevel = heightLevel;
    		newNPC.walkingType = WalkingType;
    		newNPC.HP = HP;
    		newNPC.MaxHP = HP;
    		newNPC.maxHit = maxHit;
    		newNPC.attack = attack;
    		newNPC.defence = defence;
    		newNPC.spawnedBy = c.getId();
    		if(headIcon) 
    			c.getPA().drawHeadicon(1, slot, 0, 0);
    		if(attackPlayer) {
    			newNPC.underAttack = true;
    			if(c != null) {
    				newNPC.killerId = c.playerId;
    			}
    		}
    		npcs[slot] = newNPC;
    	}
    	
    	public void spawnNpc2(int npcType, int x, int y, int heightLevel, int WalkingType, int HP, int maxHit, int attack, int defence) {
    		// first, search for a free slot
    		int slot = -1;
    		for (int i = 1; i < maxNPCs; i++) {
    			if (npcs[i] == null) {
    				slot = i;
    				break;
    			}
    		}
    		if(slot == -1) {
    			//Misc.println("No Free Slot");
    			return;		// no free slot found
    		}
    		NPC newNPC = new NPC(slot, npcType);
    		newNPC.absX = x;
    		newNPC.absY = y;
    		newNPC.makeX = x;
    		newNPC.makeY = y;
    		newNPC.heightLevel = heightLevel;
    		newNPC.walkingType = WalkingType;
    		newNPC.HP = HP;
    		newNPC.MaxHP = HP;
    		newNPC.maxHit = maxHit;
    		newNPC.attack = attack;
    		newNPC.defence = defence;
    		npcs[slot] = newNPC;
    	}
    	
    	
    	/**
    	* Attack delays
    	**/
    	public int getNpcDelay(int i) {
    		switch(npcs[i].npcType) {
    			case 2025:
    			case 2028:
    			return 7;
    			
    			case 2745:
    			return 8;
    			
    			case 2558:
    			case 2559:
    			case 2560:
    			case 2561:
    			case 2550:
    			return 6;
    			//saradomin gw boss
    			case 2562:
    			return 2;
    			
    			default:
    			return 5;
    		}
    	}
    	
    	/**
    	* Hit delays
    	**/
    	public int getHitDelay(int i) {
    		switch(npcs[i].npcType) {
    			case 2881:
    			case 2882:
    			case 3200:
    			case 2892:
    			case 2894:
    			return 3;
    			
    			case 2743:
    			case 2631:
    			case 2558:
    			case 2559:
    			case 2560:
    			return 3;
    			
    			case 2745:
    			if (npcs[i].attackType == 1 || npcs[i].attackType == 2)
    				return 5;
    			else
    				return 2;
    			
    			case 2025:
    			return 4;
    			case 2028:
    			return 3;
    
    			default:
    			return 2;
    		}
    	}
    		
    	/**
    	* Npc respawn time
    	**/
    	public int getRespawnTime(int i) {
    		switch(npcs[i].npcType) {
    			case 2881:
    			case 2882:
    			case 2883:
    			case 2558:
    			case 2559:
    			case 2560:
    			case 2561:
    			case 2562:
    			case 2563:
    			case 2564:
    			case 2550:
    			case 2551:
    			case 2552:
    			case 2553:
    			return 100;
    			case 3777:
    			case 3778:
    			case 3779:
    			case 3780:
    			return 500;
    			default:
    			return 25;
    		}
    	}
    	
    	
    	
    	
    	public void newNPC(int npcType, int x, int y, int heightLevel, int WalkingType, int HP) {
    		// first, search for a free slot
    		int slot = -1;
    		for (int i = 1; i < maxNPCs; i++) {
    			if (npcs[i] == null) {
    				slot = i;
    				break;
    			}
    		}
    
    		if(slot == -1) return;		// no free slot found
    
    		NPC newNPC = new NPC(slot, npcType);
    		newNPC.absX = x;
    		newNPC.absY = y;
    		newNPC.makeX = x;
    		newNPC.makeY = y;
    		newNPC.heightLevel = heightLevel;
    		newNPC.walkingType = WalkingType;
    		newNPC.dirUpdateRequired = true;
    		newNPC.updateRequired = true;
    		newNPC.HP = HP;
    		newNPC.MaxHP = HP;
    		newNPC.maxHit = getNpcListMaxHit(npcType);
    		newNPC.attack = getNpcListAttack(npcType);;
    		newNPC.defence = getNpcListDefence(npcType);;
    		npcs[slot] = newNPC;
    	}
    
    	public void newNPCList(int npcType, String npcName, int combat, int HP, int maxHit, int attack, int defence, int atkanim, int blockanim, int dieanim) {
    		if(atkanim == 0)
    			atkanim = 0x326;
    		// first, search for a free slot
    		int slot = -1;
    		for (int i = 0; i < maxListedNPCs; i++) {
    			if (NpcList[i] == null) {
    				slot = i;
    				break;
    			}
    		}
    
    		if(slot == -1) return;		// no free slot found
    
    		NPCList newNPCList = new NPCList(npcType);
    		newNPCList.npcName = npcName;
    		newNPCList.npcCombat = combat;
    		newNPCList.npcHealth = HP;
    		newNPCList.maxHit = maxHit;
    		newNPCList.attack = attack;
    		newNPCList.defence = defence;
    		newNPCList.atkanim = atkanim;
    		newNPCList.blockanim = blockanim;
    		newNPCList.dieanim = dieanim;		
    		NpcList[slot] = newNPCList;
    	}
    	
    	public void newNPCSound(int npcId, int attack, int block, int die) {
    		System.out.println("New npc sound: "+npcId+", "+attack+", "+block+", "+die);
    		int slot = -1;
    		for (int i = 0; i < maxListedNPCs; i++) {
    			if (NpcList[i].npcId == npcId) {
    				slot = i;
    				break;
    			}
    		}
    
    		if(slot == -1) return;		// npc entry not found
    	
    		NpcList[slot].attackSound = attack;
    		NpcList[slot].blockSound = block;
    		NpcList[slot].dieSound = die;
    	}
    
    	
    
    	public void process() {
    		for (int i = 0; i < maxNPCs; i++) {
    			if (npcs[i] == null) continue;
    			npcs[i].clearUpdateFlags();
    			
    		}
                    
    		for (int i = 0; i < maxNPCs; i++) {
    			if (npcs[i] != null) {
    				if (npcs[i].actionTimer > 0) {
    					npcs[i].actionTimer--;
    				}
    				
    				if (npcs[i].freezeTimer > 0) {
    					npcs[i].freezeTimer--;
    				}
    				
    				if (npcs[i].hitDelayTimer > 0) {
    					npcs[i].hitDelayTimer--;
    				}
    				
    				if (npcs[i].hitDelayTimer == 1) {
    					npcs[i].hitDelayTimer = 0;
    					applyDamage(i);
    				}
    				
    				if(npcs[i].attackTimer > 0) {
    					npcs[i].attackTimer--;
    				}
    					
    				if(npcs[i].spawnedBy > 0) { // delete summons npc
    					if(Server.playerHandler.players[npcs[i].spawnedBy] == null
    					|| Server.playerHandler.players[npcs[i].spawnedBy].heightLevel != npcs[i].heightLevel	
    					|| Server.playerHandler.players[npcs[i].spawnedBy].respawnTimer > 0 
    					|| !Server.playerHandler.players[npcs[i].spawnedBy].goodDistance(npcs[i].getX(), npcs[i].getY(), Server.playerHandler.players[npcs[i].spawnedBy].getX(), Server.playerHandler.players[npcs[i].spawnedBy].getY(), 20)) {
    							
    						if(Server.playerHandler.players[npcs[i].spawnedBy] != null) {
    							for(int o = 0; o < Server.playerHandler.players[npcs[i].spawnedBy].barrowsNpcs.length; o++){
    								if(npcs[i].npcType == Server.playerHandler.players[npcs[i].spawnedBy].barrowsNpcs[o][0]) {
    									if (Server.playerHandler.players[npcs[i].spawnedBy].barrowsNpcs[o][1] == 1)
    										Server.playerHandler.players[npcs[i].spawnedBy].barrowsNpcs[o][1] = 0;
    								}
    							}
    						}
    						npcs[i] = null;
    					}
    				}
    				if (npcs[i] == null) continue;
    				
    				/**
    				* Attacking player
    				**/
    				if (isAggressive(i) && !npcs[i].underAttack && !npcs[i].isDead && !switchesAttackers(i)) {
    					npcs[i].killerId = getCloseRandomPlayer(i);
    				} else if (isAggressive(i) && !npcs[i].underAttack && !npcs[i].isDead && switchesAttackers(i)) {
    					npcs[i].killerId = getCloseRandomPlayer(i);
    				}
    				
    				if (System.currentTimeMillis() - npcs[i].lastDamageTaken > 5000)
    					npcs[i].underAttackBy = 0;
    				
    				if((npcs[i].killerId > 0 || npcs[i].underAttack) && !npcs[i].walkingHome && retaliates(npcs[i].npcType)) {
    					if(!npcs[i].isDead) {
    						int p = npcs[i].killerId;
    						if(Server.playerHandler.players[p] != null) {
    							Client c = (Client) Server.playerHandler.players[p];					
    							followPlayer(i, c.playerId);
    							if (npcs[i] == null) continue;
    							if(npcs[i].attackTimer == 0) {
    								if(c != null) {
    									attackPlayer(c, i);
    								} else {
    									npcs[i].killerId = 0;
    									npcs[i].underAttack = false;
    									npcs[i].facePlayer(0);
    								}
    							}
    						} else {
    							npcs[i].killerId = 0;
    							npcs[i].underAttack = false;
    							npcs[i].facePlayer(0);
    						}
    					}
    				}
    				
    				
    		
    				/**
    				* Random walking and walking home
    				**/
    				if (npcs[i] == null) continue;
    				if((!npcs[i].underAttack || npcs[i].walkingHome) && npcs[i].randomWalk && !npcs[i].isDead) {
    					npcs[i].facePlayer(0);
    					npcs[i].killerId = 0;	
    					if(npcs[i].spawnedBy == 0) {
    						if((npcs[i].absX > npcs[i].makeX + Config.NPC_RANDOM_WALK_DISTANCE) || (npcs[i].absX < npcs[i].makeX - Config.NPC_RANDOM_WALK_DISTANCE) || (npcs[i].absY > npcs[i].makeY + Config.NPC_RANDOM_WALK_DISTANCE) || (npcs[i].absY < npcs[i].makeY - Config.NPC_RANDOM_WALK_DISTANCE)) {
    							npcs[i].walkingHome = true;
    						}
    					}
    
    					if (npcs[i].walkingHome && npcs[i].absX == npcs[i].makeX && npcs[i].absY == npcs[i].makeY) {
    						npcs[i].walkingHome = false;
    					} else if(npcs[i].walkingHome) {
    						npcs[i].moveX = GetMove(npcs[i].absX, npcs[i].makeX);
    			      		npcs[i].moveY = GetMove(npcs[i].absY, npcs[i].makeY);
    						npcs[i].getNextNPCMovement(i); 
    						npcs[i].updateRequired = true;
    					}
    					if(npcs[i].walkingType == 1) {
    						if(Misc.random(3)== 1 && !npcs[i].walkingHome) {
    							int MoveX = 0;
    							int MoveY = 0;			
    							int Rnd = Misc.random(9);
    							if (Rnd == 1 && VirtualWorld.I(npcs[i].heightLevel, npcs[i].absX, npcs[i].absY, npcs[i].absX + 1, npcs[i].absY + 1, 0)) {
    								MoveX = 1;
    								MoveY = 1;
    							} else if (Rnd == 2 && VirtualWorld.I(npcs[i].heightLevel, npcs[i].absX, npcs[i].absY, npcs[i].absX - 1, npcs[i].absY, 0)) {
    								MoveX = -1;
    							} else if (Rnd == 3 && VirtualWorld.I(npcs[i].heightLevel, npcs[i].absX, npcs[i].absY, npcs[i].absX, npcs[i].absY - 1, 0)) {
    								MoveY = -1;
    							} else if (Rnd == 4 && VirtualWorld.I(npcs[i].heightLevel, npcs[i].absX, npcs[i].absY, npcs[i].absX + 1, npcs[i].absY, 0)) {
    								MoveX = 1;
    							} else if (Rnd == 5 && VirtualWorld.I(npcs[i].heightLevel, npcs[i].absX, npcs[i].absY, npcs[i].absX, npcs[i].absY + 1, 0)) {
    								MoveY = 1;
    							} else if (Rnd == 6 && VirtualWorld.I(npcs[i].heightLevel, npcs[i].absX, npcs[i].absY, npcs[i].absX - 1, npcs[i].absY - 1, 0)) {
    								MoveX = -1;
    								MoveY = -1;
    							} else if (Rnd == 7 && VirtualWorld.I(npcs[i].heightLevel, npcs[i].absX, npcs[i].absY, npcs[i].absX - 1, npcs[i].absY + 1, 0)) {
    								MoveX = -1;
    								MoveY = 1;
    							} else if (Rnd == 8 && VirtualWorld.I(npcs[i].heightLevel, npcs[i].absX, npcs[i].absY, npcs[i].absX + 1, npcs[i].absY - 1, 0)) {
    								MoveX = 1;
    								MoveY = -1;
    							}
    										
    							if (MoveX == 1) {
    								if (npcs[i].absX + MoveX < npcs[i].makeX + 1) {
    									npcs[i].moveX = MoveX;
    								} else {
    									npcs[i].moveX = 0;
    								}
    							}
    							
    							if (MoveX == -1) {
    								if (npcs[i].absX - MoveX > npcs[i].makeX - 1)  {
    									npcs[i].moveX = MoveX;
    								} else {
    									npcs[i].moveX = 0;
    								}
    							}
    							
    							if(MoveY == 1) {
    								if(npcs[i].absY + MoveY < npcs[i].makeY + 1) {
    									npcs[i].moveY = MoveY;
    								} else {
    									npcs[i].moveY = 0;
    								}
    							}
    							
    							if(MoveY == -1) {
    								if(npcs[i].absY - MoveY > npcs[i].makeY - 1)  {
    									npcs[i].moveY = MoveY;
    								} else {
    									npcs[i].moveY = 0;
    								}
    							}
    								
    							if (!VirtualWorld.I(npcs[i].heightLevel, npcs[i].absX, npcs[i].absY, (npcs[i].absX + npcs[i].moveX), (npcs[i].absY + npcs[i].moveY), 0)) {
    								npcs[i].moveX = 0;
    								npcs[i].moveY = 0;
    							}
    							int x = (npcs[i].absX + npcs[i].moveX);
    							int y = (npcs[i].absY + npcs[i].moveY);
    							if (VirtualWorld.I(npcs[i].heightLevel, npcs[i].absX, npcs[i].absY, x, y, 0))
    								npcs[i].getNextNPCMovement(i);
    							else
    							{
    								npcs[i].moveX = 0;
    								npcs[i].moveY = 0;
    							} 
    							npcs[i].updateRequired = true;
    						}
    					} 
    				}
    				
    				if(!npcs[i].isDead) {
    					if(npcs[i].walkingType != 0) {
    						switch(npcs[i].walkingType) {
    							case 5:
    								npcs[i].turnNpc(npcs[i].absX-1, npcs[i].absY);
    							break;
    							case 4:
    								npcs[i].turnNpc(npcs[i].absX+1, npcs[i].absY);
    							break;
    							case 3:
    								npcs[i].turnNpc(npcs[i].absX, npcs[i].absY-1);
    							break;
    							case 2:
    								npcs[i].turnNpc(npcs[i].absX, npcs[i].absY+1);
    							break;	
    						}
    					}
    					npcs[i].updateRequired = true;					
    				}
    		
    				
    				if (npcs[i].isDead == true) {
    					if(npcs[i].actionTimer == 3 && npcs[i].applyDead == true &&  npcs[i].needRespawn == false) {	
    						Client c = (Client)Server.playerHandler.players[npcs[i].killedBy];
    						c.getPA().sound(getNpcListDieSound(npcs[i].npcType));
    					}
    					if (npcs[i].actionTimer == 0 && npcs[i].applyDead == false && npcs[i].needRespawn == false) {
    						npcs[i].updateRequired = true;
    						npcs[i].facePlayer(0);
    						npcs[i].killedBy = getNpcKillerId(i);
    						npcs[i].animNumber = getDeadEmote(npcs[i].npcType); // dead emote
    						npcs[i].animUpdateRequired = true;
    						npcs[i].freezeTimer = 0;
    						npcs[i].applyDead = true;
    						killedBarrow(i);
    						if (isFightCaveNpc(i))
    							killedTzhaar(i);
    						npcs[i].actionTimer = 4; // delete time
    						resetPlayersInCombat(i);
    					} else if (npcs[i].actionTimer == 0 && npcs[i].applyDead == true &&  npcs[i].needRespawn == false) {						
    						npcs[i].needRespawn = true;
    						npcs[i].actionTimer = getRespawnTime(i); // respawn time
    						dropItems(i); // npc drops items!
    						Client c = (Client)Server.playerHandler.players[npcs[i].killedBy];
    						c.getSlayer().killSlayerNpc(i);
    						appendKillCount(i);
    						npcs[i].absX = npcs[i].makeX;
    						npcs[i].absY = npcs[i].makeY;				
    						npcs[i].HP = npcs[i].MaxHP;
    						npcs[i].animNumber = 0x328;
    						npcs[i].updateRequired = true;
    						npcs[i].animUpdateRequired = true;
    						if (npcs[i].npcType >= 2440 && npcs[i].npcType <= 2446) {
    							Server.objectManager.removeObject(npcs[i].absX, npcs[i].absY, 10);
    						}
    						if (npcs[i].npcType == 2745) {
    							handleJadDeath(i);
    						}
    					} else if (npcs[i].actionTimer == 0 && npcs[i].needRespawn == true) {					
    						if(npcs[i].spawnedBy > 0) {
    							npcs[i] = null;
    						} else {
    							int old1 = npcs[i].npcType;
    							int old2 = npcs[i].makeX;
    							int old3 = npcs[i].makeY;
    							int old4 = npcs[i].heightLevel;
    							int old5 = npcs[i].walkingType;
    							int old6 = npcs[i].MaxHP;
    							
    							npcs[i] = null;
    							newNPC(old1, old2, old3, old4, old5, old6);
    						}
    					}
    				}
    			}
    		}
    	}
           
    	public boolean getsPulled(int i) {
    		switch (npcs[i].npcType) {
    			case 2550:
    				if (npcs[i].firstAttacker > 0)
    					return false;
    			break;
    		}
    		return true;
    	}
    	   
    	public boolean multiAttacks(int i) {
    		switch (npcs[i].npcType) {
    			case 2558:
    			return true;
    			case 2562:
    			if (npcs[i].attackType == 2)
    				return true;
    			case 2550:
    			if (npcs[i].attackType == 1)
    				return true;	
    			default:
    			return false;
    		}
    	
    	
    	}
    	
    	/**
    	* Npc killer id?
    	**/
    	
    	public int getNpcKillerId(int npcId) {
    		int oldDamage = 0;
    		int count = 0;
    		int killerId = 0;
    		for (int p = 1; p < Config.MAX_PLAYERS; p++)  {	
    			if (Server.playerHandler.players[p] != null) {
    				if(Server.playerHandler.players[p].lastNpcAttacked == npcId) {
    					if(Server.playerHandler.players[p].totalDamageDealt > oldDamage) {
    						oldDamage = Server.playerHandler.players[p].totalDamageDealt;
    						killerId = p;
    					}
    					Server.playerHandler.players[p].totalDamageDealt = 0;
    				}	
    			}
    		}				
    		return killerId;
    	}
    		
    	/**
    	 * 
    	 */
    	private void killedBarrow(int i) {
    		Client c = (Client)Server.playerHandler.players[npcs[i].killedBy];
    		if(c != null) {
    			for(int o = 0; o < c.barrowsNpcs.length; o++){
    				if(npcs[i].npcType == c.barrowsNpcs[o][0]) {
    					c.barrowsNpcs[o][1] = 2; // 2 for dead
    					c.barrowsKillCount++;
    				}
    			}
    		}
    	}
    	
    	private void killedTzhaar(int i) {
    		final Client c2 = (Client)Server.playerHandler.players[npcs[i].spawnedBy];
    		c2.tzhaarKilled++;
    		//System.out.println("To kill: " + c2.tzhaarToKill + " killed: " + c2.tzhaarKilled);
    		if (c2.tzhaarKilled == c2.tzhaarToKill) {
    			//c2.sendMessage("STARTING EVENT");
    			c2.waveId++;
    			EventManager.getSingleton().addEvent(new Event() {
    				public void execute(EventContainer c) {
    					if (c2 != null) {
    						Server.fightCaves.spawnNextWave(c2);
    					}	
    					c.stop();
    				}
    			}, 7500);
    			
    		}
    	}
    	
    	public void handleJadDeath(int i) {
    		Client c = (Client)Server.playerHandler.players[npcs[i].spawnedBy];
    		c.getItems().addItem(6570,1);
    		c.sendMessage("Congratulations on completing the fight caves minigame!");
    		c.getPA().resetTzhaar();
    		c.waveId = 300;
    	}
    	
    	
    	/**
    	* Dropping Items!
    	**/
    	
    	
    	public void dropItems(int j) {
    		int npcId = npcs[j].npcType;
    		Client c = (Client)Server.playerHandler.players[npcs[j].killedBy];
    		if(c != null) {				
    			for(int i = 0; i < drop[npcId].itemId.length; i ++) {
    				if(drop[npcId].itemId[i] == 0)
    					break;
    				int dropChance = 1 + Misc.random(999);
    				System.out.println("Drop chance: "+dropChance);
    				if(drop[npcId].chance[i] >= dropChance)
    					Server.itemHandler.createGroundItem(c, drop[npcId].itemId[i], npcs[j].absX, npcs[j].absY, drop[npcId].itemAmount[i], c.playerId);
    			}
    		}
    	}
    	
    	public void appendKillCount(int i) {
    		Client c = (Client)Server.playerHandler.players[npcs[i].killedBy];
    		if(c != null) {
    			int[] kcMonsters = {122,49,2558,2559,2560,2561,2550,2551,2552,2553,2562,2563,2564,2565};
    			for (int j : kcMonsters) {
    				if (npcs[i].npcType == j) {
    					if (c.killCount < 20) {
    						c.killCount++;
    						c.sendMessage("Killcount: " + c.killCount);
    					} else {
    						c.sendMessage("You already have 20 kill count");
    					}
    					break;
    				}
    			}
    		}	
    	}
    	
    	/**
    	 *	Resets players in combat
    	 */
    	
    	public void resetPlayersInCombat(int i) {
    		for (int j = 0; j < Server.playerHandler.players.length; j++) {
    			if (Server.playerHandler.players[j] != null)
    				if (Server.playerHandler.players[j].underAttackBy2 == i)
    					Server.playerHandler.players[j].underAttackBy2 = 0;
    		}
    	}
    	
    	
    	/**
    	* Npc Follow Player
    	**/
    	
    	public int GetMove(int Place1,int Place2) { 
    		if ((Place1 - Place2) == 0) {
                return 0;
    		} else if ((Place1 - Place2) < 0) {
    			return 1;
    		} else if ((Place1 - Place2) > 0) {
    			return -1;
    		}
            	return 0;
       	 }
    	
    	public boolean followPlayer(int i) {
    		switch (npcs[i].npcType) {
    			case 2892:
    			case 2894:
    			return false;
    		}
    		return true;
    	}
    	
    	public void followPlayer(int i, int playerId) {
    		if (Server.playerHandler.players[playerId] == null) {
    			return;
    		}
    		if (Server.playerHandler.players[playerId].respawnTimer > 0) {
    			npcs[i].facePlayer(0);
    			npcs[i].randomWalk = true; 
    	      	npcs[i].underAttack = false;	
    			return;
    		}
    		
    		if (!followPlayer(i)) {
    			npcs[i].facePlayer(playerId);
    			return;
    		}
    		
    		int playerX = Server.playerHandler.players[playerId].absX;
    		int playerY = Server.playerHandler.players[playerId].absY;
    		npcs[i].randomWalk = false;
    		if (goodDistance(npcs[i].getX(), npcs[i].getY(), playerX, playerY, distanceRequired(i)))
    			return;
    		if((npcs[i].spawnedBy > 0) || ((npcs[i].absX < npcs[i].makeX + Config.NPC_FOLLOW_DISTANCE) && (npcs[i].absX > npcs[i].makeX - Config.NPC_FOLLOW_DISTANCE) && (npcs[i].absY < npcs[i].makeY + Config.NPC_FOLLOW_DISTANCE) && (npcs[i].absY > npcs[i].makeY - Config.NPC_FOLLOW_DISTANCE))) {
    			if(npcs[i].heightLevel == Server.playerHandler.players[playerId].heightLevel) {
    				if(Server.playerHandler.players[playerId] != null && npcs[i] != null) {
    					if(playerY < npcs[i].absY) {
    						npcs[i].moveX = GetMove(npcs[i].absX, playerX);
    						npcs[i].moveY = GetMove(npcs[i].absY, playerY);
    					} else if(playerY > npcs[i].absY) {
    						npcs[i].moveX = GetMove(npcs[i].absX, playerX);
    						npcs[i].moveY = GetMove(npcs[i].absY, playerY);
    					} else if(playerX < npcs[i].absX) {
    						npcs[i].moveX = GetMove(npcs[i].absX, playerX);
    						npcs[i].moveY = GetMove(npcs[i].absY, playerY);
    					} else if(playerX > npcs[i].absX)  {
    						npcs[i].moveX = GetMove(npcs[i].absX, playerX);
    						npcs[i].moveY = GetMove(npcs[i].absY, playerY);
    					} else if(playerX == npcs[i].absX || playerY == npcs[i].absY) {
    						int o = Misc.random(3);
    						switch(o) {
    							case 0:
    							npcs[i].moveX = GetMove(npcs[i].absX, playerX);
    							npcs[i].moveY = GetMove(npcs[i].absY, playerY+1);
    							break;
    							
    							case 1:
    							npcs[i].moveX = GetMove(npcs[i].absX, playerX);
    							npcs[i].moveY = GetMove(npcs[i].absY, playerY-1);
    							break;
    							
    							case 2:
    							npcs[i].moveX = GetMove(npcs[i].absX, playerX+1);
    							npcs[i].moveY = GetMove(npcs[i].absY, playerY);
    							break;
    							
    							case 3:
    							npcs[i].moveX = GetMove(npcs[i].absX, playerX-1);
    							npcs[i].moveY = GetMove(npcs[i].absY, playerY);
    							break;
    						}	
    					}
    					int x = (npcs[i].absX + npcs[i].moveX);
    					int y = (npcs[i].absY + npcs[i].moveY);
    					npcs[i].facePlayer(playerId);
    					if (VirtualWorld.I(npcs[i].heightLevel, npcs[i].absX, npcs[i].absY, x, y, 0)) {
    						npcs[i].getNextNPCMovement(i);
    					} else {
    						npcs[i].moveX = 0;
    						npcs[i].moveY = 0;
    					}
    					npcs[i].facePlayer(playerId);
    			      	npcs[i].updateRequired = true;
    				}	
    			}
    		} else {
    			npcs[i].facePlayer(0);
    			npcs[i].randomWalk = true; 
    		   	npcs[i].underAttack = false;	
    		}
    	}
    	
    	
    	public boolean checkClipping(int i) {
    		NPC npc = npcs[i];
    		int size = npcSize(i);
    		
    		for (int x = 0; x < size; x++) {
    			for (int y = 0; y < size; y++) {
    				if (!VirtualWorld.I(npc.heightLevel, npc.absX + x, npc.absY + y, npc.absX + npc.moveX, npc.absY + npc.moveY, 0))
    					return false;				
    			}
    		}
    		return true;
    	}
    	
    	/**
    	* load spell
    	**/
    	public void loadSpell2(int i) {
    		npcs[i].attackType = 3;
    		int random = Misc.random(3);
    		if (random == 0) {
    			npcs[i].projectileId = 393; //red
    			npcs[i].endGfx = 430;
    		} else if (random == 1) {
    			npcs[i].projectileId = 394; //green
    			npcs[i].endGfx = 429;
    		} else if (random == 2) {
    			npcs[i].projectileId = 395; //white
    			npcs[i].endGfx = 431;
    		} else if (random == 3) {
    			npcs[i].projectileId = 396; //blue
    			npcs[i].endGfx = 428;
    		}
    	}
    	
    	public void loadSpell(int i) {
    		switch(npcs[i].npcType) {
    			case 2892:
    			npcs[i].projectileId = 94;
    			npcs[i].attackType = 2;
    			npcs[i].endGfx = 95;
    			break;
    			case 2894:
    			npcs[i].projectileId = 298;
    			npcs[i].attackType = 1;
    			break;
    			case 50:
    			int random = Misc.random(4);
    			if (random == 0) {
    				npcs[i].projectileId = 393; //red
    				npcs[i].endGfx = 430;
    				npcs[i].attackType = 3;
    			} else if (random == 1) {
    				npcs[i].projectileId = 394; //green
    				npcs[i].endGfx = 429;
    				npcs[i].attackType = 3;
    			} else if (random == 2) {
    				npcs[i].projectileId = 395; //white
    				npcs[i].endGfx = 431;
    				npcs[i].attackType = 3;
    			} else if (random == 3) {
    				npcs[i].projectileId = 396; //blue
    				npcs[i].endGfx = 428;
    				npcs[i].attackType = 3;
    			} else if (random == 4) {
    				npcs[i].projectileId = -1; //melee
    				npcs[i].endGfx = -1;
    				npcs[i].attackType = 0;				
    			}			
    			break;
    			//arma npcs
    			case 2561:
    				npcs[i].attackType = 0;
    			break;
    			case 2560:
    				npcs[i].attackType = 1;
    				npcs[i].projectileId = 1190;
    			break;
    			case 2559:
    				npcs[i].attackType = 2;
    				npcs[i].projectileId = 1203;
    			break;
    			case 2558:
    				random = Misc.random(1);
    				npcs[i].attackType = 1 + random;
    				if (npcs[i].attackType == 1) {
    					npcs[i].projectileId = 1197;				
    				} else {
    					npcs[i].attackType = 2;
    					npcs[i].projectileId = 1198;
    				}	
    			break;
    			//sara npcs
    			case 2562: //sara
    				random = Misc.random(1);
    				if (random == 0) {
    					npcs[i].attackType = 2;
    					npcs[i].endGfx = 1224;
    					npcs[i].projectileId = -1;
    				} else if (random == 1)
    					npcs[i].attackType = 0;
    			break;
    			case 2563: //star
    				npcs[i].attackType = 0;
    			break;
    			case 2564: //growler
    				npcs[i].attackType = 2;
    				npcs[i].projectileId = 1203;
    			break;
    			case 2565: //bree
    				npcs[i].attackType = 1;
    				npcs[i].projectileId = 9;
    			break;
    			//bandos npcs
    			case 2550:
    				random = Misc.random(2);
    				if (random == 0 || random == 1)
    					npcs[i].attackType = 0;
    				else {
    					npcs[i].attackType = 1;
    					npcs[i].endGfx = 1211;
    					npcs[i].projectileId = 288;
    				}
    			break;
    			case 2551:
    				npcs[i].attackType = 0;
    			break;
    			case 2552:
    				npcs[i].attackType = 2;
    				npcs[i].projectileId = 1203;
    			break;
    			case 2553:
    				npcs[i].attackType = 1;
    				npcs[i].projectileId = 1206;
    			break;
    			case 2025:
    			npcs[i].attackType = 2;
    			int r = Misc.random(3);
    			if(r == 0) {
    				npcs[i].gfx100(158);
    				npcs[i].projectileId = 159;
    				npcs[i].endGfx = 160;
    			}
    			if(r == 1) {
    				npcs[i].gfx100(161);
    				npcs[i].projectileId = 162;
    				npcs[i].endGfx = 163;
    			}
    			if(r == 2) {
    				npcs[i].gfx100(164);
    				npcs[i].projectileId = 165;
    				npcs[i].endGfx = 166;
    			}
    			if(r == 3) {
    				npcs[i].gfx100(155);
    				npcs[i].projectileId = 156;
    			}
    			break;
    			case 2881://supreme
    				npcs[i].attackType = 1;
    				npcs[i].projectileId = 298;
    			break;
    			
    			case 2882://prime
    				npcs[i].attackType = 2;
    				npcs[i].projectileId = 162;
    				npcs[i].endGfx = 477;
    			break;
    			
    			case 2028:
    				npcs[i].attackType = 1;
    				npcs[i].projectileId = 27;
    			break;
    			
    			case 3200:
    			int r2 = Misc.random(1);
    			if (r2 == 0) {
    				npcs[i].attackType = 1;
    				npcs[i].gfx100(550);
    				npcs[i].projectileId = 551;
    				npcs[i].endGfx = 552;
    			} else {
    				npcs[i].attackType = 2;
    				npcs[i].gfx100(553);
    				npcs[i].projectileId = 554;
    				npcs[i].endGfx = 555;
    			}
    			break;
    			case 2745:
    			int r3 = 0;
    			if (goodDistance(npcs[i].absX, npcs[i].absY, Server.playerHandler.players[npcs[i].spawnedBy].absX, Server.playerHandler.players[npcs[i].spawnedBy].absY, 1))
    				r3 = Misc.random(2);
    			else
    				r3 = Misc.random(1);
    			if (r3 == 0) {
    				npcs[i].attackType = 2;
    				npcs[i].endGfx = 157;
    				npcs[i].projectileId = 448;
    			} else if (r3 == 1) {
    				npcs[i].attackType = 1;
    				npcs[i].endGfx = 451;
    				npcs[i].projectileId = -1;
    			} else if (r3 == 2) {
    				npcs[i].attackType = 0;
    				npcs[i].projectileId = -1;
    			}			
    			break;
    			case 2743:
    				npcs[i].attackType = 2;
    				npcs[i].projectileId = 445;
    				npcs[i].endGfx = 446;
    			break;
    			
    			case 2631:
    				npcs[i].attackType = 1;
    				npcs[i].projectileId = 443;
    			break;
    		}
    	}
    		
    	/**
    	* Distanced required to attack
    	**/	
    	public int distanceRequired(int i) {
    		switch(npcs[i].npcType) {
    			case 2025:
    			case 2028:
    			return 6;
    			case 50:
    			case 2562:
    			return 2;
    			case 2881://dag kings
    			case 2882:
    			case 3200://chaos ele
    			case 2743:
    			case 2631:
    			case 2745:
    			return 8;
    			case 2883://rex
    			return 1;
    			case 2552:
    			case 2553:
    			case 2556:
    			case 2557:
    			case 2558:
    			case 2559:
    			case 2560:
    			case 2564:
    			case 2565:
    			return 9;
    			//things around dags
    			case 2892:
    			case 2894:
    			return 10;
    			default:
    			return 1;
    		}
    	}
    	
    	public int followDistance(int i) {
    		switch (npcs[i].npcType) {
    			case 2550:
    			case 2551:
    			case 2562:
    			case 2563:
    			return 8;
    			case 2883:
    			return 4;
    			case 2881:
    			case 2882:
    			return 1;
    		
    		}
    		return 0;
    		
    	
    	}
    	
    	public int getProjectileSpeed(int i) {
    		switch(npcs[i].npcType) {
    			case 2881:
    			case 2882:
    			case 3200:
    			return 85;
    			
    			case 2745:
    			return 130;
    			
    			case 50:
    			return 90;
    			
    			case 2025:
    			return 85;
    			
    			case 2028:
    			return 80;
    			
    			default:
    			return 85;
    		}
    	}
    	
    	/**
    	*NPC Attacking Player
    	**/
    	
    	public void attackPlayer(Client c, int i) {
    		if(npcs[i] != null) {
    			if (npcs[i].isDead)
    				return;
    			if (!npcs[i].inMulti() && npcs[i].underAttackBy > 0 && npcs[i].underAttackBy != c.playerId) {
    				npcs[i].killerId = 0;
    				return;
    			}
    			if (!npcs[i].inMulti() && (c.underAttackBy > 0 || (c.underAttackBy2 > 0 && c.underAttackBy2 != i))) {
    				npcs[i].killerId = 0;
    				return;
    			}
    			if (npcs[i].heightLevel != c.heightLevel) {
    				npcs[i].killerId = 0;
    				return;
    			}
    			npcs[i].facePlayer(c.playerId);
    			boolean special = false;//specialCase(c,i);
    			if(goodDistance(npcs[i].getX(), npcs[i].getY(), c.getX(), c.getY(), distanceRequired(i)) || special) {
    				if(c.respawnTimer <= 0) {
    					npcs[i].facePlayer(c.playerId);
    					npcs[i].attackTimer = getNpcDelay(i);
    					npcs[i].hitDelayTimer = getHitDelay(i);
    					npcs[i].attackType = 0;
    					c.getPA().sound(getNpcListAttackSound(npcs[i].npcType));
    					if (special)
    						loadSpell2(i);
    					else
    						loadSpell(i);
    					if (npcs[i].attackType == 3)
    						npcs[i].hitDelayTimer += 2;
    					if (multiAttacks(i)) {
    						multiAttackGfx(i, npcs[i].projectileId);
    						startAnimation(getAttackEmote(i), i);
    						c.getPA().sound(Server.npcHandler.getNpcListAttackSound(NPCHandler.npcs[i].npcType));
    						npcs[i].oldIndex = c.playerId;
    						return;
    					}
    					if(npcs[i].projectileId > 0) {
    						int nX = Server.npcHandler.npcs[i].getX() + offset(i);
    						int nY = Server.npcHandler.npcs[i].getY() + offset(i);
    						int pX = c.getX();
    						int pY = c.getY();
    						int offX = (nY - pY)* -1;
    						int offY = (nX - pX)* -1;
    						c.getPA().createPlayersProjectile(nX, nY, offX, offY, 50, getProjectileSpeed(i), npcs[i].projectileId, 43, 31, -c.getId() - 1, 65);
    					}
    					c.underAttackBy2 = i;
    					c.singleCombatDelay2 = System.currentTimeMillis();
    					npcs[i].oldIndex = c.playerId;
    					startAnimation(getAttackEmote(npcs[i].npcType), i);
    					c.getPA().sound(Server.npcHandler.getNpcListAttackSound(NPCHandler.npcs[i].npcType));
    					c.getPA().removeAllWindows();
    				} 
    			}			
    		}
    	}
    	
    	public int offset(int i) {
    		switch (npcs[i].npcType) {
    			case 50:
    			return 2;
    			case 2881:
    			case 2882:
    			return 1;
    			case 2745:
    			case 2743:
    			return 1;		
    		}
    		return 0;
    	}
    	
    	public boolean specialCase(Client c, int i) { //responsible for npcs that much 
    		if (goodDistance(npcs[i].getX(), npcs[i].getY(), c.getX(), c.getY(), 8) && !goodDistance(npcs[i].getX(), npcs[i].getY(), c.getX(), c.getY(), distanceRequired(i)))
    			return true;
    		return false;
    	}
    	
    	public boolean retaliates(int npcType) {
    		return npcType < 3777 || npcType > 3780 && !(npcType >= 2440 && npcType <= 2446);
    	}
    	
    	public void applyDamage(int i) {
    		if(npcs[i] != null) {
    			if(Server.playerHandler.players[npcs[i].oldIndex] == null) {
    				return;
    			}
    			if (npcs[i].isDead)
    				return;
    			Client c = (Client) Server.playerHandler.players[npcs[i].oldIndex];
    			if (multiAttacks(i)) {
    				multiAttackDamage(i);
    				return;
    			}
    			if (c.playerIndex <= 0 && c.npcIndex <= 0)
    				if (c.autoRet == 1)
    					c.npcIndex = i;
    			if(c.attackTimer <= 3 || c.attackTimer == 0 && c.npcIndex == 0 && c.oldNpcIndex == 0) {
    				c.startAnimation(c.getCombat().getBlockEmote());
    			}
    			if(c.respawnTimer <= 0) {	
    				int damage = 0;
    				if(npcs[i].attackType == 0) {
    					damage = Misc.random(npcs[i].maxHit);
    					if (10 + Misc.random(c.getCombat().calculateMeleeDefence()) > Misc.random(Server.npcHandler.npcs[i].attack)) {
    						damage = 0;
    					}				
    					if(c.prayerActive[18]) { // protect from melee
    						damage = 0;
    					}				
    					if (c.playerLevel[3] - damage < 0) { 
    						damage = c.playerLevel[3];
    					}
    				}
    				
    				if(npcs[i].attackType == 1) { // range
    					damage = Misc.random(npcs[i].maxHit);
    					if (10 + Misc.random(c.getCombat().calculateRangeDefence()) > Misc.random(Server.npcHandler.npcs[i].attack)) {
    						damage = 0;
    					}					
    					if(c.prayerActive[17]) { // protect from range
    						damage = 0;
    					}				
    					if (c.playerLevel[3] - damage < 0) { 
    						damage = c.playerLevel[3];
    					}
    				}
    				
    				if(npcs[i].attackType == 2) { // magic
    					damage = Misc.random(npcs[i].maxHit);
    					boolean magicFailed = false;
    					if (10 + Misc.random(c.getCombat().mageDef()) > Misc.random(Server.npcHandler.npcs[i].attack)) {
    						damage = 0;
    						magicFailed = true;
    					}				
    					if(c.prayerActive[16]) { // protect from magic
    						damage = 0;
    						magicFailed = true;
    					}				
    					if (c.playerLevel[3] - damage < 0) { 
    						damage = c.playerLevel[3];
    					}
    					if(npcs[i].endGfx > 0 && (!magicFailed || isFightCaveNpc(i))) {
    						c.gfx100(npcs[i].endGfx);
    					} else {
    						c.gfx100(85);
    					}
    				}
    				
    				if (npcs[i].attackType == 3) { //fire breath
    					int anti = c.getPA().antiFire();
    					if (anti == 0) {
    						damage = Misc.random(30) + 10;
    						c.sendMessage("You are badly burnt by the dragon fire!");
    					} else if (anti == 1)
    						damage = Misc.random(20);
    					else if (anti == 2)
    						damage = Misc.random(5);
    					if (c.playerLevel[3] - damage < 0)
    						damage = c.playerLevel[3];
    					c.gfx100(npcs[i].endGfx);
    				}
    				handleSpecialEffects(c, i, damage);
    				c.logoutDelay = System.currentTimeMillis(); // logout delay
    				//c.setHitDiff(damage);
    				c.handleHitMask(damage);
    				c.playerLevel[3] -= damage;
    				c.getPA().refreshSkill(3);
    				c.updateRequired = true;
    				//c.setHitUpdateRequired(true);	
    			}
    		}
    	}
    	
    	public void handleSpecialEffects(Client c, int i, int damage) {
    		if (npcs[i].npcType == 2892 || npcs[i].npcType == 2894) {
    			if (damage > 0) {
    				if (c != null) {
    					if (c.playerLevel[5] > 0) {
    						c.playerLevel[5]--;
    						c.getPA().refreshSkill(5);
    						c.getPA().appendPoison(12);
    					}
    				}			
    			}	
    		}
    	
    	}
    		
    		
    
    	public static void startAnimation(int animId, int i) {
    		npcs[i].animNumber = animId;
    		npcs[i].animUpdateRequired = true;
    		npcs[i].updateRequired = true;
    	}
    	
    	public boolean goodDistance(int objectX, int objectY, int playerX, int playerY, int distance) {
    		for (int i = 0; i <= distance; i++) {
    		  for (int j = 0; j <= distance; j++) {
    			if ((objectX + i) == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
    				return true;
    			} else if ((objectX - i) == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
    				return true;
    			} else if (objectX == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
    				return true;
    			}
    		  }
    		}
    		return false;
    	}
    	
          
    	public int getMaxHit(int i) {
    		switch (npcs[i].npcType) {
    			case 2558:
    				if (npcs[i].attackType == 2)
    					return 28;
    				else
    					return 68;
    			case 2562:
    				return 31;
    			case 2550:
    				return 36;
    		}
    		return 1;
    	}
    	
    	
    	public boolean loadAutoSpawn(String FileName) {
    		String line = "";
    		String token = "";
    		String token2 = "";
    		String token2_2 = "";
    		String[] token3 = new String[10];
    		boolean EndOfFile = false;
    		int ReadMode = 0;
    		BufferedReader characterfile = null;
    		try {
    			characterfile = new BufferedReader(new FileReader("./"+FileName));
    		} catch(FileNotFoundException fileex) {
    			Misc.println(FileName+": file not found.");
    			return false;
    		}
    		try {
    			line = characterfile.readLine();
    		} catch(IOException ioexception) {
    			Misc.println(FileName+": error loading file.");
    			return false;
    		}
    		while(EndOfFile == false && line != null) {
    			line = line.trim();
    			int spot = line.indexOf("=");
    			if (spot > -1) {
    				token = line.substring(0, spot);
    				token = token.trim();
    				token2 = line.substring(spot + 1);
    				token2 = token2.trim();
    				token2_2 = token2.replaceAll("\t\t", "\t");
    				token2_2 = token2_2.replaceAll("\t\t", "\t");
    				token2_2 = token2_2.replaceAll("\t\t", "\t");
    				token2_2 = token2_2.replaceAll("\t\t", "\t");
    				token2_2 = token2_2.replaceAll("\t\t", "\t");
    				token3 = token2_2.split("\t");
    				if (token.equals("spawn")) {
    					newNPC(Integer.parseInt(token3[0]), Integer.parseInt(token3[1]), Integer.parseInt(token3[2]), Integer.parseInt(token3[3]), Integer.parseInt(token3[4]), getNpcListHP(Integer.parseInt(token3[0])));
    				
    				}
    			} else {
    				if (line.equals("[ENDOFSPAWNLIST]")) {
    					try { characterfile.close(); } catch(IOException ioexception) { }
    					return true;
    				}
    			}
    			try {
    				line = characterfile.readLine();
    			} catch(IOException ioexception1) { EndOfFile = true; }
    		}
    		try { characterfile.close(); } catch(IOException ioexception) { }
    		return false;
    	}
    	public int getNpcListAttackSound(int npcId) {
    		for (int i = 0; i < maxListedNPCs; i++) {
    			if (NpcList[i] != null) {
    				if (NpcList[i].npcId == npcId) {
    					return NpcList[i].attackSound;
    				}
    			}
    		}
    		return 0;
    	}
    	public int getNpcListBlockSound(int npcId) {
    		for (int i = 0; i < maxListedNPCs; i++) {
    			if (NpcList[i] != null) {
    				if (NpcList[i].npcId == npcId) {
    					return NpcList[i].blockSound;
    				}
    			}
    		}
    		return 0;
    	}
    	public int getNpcListDieSound(int npcId) {
    		for (int i = 0; i < maxListedNPCs; i++) {
    			if (NpcList[i] != null) {
    				if (NpcList[i].npcId == npcId) {
    					System.out.println("Die Sound: "+NpcList[i].dieSound);
    					return NpcList[i].dieSound;
    				}
    			}
    		}
    		return 0;
    	}
    	public int getNpcListHP(int npcId) {
    		for (int i = 0; i < maxListedNPCs; i++) {
    			if (NpcList[i] != null) {
    				if (NpcList[i].npcId == npcId) {
    					return NpcList[i].npcHealth;
    				}
    			}
    		}
    		return 0;
    	}
    	public int getNpcListMaxHit(int npcId) {
    		for (int i = 0; i < maxListedNPCs; i++) {
    			if (NpcList[i] != null) {
    				if (NpcList[i].npcId == npcId) {
    					return NpcList[i].maxHit;
    				}
    			}
    		}
    		return 0;
    	}
    	
    	public int getNpcListAttack(int npcId) {
    		for (int i = 0; i < maxListedNPCs; i++) {
    			if (NpcList[i] != null) {
    				if (NpcList[i].npcId == npcId) {
    					return NpcList[i].attack;
    				}
    			}
    		}
    		return 0;
    	}
    	
    	public int getNpcListDefence(int npcId) {
    		for (int i = 0; i < maxListedNPCs; i++) {
    			if (NpcList[i] != null) {
    				if (NpcList[i].npcId == npcId) {
    					return NpcList[i].defence;
    				}
    			}
    		}
    		return 0;
    	}
    	
    	public String getNpcListName(int npcId) {
    		for (int i = 0; i < maxListedNPCs; i++) {
    			if (NpcList[i] != null) {
    				if (NpcList[i].npcId == npcId) {
    					return NpcList[i].npcName.replace("_", " ");
    				}
    			}
    		}
    		return "nothing";
    	}
    	
    	public static int getAttackEmote(int npcId) {
    		for (int i = 0; i < maxListedNPCs; i++) {
    			if (NpcList[i] != null) {
    				if (NpcList[i].npcId == npcId) {
    					return NpcList[i].atkanim;
    				}
    			}
    		}
    		return 0;	
    	}
    	
    	public static int getBlockEmote(int npcId) {
    		for (int i = 0; i < maxListedNPCs; i++) {
    			if (NpcList[i] != null) {
    				if (NpcList[i].npcId == npcId) {
    					return NpcList[i].blockanim;
    				}
    			}
    		}
    		return 0;	
    	}
    	
    	public static int getDeadEmote(int npcId) {
    		for (int i = 0; i < maxListedNPCs; i++) {
    			if (NpcList[i] != null) {
    				if (NpcList[i].npcId == npcId) {
    					return NpcList[i].dieanim;
    				}
    			}
    		}
    		return 0;	
    	}
    	
    	public void loadDrops(String FileName) {
    		String line = "";
    		boolean EndOfFile = false;
    		int ReadMode = 0;
    		BufferedReader file = null;
    		try {
    			file = new BufferedReader(new FileReader(FileName));
    		} catch(FileNotFoundException fileex) {
    			return;
    		}
    		try {
    			line = file.readLine();
    		} catch(IOException ioexception) {
    			return;
    		}
    		while(EndOfFile == false && line != null) {
    			line = line.trim();
    			try {
    				line = file.readLine();
    				if(line.equals(".")) {
    					file.close();
    					return;
    				}
    				String[] split = line.split(" ");
    				if(!(line.startsWith("//")) || !line.startsWith("."))
    					drop[Integer.parseInt(split[0])].addDrop(Integer.parseInt(split[1]), Integer.parseInt(split[2]), Integer.parseInt(split[3]));
    			} catch(IOException ioexception1) { EndOfFile = true; }
    		}
    		try { 
    		file.close(); 
    		} catch(IOException ioexception) { 
    		}
    	}
    
    	public boolean loadNPCList(String FileName) {
    		String line = "";
    		String token = "";
    		String token2 = "";
    		String token2_2 = "";
    		String[] token3 = new String[10];
    		boolean EndOfFile = false;
    		int ReadMode = 0;
    		BufferedReader characterfile = null;
    		try {
    			characterfile = new BufferedReader(new FileReader("./"+FileName));
    		} catch(FileNotFoundException fileex) {
    			Misc.println(FileName+": file not found.");
    			return false;
    		}
    		try {
    			line = characterfile.readLine();
    		} catch(IOException ioexception) {
    			Misc.println(FileName+": error loading file.");
    			return false;
    		}
    		while(EndOfFile == false && line != null) {
    			line = line.trim();
    			int spot = line.indexOf("=");
    			if (spot > -1) {
    				token = line.substring(0, spot);
    				token = token.trim();
    				token2 = line.substring(spot + 1);
    				token2 = token2.trim();
    				token2_2 = token2.replaceAll("\t\t", "\t");
    				token2_2 = token2_2.replaceAll("\t\t", "\t");
    				token2_2 = token2_2.replaceAll("\t\t", "\t");
    				token2_2 = token2_2.replaceAll("\t\t", "\t");
    				token2_2 = token2_2.replaceAll("\t\t", "\t");
    				token3 = token2_2.split("\t");
    				if (token.equals("npc")) {
    					if(token3.length == 4) {
    						newNPCList(Integer.parseInt(token3[0]), token3[1], Integer.parseInt(token3[2]), Integer.parseInt(token3[3]), 0, 0, 0, 0x326, 404, 2304);
    					} else {
    						newNPCList(Integer.parseInt(token3[0]), token3[1], Integer.parseInt(token3[2]), Integer.parseInt(token3[3]), Integer.parseInt(token3[4]), Integer.parseInt(token3[5]), Integer.parseInt(token3[6]), Integer.parseInt(token3[7]), Integer.parseInt(token3[8]), Integer.parseInt(token3[9]));
    					}
    				}
    			} else {
    				if (line.equals("[ENDOFNPCLIST]")) {
    					try { characterfile.close(); } catch(IOException ioexception) { }
    					return true;
    				}
    			}
    			try {
    				line = characterfile.readLine();
    			} catch(IOException ioexception1) { EndOfFile = true; }
    		}
    		try { characterfile.close(); } catch(IOException ioexception) { }
    		return false;
    	}
    	public boolean loadNPCSounds(String FileName) {
    		String line = "";
    		boolean EndOfFile = false;
    		int ReadMode = 0;
    		BufferedReader file = null;
    		try {
    			file = new BufferedReader(new FileReader("./"+FileName));
    		} catch(FileNotFoundException fileex) {
    			return false;
    		}
    		try {
    			line = file.readLine();
    		} catch(IOException ioexception) {
    			return false;
    		}
    		while(EndOfFile == false && line != null) {
    			line = line.trim();
    			try {
    				line = file.readLine();
    				if(line.equals(".")) {
    					file.close();
    					return true;
    				}
    				String[] split = line.split("	");
    				if(!line.startsWith("//") && !line.startsWith(".")) {
    					newNPCSound(Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2]), Integer.parseInt(split[3]));
    				}
    			} catch(IOException ioexception1) { EndOfFile = true; }
    		}
    		try { 
    		file.close(); 
    		} catch(IOException ioexception) { 
    		}
    		return false;
    	}	
    
    }

    Thanks+Rep if anyone can help me :L

    Thanks for reading.
    Reply With Quote  
     

  2. #2  
    Development Services √

    Oogle's Avatar
    Join Date
    Apr 2012
    Age
    25
    Posts
    3,976
    Thanks given
    650
    Thanks received
    516
    Rep Power
    483
    For ur first one remove

    if(c.getPrayer().buryBone(itemId, itemSlot))
    return;
    if(Food.eatFood(c, itemId, itemSlot))
    return;
    c.sendMessage("Nothing interesting happens.");
    }

    }


    Attached image

    Attached image
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member
    Join Date
    Sep 2012
    Posts
    63
    Thanks given
    15
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by Ream™ View Post
    Give me one min and ill try work out the other
    Aha, can't believe I missed that one, thanks
    Although I removed the
    Code:
    public static int eatAnim = 829;
    instead
    And pots still don't work
    Reply With Quote  
     

  5. #4  
    Duration Developer
    Intrum's Avatar
    Join Date
    Jul 2012
    Posts
    871
    Thanks given
    46
    Thanks received
    147
    Rep Power
    66
    if(c.getPrayer().buryBone(itemId, itemSlot))
    return;
    if(Food.eatFood(c, itemId, itemSlot))
    return;
    c.sendMessage("Nothing interesting happens.");
    }

    }
    Did you read it or what? - Not sure if this was solved.
    Reply With Quote  
     

  6. #5  
    Registered Member
    Join Date
    Sep 2012
    Posts
    63
    Thanks given
    15
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by Intrum View Post
    Did you read it or what? - Not sure if this was solved.
    Yes, I read it, food works now, but potions still don't.
    Reply With Quote  
     

  7. #6  
    Development Services √

    Oogle's Avatar
    Join Date
    Apr 2012
    Age
    25
    Posts
    3,976
    Thanks given
    650
    Thanks received
    516
    Rep Power
    483
    Playerassistant.java
    Search

    c.startAnimation(8939);
    Chnage the "8939" Thats the animation code.


    Attached image

    Attached image
    Reply With Quote  
     

  8. #7  
    Registered Member
    Join Date
    Sep 2012
    Posts
    63
    Thanks given
    15
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by Ream™ View Post
    Search



    Chnage the "8939" Thats the animation code.
    For what?
    I don't understand what this's for :L
    Reply With Quote  
     

  9. #8  
    Development Services √

    Oogle's Avatar
    Join Date
    Apr 2012
    Age
    25
    Posts
    3,976
    Thanks given
    650
    Thanks received
    516
    Rep Power
    483
    The death animation :L


    Attached image

    Attached image
    Reply With Quote  
     

  10. #9  
    Registered Member
    Join Date
    Sep 2012
    Posts
    63
    Thanks given
    15
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by Ream™ View Post
    The death animation :L
    Oh, I'm looking for a java file that controls all NPC death anims, as I need to change them for things like turoths, thanks for trying though
    Reply With Quote  
     

  11. #10  
    Registered Member

    Join Date
    Oct 2011
    Age
    28
    Posts
    1,880
    Thanks given
    311
    Thanks received
    557
    Rep Power
    703
    Quote Originally Posted by FaintView View Post
    Oh, I'm looking for a java file that controls all NPC death anims, as I need to change them for things like turoths, thanks for trying though
    NPCHandler, something like getDeadEmote
    Reply With Quote  
     

Page 1 of 3 123 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [PI]Several Things[/PI]
    By atsiv3 in forum Help
    Replies: 8
    Last Post: 06-16-2011, 06:57 AM
  2. a few things
    By Lord Stark in forum Help
    Replies: 5
    Last Post: 08-09-2010, 06:35 AM
  3. Few Things
    By hellpkz in forum Help
    Replies: 4
    Last Post: 03-19-2010, 12:51 AM
  4. 2 things
    By Eminem™ in forum Help
    Replies: 1
    Last Post: 03-26-2009, 02:12 AM
  5. A few things...
    By CrotchFruit in forum Help
    Replies: 3
    Last Post: 03-22-2009, 01:32 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •