Or just pack them into the file??
|
Tutorial Difficulty: 1 if followed correctly
Author: Me
Base: Hyperion
Ok well in hyperion the item.cfg(so it is called) is packed into a file only readable by the jvm well i have found a simple way around this(wasent hard took all of 2 mins)
Well i will start instead of having you read long and boring stuff
Open ItemDefinition.java located in rs2/model and find
replace that withCode:definitions = new ItemDefinition[count];
That will allow for more item's to be placed in the item definition'sCode:definitions = new ItemDefinition[count+2000];
Also in ItemDefinition.java find
above all that addCode:/** * Loads the item definitions. * @throws IOException if an I/O error occurs. * @throws IllegalStateException if the definitions have been loaded already. */ public static void init() throws IOException {
Then before the bottem bracket in init() addCode:public static void loadCustomItems() { for(int i = 0; i < definitions.length; i++) { if(definitions[i] == null) { //reference //definitions[i+1] = new ItemDefinition(i+1, name, examine, noted, noteable, stackable, parentId, notedId, members, shop, highAlc, lowAlc); //7957 definitions[i] = new ItemDefinition(i, "Custom Item 1", "It's a null.", false, false, false, -1, -1, false, 1, 1, 1); //7958 definitions[i+1] = new ItemDefinition(i+1, "Custom Item 2", "It's a null.", false, false, false, -1, -1, false, 1, 1, 1); //7959 definitions[i+3] = new ItemDefinition(i+3, "Custom Item 1", "It's a null.", false, false, false, -1, -1, false, 1, 1, 1); return; } } }
I compiled and it work but i dont know about inside them game. Give feedbackCode:loadCustomItems();
Or just pack them into the file??
Not sure if serious..Ok well in hyperion the item.cfg(so it is called) is packed into a file only readable by the jvm well i have found a simple way around this
Oh kewl, "hardcoding" has reached servers
LOL @ hardcoding
http://**********/v/FB1R9AD5 <-- put in C
^ all 459 configsCode:public static void init() throws IOException { if(definitions != null) { throw new IllegalStateException("Definitions already loaded."); } logger.info("Loading definitions..."); RandomAccessFile raf = new RandomAccessFile("C:\\itemDefinitions.bin", "r"); try { ByteBuffer buffer = raf.getChannel().map(MapMode.READ_ONLY, 0, raf.length()); int count = buffer.getShort() & 0xFFFF; definitions = new ItemDefinition[count]; for(int i = 0; i < count; i++) { //System.out.println(i); String name = Buffers.readString(buffer); String examine = Buffers.readString(buffer); boolean noted = buffer.get() == 1 ? true : false; int parentId = buffer.getShort() & 0xFFFF; if(parentId == 65535) { parentId = -1; } boolean noteable = buffer.get() == 1 ? true : false; int notedId = buffer.getShort() & 0xFFFF; if(notedId == 65535) { notedId = -1; } boolean stackable = buffer.get() == 1 ? true : false; boolean members = buffer.get() == 1 ? true : false; boolean prices = buffer.get() == 1 ? true : false; int shop = -1; int highAlc = -1; int lowAlc = -1; if(prices) { shop = buffer.getInt(); highAlc = (int) (shop * 0.6D); lowAlc = (int) (shop * 0.4D); } int[] bonuses = new int[12]; for(int index = 0; index < 12; index++) { bonuses[index] = buffer.getShort(); } definitions[i] = new ItemDefinition(i, name, examine, noted, noteable, stackable, parentId, notedId, members, shop, highAlc, lowAlc, bonuses); } logger.info("Loaded " + definitions.length + " definitions."); } finally { raf.close(); } }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |