Post: [PI] Special Yell [When Player Gets Rare Item]
03-05-2015, 09:34 PM #1
Stunz
Former Staff
(adsbygoogle = window.adsbygoogle || []).push({});
Yell when players get a rare drop so first go to

NPCHandler.java

and find this code

    public boolean rareDrops(int i) {


and replace that with

this

    public boolean rareDrops(int i) {
return Misc.random(NPCDrops.dropRarity.get(npcs[i].npcType)) == 0;
}

int[] rareDrops = {11712, 11728, 11714, 11724, 11704, 11710,
11726, 11710,11706,11712,11714,11730,
11710,11718,11722,11720,11710,11712,
11714,11710,11712,11714,11708,11716,
15018, 15020, 15220, 15019, 3140,
4151, 4214, 4225, 11286, 11235,
13746, 13748, 13750, 13752,
20135, 20139, 20143, 20147, 20151,
20155, 20159, 20163, 20167, 20171};

public boolean announceItem(int id) {

for (int i = 0; i < rareDrops.length; i++) {
if (id == rareDrops[i]) {
return true;
}
}
return false;
}


then find this

    if (NPCDrops.dropRarity.get(npcs[i].npcType) != null) {


and replace that full metod with this

    if (NPCDrops.dropRarity.get(npcs[i].npcType) != null) {
if (rareDrops(i)) {
int random = Misc.random(NPCDrops.rareDrops.get(npcs[i].npcType).length-1);
Server.itemHandler.createGroundItem(c, NPCDrops.rareDrops.get(npcs[i].npcType)[random][0], npcs[i].absX, npcs[i].absY, NPCDrops.rareDrops.get(npcs[i].npcType)[random][1], c.playerId);
if (announceItem(NPCDrops.rareDrops.get(npcs[i].npcType)[random][0])) {
for (int z = 0; z < Server.playerHandler.players.length; z++) {
if (Server.playerHandler.players[z] != null) {
Client o = (Client) Server.playerHandler.players[z];
o.sendMessage("[<col=255>Global</col>] <col=1461281>"+Misc.capitalize(c.playerName)+" has just received x1 <shad>"+c.getItems().getItemName(NPCDrops.rareDrops.get(npcs[i].npcType)[random][0])+"</shad> As A Rare Drop!</col>");
}
}
}
if (c.clanId >= 0)
Server.clanChat.handleLootShare(c, NPCDrops.rareDrops.get(npcs[i].npcType)[random][0], NPCDrops.rareDrops.get(npcs[i].npcType)[random][1]);
} else {
int random = Misc.random(NPCDrops.normalDrops.get(npcs[i].npcType).length-1);
Server.itemHandler.createGroundItem(c, NPCDrops.normalDrops.get(npcs[i].npcType)[random][0], npcs[i].absX, npcs[i].absY, NPCDrops.normalDrops.get(npcs[i].npcType)[random][1], c.playerId);
if (c.clanId >= 0)
Server.clanChat.handleLootShare(c, NPCDrops.normalDrops.get(npcs[i].npcType)[random][0], NPCDrops.normalDrops.get(npcs[i].npcType)[random][1]);
}
}

}
//System.out.println("Took: " + (System.currentTimeMillis() - start));
}


and in

NPCDrops.java

    public static HashMap<Integer, int[][]> rareDrops = new HashMap<Integer, int[][]>();


and import this is NpcDrops,java

    import java.util.HashMap;


    if you get any errors post them and  i help you fix them


if you get this error

    src\server\model\npcs\NPCHandler.java:2478: error: cannot find symbol
c.sendMessage("[
Global "+Misc.capitalize(c.playerName)+" has just received x1 "+c.getItems().get
ItemName(NPCDrops.rareDrops.get(npcs[i].npcType)[random][0])+" As A Rare Drop!")
;

^
symbol: method capitalize(String)
location: class Misc
1 error
Press any key to continue . . .


then change this
    Misc.capitalize


to this

    Misc.optimizeText
(adsbygoogle = window.adsbygoogle || []).push({});

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo