Took me about half an hour .
Replace your npc drops array in Config.java with this:
Code:
/**
* NPC DROPS
**/
//{npc Type, item id , amount, chance}
public static int[][] NPC_DROPS = new int[4000][1000];
Add this method in Config.java:
Code:
public static void loadNpcDrops(String fileName) {
String line = "";
String token = "";
String token2 = "";
String token2_2 = "";
String[] token3 = new String[10];
boolean EndOfFile = false;
int ReadMode = 0;
BufferedReader dropFile = null;
try {
dropFile = new BufferedReader(new FileReader("./bin/cfg/"+fileName));
} catch(FileNotFoundException fileex) {
Misc.println(fileName+": file not found.");
return;
}
try {
line = dropFile.readLine();
} catch(IOException ioexception) {
Misc.println(fileName+": error loading file.");
return;
}
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("drop")) {
NPC_DROPS[Integer.parseInt(token3[0])][0] = Integer.parseInt(token3[0]);
for(int i = 0; i < (int)((token3.length) / 3); i++) {
if(token3[1 + (i * 3)] != null) {
NPC_DROPS[Integer.parseInt(token3[0])][1+(i*3)] = Integer.parseInt(token3[1+(i*3)]);
NPC_DROPS[Integer.parseInt(token3[0])][2+(i*3)] = Integer.parseInt(token3[2+(i*3)]);
NPC_DROPS[Integer.parseInt(token3[0])][3+(i*3)] = Integer.parseInt(token3[3+(i*3)]);
}
}
}
} else {
if (line.equals("[ENDOFDROPLIST]")) {
try { dropFile.close(); } catch(IOException ioexception) { }
return;
}
}
try {
line = dropFile.readLine();
} catch(IOException ioexception1) { EndOfFile = true; }
}
try { dropFile.close(); } catch(IOException ioexception) { }
return;
}
Open Server.java and find:
Code:
clientHandler = new Server();
and under it add:
Code:
Config.loadNpcDrops("drops.cfg");
Open NpcHandler.java and find your dropItems method and replace it with this:
Code:
public void dropItems(int i) {
int count = 0;
Client c = (Client)Server.playerHandler.players[npcs[i].killedBy];
if(c != null) {
int npc = npcs[i].npcType;
if(Config.NPC_DROPS[npc][0] <= 0) {
return;
}
for(int x = 0; x < (Config.NPC_DROPS[npc].length); x++) {
if(Config.NPC_DROPS[npc][1+(x*3)] <= 0) {
return;
}
if(Misc.random(Config.NPC_DROPS[npc][3+(x*3)]) == 0) {
c.getItemHandler().addItem(Config.NPC_DROPS[npc][1+(x*3)], npcs[i].absX, npcs[i].absY, Config.NPC_DROPS[npc][2+(x*3)], c.playerId, false);
if(Config.NPC_DROPS[npc][3] > 0) {
return;
}
}
}
}
}
NOTE: YOU MAY HAVE TO CHANGE THE addItem TO createGroundItem DEPENDING ON WHICH VERSION OF EMULOUS YOU HAVE (THIS IS FOR 1.6.2).
Now create your drop file and replace it with your other .cfg files in ./bin/cfg:
Code:
//drop = npcID itemId amount chance itemId amount chance
drop = 1 526 1 0 1323 1 0 995 100 0
[ENDOFDROPLIST]
That for example would make a man always drop iron scimmy, bones and 100 coins.
NOTE: You must put drops with a 100% drop rate BEFORE your other drops, otherwise they will not drop. For example if you want to drop a rune scimmy with a 50% chance, but bones with a 100% chance you would put:
Code:
drop = npcId 526 1 0 1333 1 1
Post if you have any problems with it.