Thread: Location of??

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 Location of?? 
    Registered Member Chr0nicxHack3r's Avatar
    Join Date
    Mar 2015
    Posts
    64
    Thanks given
    1
    Thanks received
    1
    Rep Power
    11
    Hello everyone I am currently working with the Ruse/Necrotic release and I am wondering if someone can tell me where I might find the custom clue scroll codes like if I want to make my own? I have found it in 2 places but not sure where to get the actual code for what it does when redeemed.

    Attached image



    Attached image
    Reply With Quote  
     

  2. #2  
    nice


    Join Date
    Jul 2014
    Posts
    740
    Thanks given
    382
    Thanks received
    562
    Rep Power
    4239
    might be 'memberscrolls' but if not, just use ctrl h on eclipse and search for 10943, so you can see where and how its done.
    Reply With Quote  
     

  3. #3  
    Registered Member Chr0nicxHack3r's Avatar
    Join Date
    Mar 2015
    Posts
    64
    Thanks given
    1
    Thanks received
    1
    Rep Power
    11
    So I did some adding and im sure i got it wrong but this is everything that i got and the error.

    items.txt
    Code:
    Item Id: 22694
    Name: Master Scroll
    Examine: Max all skills in Mordscape.
    Value: 0
    Stackable: false
    Noted: false
    Double-handed: false
    Equipment type: WEAPON
    Is Weapon: false
    finish
    I did 22694 because that is the most amount of items or something my server can have

    MemberScrolls.java
    Code:
    case 25066:
    			for (Skill skill : Skill.values()) {
    			player.getInventory().delete(item, 1);
    			int level = SkillManager.getMaxAchievingLevel(skill);
    			player.getSkillManager().setCurrentLevel(skill, level).setMaxLevel(skill, level).setExperience(skill, SkillManager.getExperienceForLevel(level == 120 ? 120 : 99));
    			break;	
    			}
    And then in my rsps when I do ::item 22694 1 i Dont get the item there is a pic below and then the error.
    Attached image
    Code:
    java.lang.ArrayIndexOutOfBoundsException: 22694
    	at com.ruse.model.definitions.ItemDefinition.forId(ItemDefinition.java:118)
    	at com.ruse.model.container.ItemContainer.add(ItemContainer.java:508)
    	at com.ruse.net.packet.impl.CommandPacketListener.ownerCommands(CommandPacketListener.java:1466)
    	at com.ruse.net.packet.impl.CommandPacketListener.handleMessage(CommandPacketListener.java:127)
    	at com.ruse.net.PlayerSession.handleInputMessage(PlayerSession.java:111)
    	at com.ruse.net.PlayerSession.handleQueuedMessages(PlayerSession.java:93)
    	at com.ruse.world.entity.updating.PlayerUpdateSequence.executePreUpdate(PlayerUpdateSequence.java:34)
    	at com.ruse.world.entity.updating.PlayerUpdateSequence.executePreUpdate(PlayerUpdateSequence.java:1)
    	at com.ruse.world.entity.impl.CharacterList.forEach(CharacterList.java:148)
    	at com.ruse.world.World.sequence(World.java:182)
    	at com.ruse.engine.GameEngine.run(GameEngine.java:48)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    	at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    Reply With Quote  
     

  4. #4  
    sυввч

    Sub's Avatar
    Join Date
    Aug 2007
    Age
    24
    Posts
    4,352
    Thanks given
    1,205
    Thanks received
    359
    Rep Power
    2845
    Quote Originally Posted by -Brennan View Post
    So I did some adding and im sure i got it wrong but this is everything that i got and the error.

    items.txt
    Code:
    Item Id: 22694
    Name: Master Scroll
    Examine: Max all skills in Mordscape.
    Value: 0
    Stackable: false
    Noted: false
    Double-handed: false
    Equipment type: WEAPON
    Is Weapon: false
    finish
    I did 22694 because that is the most amount of items or something my server can have

    MemberScrolls.java
    Code:
    case 25066:
    			for (Skill skill : Skill.values()) {
    			player.getInventory().delete(item, 1);
    			int level = SkillManager.getMaxAchievingLevel(skill);
    			player.getSkillManager().setCurrentLevel(skill, level).setMaxLevel(skill, level).setExperience(skill, SkillManager.getExperienceForLevel(level == 120 ? 120 : 99));
    			break;	
    			}
    And then in my rsps when I do ::item 22694 1 i Dont get the item there is a pic below and then the error.
    Attached image
    Code:
    java.lang.ArrayIndexOutOfBoundsException: 22694
    	at com.ruse.model.definitions.ItemDefinition.forId(ItemDefinition.java:118)
    	at com.ruse.model.container.ItemContainer.add(ItemContainer.java:508)
    	at com.ruse.net.packet.impl.CommandPacketListener.ownerCommands(CommandPacketListener.java:1466)
    	at com.ruse.net.packet.impl.CommandPacketListener.handleMessage(CommandPacketListener.java:127)
    	at com.ruse.net.PlayerSession.handleInputMessage(PlayerSession.java:111)
    	at com.ruse.net.PlayerSession.handleQueuedMessages(PlayerSession.java:93)
    	at com.ruse.world.entity.updating.PlayerUpdateSequence.executePreUpdate(PlayerUpdateSequence.java:34)
    	at com.ruse.world.entity.updating.PlayerUpdateSequence.executePreUpdate(PlayerUpdateSequence.java:1)
    	at com.ruse.world.entity.impl.CharacterList.forEach(CharacterList.java:148)
    	at com.ruse.world.World.sequence(World.java:182)
    	at com.ruse.engine.GameEngine.run(GameEngine.java:48)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    	at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    The exception you're getting is telling you the index you're trying to access in the item definition array doesn't exist. Looks like you need to up the array size up by one to fix this.

    I'm not familiar with the "source" you are using, could you paste the contents of ItemDefinition.java?
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Jan 2018
    Posts
    5
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    There's a few things you can take away from that error code.

    Code:
    java.lang.ArrayIndexOutOfBoundsException: 22694
    This tells you the value that you gave is too high of a value and exceeds the size of the array it was accessing.

    • The next 11 lines in this case (this can differ) are all the lines that have to do with your source.
    • These 11 lines are in order of most recently executed. It begins on the bottom line and ends on the top line.


    Your first line is

    Code:
    at com.ruse.engine.GameEngine.run(GameEngine.java:48)
    Judging by the name i'd say that's a bit too early in the code so we'll start a bit higher.


    The below looks good i'd say even that forth line is probably useless, but I'm not sure what you send from Command List to Owner List.


    Code:
    	at com.ruse.model.definitions.ItemDefinition.forId(ItemDefinition.java:118)
    	at com.ruse.model.container.ItemContainer.add(ItemContainer.java:508)
    	at com.ruse.net.packet.impl.CommandPacketListener.ownerCommands(CommandPacketListener.java:1466)
    	at com.ruse.net.packet.impl.CommandPacketListener.handleMessage(CommandPacketListener.java:127)

    Now you should be able to read these errors on what they are saying. In this case from bottom to top we are doing the following:

    1. Class: CommandPacketListener , Method: handleMessage , Line 127 Called Next Method.
    2. Class: CommandPacketListener , Method: ownerCommands , Line 1466 Called Next Method.
    3. Class: ItemContainer , Method: add , Line 508 Called Next Method.
    4. Class: ItemDefinition , Method: forId , Line 118 Fails Execution at this line for Array Out Of Bounds Exception.





    With the above i'd get all the methods for each of those lines as that includes the full process. You'll probably find additional code beyond that but it would give you more insight on the problem you are facing.
    Reply With Quote  
     

  6. #6  
    Registered Member Chr0nicxHack3r's Avatar
    Join Date
    Mar 2015
    Posts
    64
    Thanks given
    1
    Thanks received
    1
    Rep Power
    11
    I wonder if i didnt put the item into the game properly? I mean above is all I have done and im completely new to this stuff so im not 100% sure if i did it properly. @Sub belowe it the ItemDefinition.java


    Code:
    package com.ruse.model.definitions;
    
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileReader;
    import java.io.IOException;
    
    import com.ruse.model.container.impl.Equipment;
    
    /**
     * This file manages every item definition, which includes
     * their name, description, value, skill requirements, etc.
     * 
     * @author relex lawl
     */
    
    public class ItemDefinition {
    	
    	/**
    	 * The directory in which item definitions are found.
    	 */
    	private static final String FILE_DIRECTORY = "./data/def/txt/items.txt";
    
    	/**
    	 * The max amount of items that will be loaded.
    	 */
    	private static final int MAX_AMOUNT_OF_ITEMS = 22694;
    	
    	/**
    	 * ItemDefinition array containing all items' definition values.
    	 */
    	private static ItemDefinition[] definitions = new ItemDefinition[MAX_AMOUNT_OF_ITEMS];
    	
    	/**
    	 * Loading all item definitions
    	 */
    	public static void init() {
    		ItemDefinition definition = definitions[0];
    		try {
    			File file = new File(FILE_DIRECTORY);
    			BufferedReader reader = new BufferedReader(new FileReader(file));
    			String line;
    			while ((line = reader.readLine()) != null) {
    				if (line.contains("inish")) {
    					definitions[definition.id] = definition;
    					continue;
    				}
    				String[] args = line.split(": ");
    				if (args.length <= 1)
    					continue;
    				String token = args[0], value = args[1];
    				if (line.contains("Bonus[")) {
    					String[] other = line.split("]");
    					int index = Integer.valueOf(line.substring(6, other[0].length()));
    					double bonus = Double.valueOf(value);
    					definition.bonus[index] = bonus;
    					continue;
    				}
    				if (line.contains("Requirement[")) {
    					String[] other = line.split("]");
    					int index = Integer.valueOf(line.substring(12, other[0].length()));
    					int requirement = Integer.valueOf(value);
    					definition.requirement[index] = requirement;
    					continue;
    				}
    				switch (token.toLowerCase()) {
    				case "item id":
    					int id = Integer.valueOf(value);
    					definition = new ItemDefinition();
    					definition.id = id;
    					break;
    				case "name":
    					if(value == null)
    						continue;
    					definition.name = value;
    					break;
    				case "examine":
    					definition.description = value;
    					break;
    				case "value":
    					int price = Integer.valueOf(value);
    					definition.value = price;
    					break;
    				case "stackable":
    					definition.stackable = Boolean.valueOf(value);
    					break;
    				case "noted":
    					definition.noted = Boolean.valueOf(value);
    					break;
    				case "double-handed":
    					definition.isTwoHanded = Boolean.valueOf(value);
    					break;
    				case "equipment type":
    					definition.equipmentType = EquipmentType.valueOf(value);
    					break;
    				case "is weapon":
    					definition.weapon = Boolean.valueOf(value);
    					break;
    				}
    			}
    			reader.close();
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    	}	
    	
    	public static ItemDefinition[] getDefinitions() {
    		return definitions;
    	}
    	
    	/**
    	 * Gets the item definition correspondent to the id.
    	 * 
    	 * @param id	The id of the item to fetch definition for.
    	 * @return		definitions[id].
    	 */
    	public static ItemDefinition forId(int id) {
    		return (id < 0 || id > definitions.length || definitions[id] == null) ? new ItemDefinition() : definitions[id];
    	}
    	
    	/**
    	 * Gets the max amount of items that will be loaded
    	 * in Niobe.
    	 * @return	The maximum amount of item definitions loaded.
    	 */
    	public static int getMaxAmountOfItems() {
    		return MAX_AMOUNT_OF_ITEMS;
    	}
    	
    	/**
    	 * The id of the item.
    	 */
    	private int id = 0;
    	
    	/**
    	 * Gets the item's id.
    	 * 
    	 * @return id.
    	 */
    	public int getId() {
    		return id;
    	}
    	
    	/**
    	 * The name of the item.
    	 */
    	private String name = "None";
    	
    	/**
    	 * Gets the item's name.
    	 * 
    	 * @return name.
    	 */
    	public String getName() {
    		return name;
    	}
    	
    	/**
    	 * The item's description.
    	 */
    	private String description = "Null";
    	
    	/**
    	 * Gets the item's description.
    	 * 
    	 * @return	description.
    	 */
    	public String getDescription() {
    		return description;
    	}
    	
    	/**
    	 * Flag to check if item is stackable.
    	 */
    	private boolean stackable;
    	
    	/**
    	 * Checks if the item is stackable.
    	 * 
    	 * @return	stackable.
    	 */
    	public boolean isStackable() {
    		if(noted)
    			return true;
    		return stackable;
    	}
    	
    	/**
    	 * The item's shop value.
    	 */
    	private int value;
    	
    	/**
    	 * Gets the item's shop value.
    	 * 
    	 * @return	value.
    	 */
    	public int getValue() {
    		return isNoted() ? ItemDefinition.forId(getId() - 1).value : value;
    	}
    	
    	/**
    	 * Gets the item's equipment slot index.
    	 * 
    	 * @return	equipmentSlot.
    	 */
    	public int getEquipmentSlot() {
    		return equipmentType.slot;
    	}
    	
    	/**
    	 * Flag that checks if item is noted.
    	 */
    	private boolean noted;
    	
    	/**
    	 * Checks if item is noted.
    	 * 
    	 * @return noted.
    	 */
    	public boolean isNoted() {
    		return noted;
    	}
    		
    	private boolean isTwoHanded;
    	
    	/**
    	 * Checks if item is two-handed
    	 */
    	public boolean isTwoHanded() {
    		return isTwoHanded;
    	}
    	
    	private boolean weapon;
    	
    	public boolean isWeapon() {
    		return weapon;
    	}
    	
    	private EquipmentType equipmentType = EquipmentType.WEAPON;
    	
    	public EquipmentType getEquipmentType() {
    		return equipmentType;
    	}
    	
    	/**
    	 * Checks if item is full body.
    	 */
    	public boolean isFullBody() {
    		return equipmentType.equals(EquipmentType.PLATEBODY);
    	}
    	
    	/**
    	 * Checks if item is full helm.
    	 */
    	public boolean isFullHelm() {
    		return equipmentType.equals(EquipmentType.FULL_HELMET);
    	}
    	
    	private double[] bonus = new double[18];
    	
    	public double[] getBonus() {
    		return bonus;
    	}
    	
    	private int[] requirement = new int[25];
    
    	public int[] getRequirement() {
    		return requirement;
    	}
    	
    	private enum EquipmentType {
    		HAT(Equipment.HEAD_SLOT),
    		CAPE(Equipment.CAPE_SLOT),
    		SHIELD(Equipment.SHIELD_SLOT),
    		GLOVES(Equipment.HANDS_SLOT),
    		BOOTS(Equipment.FEET_SLOT),
    		AMULET(Equipment.AMULET_SLOT),
    		RING(Equipment.RING_SLOT),
    		ARROWS(Equipment.AMMUNITION_SLOT),
    		FULL_MASK(Equipment.HEAD_SLOT),
    		FULL_HELMET(Equipment.HEAD_SLOT),
    		BODY(Equipment.BODY_SLOT),
    		PLATEBODY(Equipment.BODY_SLOT),
    		LEGS(Equipment.LEG_SLOT),
    		WEAPON(Equipment.WEAPON_SLOT);
    		
    		private EquipmentType(int slot) {
    			this.slot = slot;
    		}
    		
    		private int slot;
    	}
    	
    	@Override
    	public String toString() {
    		return "[ItemDefinition(" + id + ")] - Name: " + name + "; equipment slot: " + getEquipmentSlot() + "; value: "
    				+ value + "; stackable ? " + Boolean.toString(stackable) + "; noted ? " + Boolean.toString(noted) + "; 2h ? " + isTwoHanded;
    	}
    	
    	public static int getItemId(String itemName) {
    		for (int i = 0; i < MAX_AMOUNT_OF_ITEMS; i++) {
    			if (definitions[i] != null) {
    				if (definitions[i].getName().equalsIgnoreCase(itemName)) {
    					return definitions[i].getId();
    				}
    			}
    		}
    		return -1;
    	}
    }
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Jan 2018
    Posts
    5
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Well ID 22694 is higher then your array length.

    When you create an array it's starts from 0 not 1.

    I.e.

    int[] values = new int[100];

    This would range from 0 to 99. If you count from 0 to 99 with your fingers or even just to 9 you'll find you use all 10 fingers.

    However looking at your code something looks off slightly.. so try changing the below code.

    Code:
    	public static ItemDefinition forId(int id) {
    		return (id < 0 || id > definitions.length || definitions[id] == null) ? new ItemDefinition() : definitions[id];
    	}

    to the following:


    Code:
    	public static ItemDefinition forId(int id) 
    	{
    		if (id < 0 || id > definition.length)
    		{
    			System.out.println("[Item Definition]: Out Of Bounds at Index: " + id);
    			return definitions[0];
    		}
    		if (defintions[id] == null)
    		{
    			System.out.println("[Item Definition]: Index Isn't Loaded " + id);
    			return definitions[0];
    		}
    		return definitions[id];
    	}
    Definition[0] should be that skeleton item from Dwarf's Cannon quest it's the generic NULL item people use as it has no real purpose and 0 is the default initialization value for integers and the start of an array so it won't cause out of array exceptions like -1 does.
    Reply With Quote  
     

  8. #8  
    Registered Member Chr0nicxHack3r's Avatar
    Join Date
    Mar 2015
    Posts
    64
    Thanks given
    1
    Thanks received
    1
    Rep Power
    11
    Well the only reason that the id is set to 22694 is that it told me thats the max and i figured nothing else would have that ID so thats what i used. Also that bit of code as some errors and not to sure what to do with it?

    Attached image
    Reply With Quote  
     

  9. #9  
    Community Veteran



    Join Date
    Jan 2008
    Posts
    3,444
    Thanks given
    46
    Thanks received
    973
    Rep Power
    4748
    change definition to definitions

    Reply With Quote  
     

  10. #10  
    Registered Member Chr0nicxHack3r's Avatar
    Join Date
    Mar 2015
    Posts
    64
    Thanks given
    1
    Thanks received
    1
    Rep Power
    11
    Sadly enough this one stays with an error?

    Attached image

    i did the create local variable but did nothing
    Reply With Quote  
     

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

Similar Threads

  1. Location of custom crown sprite?
    By Jord in forum Help
    Replies: 2
    Last Post: 08-11-2011, 10:15 PM
  2. ( PI ) Location of wildy level text...
    By Hellobuddyhowareyou in forum Help
    Replies: 14
    Last Post: 06-27-2011, 10:40 PM
  3. Changing location of a altar?
    By xelf in forum Help
    Replies: 4
    Last Post: 06-29-2010, 10:45 PM
  4. Replies: 3
    Last Post: 10-23-2009, 09:53 PM
  5. Location of the fire giant area?
    By Zombiedevice in forum Help
    Replies: 1
    Last Post: 08-07-2009, 07:44 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •