Thread: Need Help with NPCLookup/Itemlookup 718 rsps Matrix Base

Results 1 to 3 of 3
  1. #1 Need Help with NPCLookup/Itemlookup 718 rsps Matrix Base 
    Registered Member
    Join Date
    Oct 2017
    Posts
    16
    Thanks given
    1
    Thanks received
    0
    Rep Power
    11
    Hi guys trying to add the "Itemlookup" and "Npclookup"
    just got this error code?
    still learning java coding and im not the best
    so please no hate..
    if someone could help me out would be much appreciated

    starting...
    src\com\rs\game\player\InterfaceManager.java:340: error: incompatible types: ArrayList<Drop> cannot be converted to Drop[]
    Drop[] drops = NPCDrops.getDrops(def.getId());
    ^
    src\com\rs\game\player\InterfaceManager.java:355: error: cannot find symbol
    .append(" {").append((int) drop.getRate()).append("% Chance}");
    ^
    symbol: method getRate()
    location: variable drop of type Drop
    src\com\rs\game\player\InterfaceManager.java:375: error: incompatible types: ArrayList<Drop> cannot be converted to Drop[]
    Drop[] drops = NPCDrops.getDrops(defs.getId());
    ^
    src\com\rs\game\player\InterfaceManager.java:385: error: cannot find symbol
    .append(" {").append((int) drop.getRate()).append("% Chance}");
    ^
    symbol: method getRate()
    location: variable drop of type Drop
    Note: src\com\rs\game\player\Player.java uses or overrides a deprecated API.
    Note: Recompile with -Xlinteprecation for details.
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    4 errors
    Press any key to continue . . .
    Reply With Quote  
     

  2. #2  
    Coming Soon!
    Zolak's Avatar
    Join Date
    Feb 2016
    Posts
    31
    Thanks given
    6
    Thanks received
    11
    Rep Power
    12
    Not really sure what you want it to do but here's how the code in my old 718 source looks like

    Spoiler for codes:

    Firstly, put this in DropUtils.Java or create the file if yours is missing. And add this to the file:
    public static final void sendNPCDrops(final Player player, final String name) {
    for (int i = 0; i < Utils.getNPCDefinitionsSize(); i++) {
    NPCDefinitions def = NPCDefinitions.getNPCDefinitions(i);
    if (def.getName().toLowerCase().equalsIgnoreCase(name ) && NPCDrops.getDrops(i) != null && NPCDrops.getDrops(i).length != 0) {
    player.stopAll();
    sendNPCDrops(player, i);
    return;
    }
    }
    player.sendMessage("Could not find any NPC by the name of '" + name + "'.");
    }

    private static final void sendNPCDrops(final Player player, final int id) {
    final Drop[] drops = NPCDrops.getDrops(id);
    final List<Drop> dropList = new ArrayList<Drop>();
    player.getPackets().sendIComponentText(1245, 330, "<col=9900FF><shad=000000>" + NPCDefinitions.getNPCDefinitions(id).getName() + "</col></shad>");
    for (int i = 0; i < 316; i++)
    player.getPackets().sendIComponentText(1245, i, "");
    for (int i = 0; i < drops.length; i++) {
    if (i > 300)
    break;
    if (drops[i].getRate() == 100) {
    dropList.add(new Drop(drops[i].getItemId(), 100, drops[i].getMinAmount(), drops[i].getMaxAmount()));
    continue;
    }
    dropList.add(new Drop(drops[i].getItemId(), drops[i].getRate(), drops[i].getMinAmount(), drops[i].getMaxAmount()));
    }
    Collections.sort(dropList, new Comparator<Drop>() {
    @Override
    public int compare(Drop c1, Drop c2) {
    return Double.compare(c2.getRate(), c1.getRate());
    }
    });
    player.getPackets().sendIComponentText(1245, 13, "Item: Quantity | Rate");
    for (int i = 0; i < dropList.size(); i++) {
    Drop drop = dropList.get(i);
    player.getPackets().sendIComponentText(1245, 14 + i, ItemDefinitions.getItemDefinitions(drop.getItemId( )).getName() + ": " + (drop.getMinAmount() == drop.getMaxAmount() ? drop.getMinAmount() : drop.getMinAmount() + "-" + drop.getMaxAmount()) + " | " + Utils.round(drop.getRate(), 3) + "%");
    }
    player.getPackets().sendRunScript(4017, new Object[] { dropList.size() + 1 });
    player.getInterfaceManager().sendInterface(1245);
    }

    public static final void sendItemDrops(final Player player, final String name) {
    for (int i = 0; i < Utils.getItemDefinitionsSize(); i++) {
    ItemDefinitions def = ItemDefinitions.getItemDefinitions(i);
    if (def.getName().toLowerCase().equalsIgnoreCase(name )) {
    player.stopAll();
    sendItemDrops(player, i);
    return;
    }
    }
    player.sendMessage("Could not find any drops by the name of '" + name + "'.");
    }

    private static final void sendItemDrops(final Player player, final int id) {
    final Map<Drop, String> dropList = new HashMap<Drop, String>();
    loop : for (int i = 0; i < Utils.getNPCDefinitionsSize(); i++) {
    final Drop[] loot = NPCDrops.getDrops(i);
    if (loot == null || loot.length == 0)
    continue;
    for (Drop drop : loot) {
    if (drop.getItemId() == id) {
    final NPCDefinitions defs = NPCDefinitions.getNPCDefinitions(i);
    if (dropList.containsValue(defs.getName() + " (level: " + defs.combatLevel + ")"))
    continue;
    if (defs.combatLevel == 0)
    continue;
    if (defs.name.equals("null"))
    continue;
    dropList.put(new Drop(id, drop.getRate(), drop.getMinAmount(), drop.getMaxAmount()), defs.getName() + " (level: " + defs.combatLevel + ")");
    if (dropList.size() > 300)
    break loop;
    }
    }
    }
    List<Entry<Drop, String>> listOfEntries = new ArrayList<Entry<Drop, String>>(dropList.entrySet());
    Comparator<Entry<Drop, String>> comparator = new Comparator<Entry<Drop, String>>() {
    @Override
    public int compare(Entry<Drop, String> e1, Entry<Drop, String> e2) {
    return Double.compare(e2.getKey().getRate(), e1.getKey().getRate());
    }
    };
    Collections.sort(listOfEntries, comparator);
    player.getPackets().sendIComponentText(1245, 330, "<col=9900FF><shad=000000>" + ItemDefinitions.getItemDefinitions(id).getName() + "</col></shad>");
    for (int i = 0; i < 316; i++)
    player.getPackets().sendIComponentText(1245, i, "");
    player.getPackets().sendIComponentText(1245, 13, "NPC: Quantity | Rate");
    for (int i = 0; i < listOfEntries.size(); i++) {
    Entry<Drop, String> drop = listOfEntries.get(i);
    player.getPackets().sendIComponentText(1245, 14 + i, drop.getValue() + ": " + (drop.getKey().getMinAmount() == drop.getKey().getMaxAmount() ? drop.getKey().getMinAmount() : drop.getKey().getMinAmount() + "-" + drop.getKey().getMaxAmount()) + " | " + Utils.round(drop.getKey().getRate(), 3) + "%");
    }
    if (listOfEntries.size() > 11)
    player.getPackets().sendRunScript(4017, new Object[] { (listOfEntries.size() ) > 300 ? 300 : listOfEntries.size() + 1});
    player.getInterfaceManager().sendInterface(1245);
    }

    From there, add this in commands.java: (obviously you need to switch into case)
    case "npclookup":
    StringBuilder npcNameSB = new StringBuilder(cmd[1]);
    if (cmd.length > 1) {
    for (int i = 2; i < cmd.length; i++) {
    npcNameSB.append(" ").append(cmd[i]);
    }
    }
    DropUtils.sendNPCDrops(player, npcNameSB.toString());
    return true;

    case "itemlookup":
    StringBuilder itemName = new StringBuilder(cmd[1]);
    if (cmd.length > 1) {
    for (int i = 2; i < cmd.length; i++) {
    itemName.append(" ").append(cmd[i]);
    }
    }
    DropUtils.sendItemDrops(player, itemName.toString());
    return true;



    Try it out, see if it works, let me know if there's any errors

    Owner of Zolak - 2021 Release!
    Reply With Quote  
     

  3. #3  
    Clarity Owner

    Join Date
    Oct 2020
    Posts
    18
    Thanks given
    19
    Thanks received
    1
    Rep Power
    12
    Wrong section dude. This is GRAPHICS help
    Reply With Quote  
     


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. Replies: 3
    Last Post: 08-31-2017, 06:57 PM
  2. Replies: 17
    Last Post: 08-30-2017, 08:05 AM
  3. Need help with coding my 718 Matrix
    By kleinekevermans in forum Requests
    Replies: 4
    Last Post: 10-20-2013, 08:16 PM
  4. Need help with trade logs! 718+
    By Ben_U in forum Help
    Replies: 4
    Last Post: 10-21-2012, 12:28 AM
  5. I need help with editing a 639 RSPS
    By dunno11 in forum Help
    Replies: 1
    Last Post: 10-19-2012, 02:44 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •