Program: 152205
Project: 152205
Buggy source:
public void handlePacket(Packet p,IoSession session) throws Exception {
  Player player=(Player)session.getAttachment();
  if (player.isBusy()) {
    player.resetPath();
    return;
  }
  player.resetAll();
  Point location=Point.location(p.readShort(),p.readShort());
  int id=p.readShort();
  final ActiveTile tile=world.getTile(location);
  final Item item=getItem(id,tile,player);
  if (item == null) {
    player.resetPath();
    return;
  }
  if (!item.getDef().canTrade()) {
    if (item.droppedby() != 0 && org.moparscape.msc.gs.tools.DataConversions.usernameToHash(player.getUsername()) != item.droppedby()) {
      player.getActionSender().sendMessage("String_Node_Str");
      return;
    }
  }
  if (player.isPMod() && !player.isMod())   return;
  if (item.getDef().isMembers() && !World.isMembers()) {
    player.getActionSender().sendMessage("String_Node_Str");
    return;
  }
  player.setStatus(Action.TAKING_GITEM);
  Instance.getDelayedEventHandler().add(new WalkToPointEvent(player,location,0,true){
    public void arrived(){
      if (owner.isBusy() || owner.isRanging() || !tile.hasItem(item)|| !owner.nextTo(item)|| owner.getStatus() != Action.TAKING_GITEM) {
        return;
      }
      if (item.getID() == 23) {
        owner.getActionSender().sendMessage("String_Node_Str");
        owner.getActionSender().sendMessage("String_Node_Str");
        return;
      }
      int[] Rares={576,577,578,579,580,581,828,831,832,1278,593,594,795};
      boolean pickedUpRare=false;
      if (item.getAmount() > 99999)       pickedUpRare=true;
      for (int i=0; i < Rares.length; i++) {
        if (item.getID() == Rares[i]) {
          pickedUpRare=true;
          break;
        }
      }
      owner.resetAll();
      InvItem invItem=new InvItem(item.getID(),item.getAmount());
      if (!owner.getInventory().canHold(invItem)) {
        owner.getActionSender().sendMessage("String_Node_Str");
        return;
      }
      try {
        if (item.getID() == 59 && item.getX() == 106 && item.getY() == 1476) {
          Npc n=world.getNpc(37,103,107,1476,1479);
          if (n != null && !n.inCombat()) {
            owner.informOfNpcMessage(new ChatMessage(n,"String_Node_Str",owner));
            fight(owner,n);
          }
        }
 else         if (item.getID() == 501 && item.getX() == 333 && item.getY() == 434) {
          Npc zam=world.getNpc(140,328,333,433,438,true);
          if (zam != null && !zam.inCombat()) {
            owner.informOfNpcMessage(new ChatMessage(zam,"String_Node_Str",owner));
            for (int i=0; i < 3; i++) {
              int stat=owner.getCurStat(i);
              if (stat < 3)               owner.setCurStat(i,0);
 else               owner.setCurStat(i,stat - 3);
            }
            owner.getActionSender().sendStats();
            fight(owner,zam);
            return;
          }
        }
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
      if (pickedUpRare) {
        MiscPacketBuilder loginServer=Instance.getServer().getLoginConnector().getActionSender();
        final long droppedby=item.droppedby();
        final long playerLong=org.moparscape.msc.gs.tools.DataConversions.usernameToHash(owner.getUsername());
        loginServer.tradeLog(droppedby,playerLong,item.getID(),item.getAmount(),owner.getX(),owner.getY(),3);
      }
      world.addEntryToSnapshots(new Activity(owner.getUsername(),owner.getUsername() + "String_Node_Str" + item.getDef().getName()+ "String_Node_Str"+ item.getID()+ "String_Node_Str"+ item.getAmount()+ "String_Node_Str"+ owner.getX()+ "String_Node_Str"+ owner.getY()+ "String_Node_Str"+ item.getX()+ "String_Node_Str"+ item.getY()));
      if (item.getAmount() > 10000000 || Formulae.isRareItem(item.getID()))       DBConnection.getReport().submitDupeData(owner.getUsername(),owner.getUsernameHash());
      world.unregisterItem(item);
      owner.getActionSender().sendSound("String_Node_Str");
      owner.getInventory().add(invItem);
      owner.getActionSender().sendInventory();
    }
  }
);
}

Fixed version (ground truth):
public void handlePacket(Packet p,IoSession session) throws Exception {
  Player player=(Player)session.getAttachment();
  if (player.isBusy()) {
    player.resetPath();
    return;
  }
  player.resetAll();
  Point location=Point.location(p.readShort(),p.readShort());
  int id=p.readShort();
  final ActiveTile tile=world.getTile(location);
  final Item item=getItem(id,tile,player);
  if (item == null) {
    player.resetPath();
    return;
  }
  if (!item.getDef().canTrade()) {
    if (item.droppedby() != 0 && org.moparscape.msc.gs.tools.DataConversions.usernameToHash(player.getUsername()) != item.droppedby()) {
      player.getActionSender().sendMessage("String_Node_Str");
      return;
    }
  }
  if (player.isPMod() && !player.isMod())   return;
  if (item.getDef().isMembers() && !World.isMembers()) {
    player.getActionSender().sendMessage("String_Node_Str");
    return;
  }
  player.setStatus(Action.TAKING_GITEM);
  int distance=tile.hasGameObject() ? 1 : 0;
  Instance.getDelayedEventHandler().add(new WalkToPointEvent(player,location,distance,true){
    public void arrived(){
      if (owner.isBusy() || owner.isRanging() || !tile.hasItem(item)|| !owner.nextTo(item)|| owner.getStatus() != Action.TAKING_GITEM) {
        return;
      }
      if (item.getID() == 23) {
        owner.getActionSender().sendMessage("String_Node_Str");
        owner.getActionSender().sendMessage("String_Node_Str");
        return;
      }
      int[] Rares={576,577,578,579,580,581,828,831,832,1278,593,594,795};
      boolean pickedUpRare=false;
      if (item.getAmount() > 99999)       pickedUpRare=true;
      for (int i=0; i < Rares.length; i++) {
        if (item.getID() == Rares[i]) {
          pickedUpRare=true;
          break;
        }
      }
      owner.resetAll();
      InvItem invItem=new InvItem(item.getID(),item.getAmount());
      if (!owner.getInventory().canHold(invItem)) {
        owner.getActionSender().sendMessage("String_Node_Str");
        return;
      }
      try {
        if (item.getID() == 59 && item.getX() == 106 && item.getY() == 1476) {
          Npc n=world.getNpc(37,103,107,1476,1479);
          if (n != null && !n.inCombat()) {
            owner.informOfNpcMessage(new ChatMessage(n,"String_Node_Str",owner));
            fight(owner,n);
          }
        }
 else         if (item.getID() == 501 && item.getX() == 333 && item.getY() == 434) {
          Npc zam=world.getNpc(140,328,333,433,438,true);
          if (zam != null && !zam.inCombat()) {
            owner.informOfNpcMessage(new ChatMessage(zam,"String_Node_Str",owner));
            for (int i=0; i < 3; i++) {
              int stat=owner.getCurStat(i);
              if (stat < 3)               owner.setCurStat(i,0);
 else               owner.setCurStat(i,stat - 3);
            }
            owner.getActionSender().sendStats();
            fight(owner,zam);
            return;
          }
        }
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
      if (pickedUpRare) {
        MiscPacketBuilder loginServer=Instance.getServer().getLoginConnector().getActionSender();
        final long droppedby=item.droppedby();
        final long playerLong=org.moparscape.msc.gs.tools.DataConversions.usernameToHash(owner.getUsername());
        loginServer.tradeLog(droppedby,playerLong,item.getID(),item.getAmount(),owner.getX(),owner.getY(),3);
      }
      world.addEntryToSnapshots(new Activity(owner.getUsername(),owner.getUsername() + "String_Node_Str" + item.getDef().getName()+ "String_Node_Str"+ item.getID()+ "String_Node_Str"+ item.getAmount()+ "String_Node_Str"+ owner.getX()+ "String_Node_Str"+ owner.getY()+ "String_Node_Str"+ item.getX()+ "String_Node_Str"+ item.getY()));
      if (item.getAmount() > 10000000 || Formulae.isRareItem(item.getID()))       DBConnection.getReport().submitDupeData(owner.getUsername(),owner.getUsernameHash());
      world.unregisterItem(item);
      owner.getActionSender().sendSound("String_Node_Str");
      owner.getInventory().add(invItem);
      owner.getActionSender().sendInventory();
    }
  }
);
}