This is a RuneScape Private Server related task
I have this code to start with:
[SPOILER="Code"]
[/spoiler]package com.rs.utility.tools.dumpers; import java.io.IOException; import net.burtleburtle.cache.Cache; import net.burtleburtle.cache.loaders.NPCDefinitions; import com.rs.utility.Misc; import com.rs.utility.npc.NPCDrops; import com.rs.utility.tools.WebPage; /** * @author Tyluur <itstyluur@gmail.com> * @since 2012-09-15 */ public class RSWikiDropDumper { public static void main(String[] args) throws IOException { Cache.init(); for (int i = 0; i < Misc.getNPCDefinitionsSize(); i++) { if (NPCDrops.getDrops(i) == null && NPCDefinitions.getNPCDefinitions(i).hasAttackOption()) { dump(i); } } } private static void dump(int npcId) { String URL = "http://runescape.wikia.com/wiki/" + NPCDefinitions.getNPCDefinitions(npcId).name.replaceAll(" ", "_"); System.out.println("Taking a dump for " + npcId); try { WebPage page = new WebPage(URL); page.load(); for (String lines : page.getLines()) { } } catch (Throwable t) { } System.out.println("web page = " + URL); } }
and the task of it is to dump all NPC (non-player-character) drops. It will be in this format:
[SPOILER="code"]
[/spoiler]public static void loadPackedNPCDrops() { try { RandomAccessFile in = new RandomAccessFile(PACKED_PATH, "r"); FileChannel channel = in.getChannel(); ByteBuffer buffer = channel.map(MapMode.READ_ONLY, 0, channel.size()); int dropMapSize = buffer.getShort(); ArrayList<Drop> drops = null; for (int i = 0; i < dropMapSize; i++) { int npcId = buffer.getShort(); short dropAmount = buffer.getShort(); drops = new ArrayList<Drop>(dropAmount); for (int x = 0; x < dropAmount; x++) drops.add(new Drop(buffer.getShort(), buffer.getInt(), buffer.getInt(), getChanceType(buffer.getInt()))); npcDrops.put(npcId, drops); } loadCustomDrops(); channel.close(); in.close(); } catch (Throwable e) { e.printStackTrace(); } } /** * @return */ private static ChanceType getChanceType(int ordinal) { switch (ordinal) { case 0: return ChanceType.ALWAYS; case 1: return ChanceType.COMMON; case 2: return ChanceType.UNCOMMON; case 3: return ChanceType.RARE; case 4: return ChanceType.VERY_RARE; } return ChanceType.VERY_RARE; }
I need the parsing of the Drops to be completed in this format:
This is the source code for the libraries required to run this script.npcId quantity itemId minimumamount maxamount rarity(saved based on ordinal in enum)
This is an example of one of the lines in the dump of what I have so far from unpacking a buffered file which was released with all of this information, but a minimal dump:
1 31 2485 1 1 3
NOTE: Packaging will be different, eclipse tool to organize imports will do this easily for you.
If you can understand this without any previous RuneScape Private Server knowledge, add my msn: itstyluur@gmail.com
Money will be sent after job is completed and proof is shown via images/teamviewer.