Thread: [HYPERION] Adding new item definition's

Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1 [HYPERION] Adding new item definition's 
    Registered Member
    AlexMason's Avatar
    Join Date
    Aug 2007
    Age
    30
    Posts
    1,199
    Thanks given
    17
    Thanks received
    27
    Rep Power
    98
    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
    Code:
    definitions = new ItemDefinition[count];
    replace that with
    Code:
    definitions = new ItemDefinition[count+2000];
    That will allow for more item's to be placed in the item definition's

    Also in ItemDefinition.java find
    Code:
    	/**
    	 * 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 {
    above all that add
    Code:
    	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;
    			}
    		}
    	}
    Then before the bottem bracket in init() add
    Code:
    loadCustomItems();
    I compiled and it work but i dont know about inside them game. Give feedback

     

  2. #2  
    Registered Member

    Join Date
    Jun 2007
    Posts
    2,237
    Thanks given
    267
    Thanks received
    411
    Rep Power
    1283
    Or just pack them into the file??
    Don't worry, Be happy.
     

  3. #3  
    Member [HYPERION] Adding new item definition's Market Banned


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    35
    Posts
    12,574
    Thanks given
    199
    Thanks received
    7,106
    Rep Power
    5000
    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
    Not sure if serious..

    Attached imageAttached image
     

  4. #4  
    SERGEANT OF THE MASTER SERGEANTS MOST IMPORTANT PERSON OF EXTREME SERGEANTS TO THE MAX!

    cube's Avatar
    Join Date
    Jun 2007
    Posts
    8,871
    Thanks given
    1,854
    Thanks received
    4,745
    Rep Power
    5000
    Oh kewl, "hardcoding" has reached servers

    Attached image

     

  5. #5  
    Apocalyptism
    Harry's Avatar
    Join Date
    Apr 2007
    Posts
    3,783
    Thanks given
    594
    Thanks received
    1,834
    Rep Power
    2934
    LOL @ hardcoding
    ~ Harry
    Please bear this in mind when hearing the word 'soon' from a software programmer.

    As coding software generally takes thousands of years, software programmers have developed a natural adaptation to this in the form of an altered perception of the flow of time.

    Due to this, the word 'soon' when uttered by a programmer should be taken to mean 'a very, very long time from now' in the terminology used by common human specimens who have not developed such an adaptation.
    knowledge can be taught, but passion cannot.
    It's better to create something that others criticise than to create nothing and criticise others.
    Attached image
     

  6. #6  
    Registered Member
    Join Date
    Jan 2010
    Posts
    125
    Thanks given
    9
    Thanks received
    29
    Rep Power
    25
    http://**********/v/FB1R9AD5 <-- put in C

    Code:
    	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();
    		}
    	}
    ^ all 459 configs
     

  7. #7  
    Registered Member
    AlexMason's Avatar
    Join Date
    Aug 2007
    Age
    30
    Posts
    1,199
    Thanks given
    17
    Thanks received
    27
    Rep Power
    98
    Quote Originally Posted by S Quare Quxx View Post
    Oh kewl, "hardcoding" has reached servers
    its not technically hardcoding because we arnt replacing something. idc what you think of this just thought this would be a easier way then to unpack add in new data pack then start over.

     

  8. #8  
    Registered Member

    Join Date
    Sep 2007
    Age
    32
    Posts
    2,396
    Thanks given
    5
    Thanks received
    436
    Rep Power
    902
    Wow this is origional, hardcoding into a server! Ive seen it a few times before, but not in a tutorial!!!!!!!!!!!!

    Goodwork but just WOW!
    Hyperion V2 Martin's Updates.

    Scar says:
    i hate it when it hits your face
     

  9. #9  
    Banned

    Join Date
    May 2008
    Posts
    823
    Thanks given
    16
    Thanks received
    31
    Rep Power
    0
    Quote Originally Posted by Duke Lukem View Post
    Not sure if serious..
    pretty srs i think.
     

  10. #10  
    Registered Member
    AlexMason's Avatar
    Join Date
    Aug 2007
    Age
    30
    Posts
    1,199
    Thanks given
    17
    Thanks received
    27
    Rep Power
    98
    Quote Originally Posted by Martin View Post
    Wow this is origional, hardcoding into a server! Ive seen it a few times before, but not in a tutorial!!!!!!!!!!!!

    Goodwork but just WOW!
    sarcasm i believe.

     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •