Thread: [ANGUISH/ASCEND/ETHOS] itemOnInterface

Results 1 to 7 of 7
  1. #1 [ANGUISH/ASCEND/ETHOS] itemOnInterface 
    Registered Member
    Join Date
    Mar 2017
    Posts
    45
    Thanks given
    19
    Thanks received
    2
    Rep Power
    58
    Have searched results in both client and server folders, as well as manually searching the cache for a sprite (Folder and cache suite). However, I cannot find where the client is grabbing this poisoned adamant knife?:

    Attached image

    Here are the only two locations it seems to be drawing anything from:

    Client/RSInterface:
    Code:
    	public static void OsDropViewer(TextDrawingArea[] tda) {
    		RSInterface tab = addInterface(39500);
    		String dir = "Interfaces/DropViewer/SPRITE";
    		addSprite(39501, 0, dir);
    		addHoverButton(39502, dir, 1, 21, 21, "Close", 0, 39503, 1);
    		addHoveredButton(39503, dir, 2, 21, 21, 39504);
    		addText(43005, "Drop tables"/*"Monster Drop Viewer"*/, tda, 2, 0xFFA500, true, true);
    		addText(43110, "Level:@whi@ n/a"/*"Health: @whi@0"*/, tda, 1, 0xff9040, false, true);// overrides
    		addText(43111, "Maximum:@whi@ n/a"/*"Combat Level: @whi@0"*/, tda, 1, 0xff9040, false, true);
    		addText(43112, "Hitpoints:@whi@ n/a"/*"Max Hit: @whi@0"*/, tda, 1, 0xff9040, false, true);
    		addText(43113, "Aggression:@whi@ n/a"/*"Aggressive: @whi@false"*/, tda, 1, 0xff9040, false, true);
    
    		addInputField(39806, 30, 0xFF981F, "Search..."/*"NPC/Item Name.."*/, 130, 28, false, false, "[A-Za-z0-9 .,]");
    		//addText(42522, "Find npc/item drops", drawingArea, 0, 0xFF981F, true, false);
    		int x = 7, y = 7;
    		tab.totalChildren(11);
    		tab.child(0, 39501, 0 + x, 0 + y);
    		tab.child(1, 39502, 472 + x, 7 + y);
    		tab.child(2, 39503, 472 + x, 7 + y);
    		tab.child(3, 43005, 250 + x, 11 + y);
    		tab.child(4, 39806, 8+x, 37+y);
    		tab.child(5, 39507, 6 + x, 66 + y);
    		tab.child(6, 34000, 150 + x, 86 + y);
    		tab.child(7, 43110, 250 + x, 40 + y);
    		tab.child(8, 43111, 250 + x, 60 + y);
    		tab.child(9, 43112, 360 + x, 40 + y);
    		tab.child(10, 43113, 360 + x, 60 + y);
    
    		RSInterface results = addInterface(39507);
    		results.width = 122;
    		results.height = 250;
    		results.scrollMax = 1800;
    		results.totalChildren(200);
    		for (int j = 0; j < 200; j++) {
    			addClickableText(33008 + j, "", "View Drops", tda, 0, 0xff0000, false, true, 110);
    			results.child(j, 33008 + j, 6, 8 + (j * 14));
    		}
    
    		RSInterface main = addInterface(34000);
    		main.totalChildren(720);
    		main.width = 328;
    		main.height = 230;
    		main.scrollMax = 2560;
    		addSprite(34001, 3, dir);
    		addSprite(34002, 4, dir);
    		for (int i = 0; i < 40; i++) {
    			main.child(i, 34001, 0, (i * 64));
    			main.child(i + 40, 34002, 0, 32 + (i * 64));
    		}
    		addText(34003, "Quantity:"/*"Amount:"*/, tda, 0, 0xff9040, true, true);
    		addText(34004, "Rarity:", tda, 0, 0xff9040, true, true);
    		addText(34005, "Rate:"/*"Chance:"*/, tda, 0, 0xff9040, true, true);
    		for (int i = 0; i < 80; i++) {
    			itemGroup(34010 + i, 1, 1, 1, 1, false, false);
    			interfaceCache[34010 + i].inv[0] = 14485;
    			interfaceCache[34010 + i].invStackSizes[0] = 1;
    			addText(34100 + i, "n/a"/*"Item Name"*/, tda, 1, 0xFFA500, false, true);
    			addText(34200 + i, "n/a"/*"1-50"*/, tda, 0, 0xffffff, true, true);
    			addText(34300 + i, "n/a"/*"Common"*/, tda, 0, 0xffffff, true, true);
    			addText(34400 + i, "n/a"/*"1/200"*/, tda, 0, 0xffffff, true, true);
    			int yy = (i * 32);
    			main.child(80 + i, 34010 + i, 1, 0 + yy);
    			main.child(160 + i, 34100 + i, 39, 6 + yy);
    			main.child(240 + i, 34003, 175, 2 + yy);
    			main.child(320 + i, 34004, 234, 2 + yy);
    			main.child(400 + i, 34005, 293, 2 + yy);
    			main.child(480 + i, 34200 + i, 175, 14 + yy);
    			main.child(560 + i, 34300 + i, 234, 14 + yy);
    			main.child(640 + i, 34400 + i, 293, 14 + yy);
    		}
    
    	}
    
    	public static void itemGroup(int id, int w, int h, int x, int y, boolean drag, boolean examine) {
    		RSInterface rsi = addInterface(id);
    		rsi.width = w;
    		rsi.height = h;
    		rsi.inv = new int[w * h];
    		rsi.invStackSizes = new int[w * h];
    		rsi.usableItemInterface = false;
    		rsi.isInventoryInterface = false;
    		rsi.invSpritePadX = x;
    		rsi.invSpritePadY = y;
    		rsi.spritesX = new int[20];
    		rsi.spritesY = new int[20];
    		rsi.sprites = new Sprite[20];
    		rsi.type = 2;
    	}
    
    	public static TextDrawingArea[] defaultTextDrawingAreas;
    Server/DropManager:
    Code:
    	/**
    	 * Clears the interface of all parts.
    	 *
    	 * Used on searching and initial load.
    	 * @Param player
    	 */
    	public void clear(Player player) {
    		for(int i = 0; i < 150; i++) {
    			player.getPA().sendFrame126("", 33008 + i);
    		}
    
    		player.getPA().sendFrame126("", 43110);
    		player.getPA().sendFrame126("", 43111);
    		player.getPA().sendFrame126("", 43112);
    		player.getPA().sendFrame126("", 43113);
    
    		for(int i = 0;i<80;i++){
    			player.getPA().itemOnInterface(-1, 0, 34010+i, 0);
    			player.getPA().sendString("", 34200+i);
    			player.getPA().sendString("", 34300+i);
    			player.getPA().sendString("", 34100+i);
    			player.getPA().sendString("", 34400+i);
    		}
    		player.searchList.clear();
    	}
    
    	public void open2(Player player) {
    		clear(player);
    
    		for (int index = 0; index < ordered.size(); index++) {
    			player.getPA().sendFrame126(StringUtils.capitalize(NPCDefinitions.get(ordered.get(index)).getNpcName().toLowerCase().replaceAll("_", " ")), 33008 + index);
    		}
    
    		player.getPA().showInterface(33000);
    	}
    
    	/**
    	 * Searchers after the player inputs a npc name
    	 * @Param player
    	 * @Param name
    	 */
    	public void search(Player player, String name) {
    		if(name.matches("^(?=.*[A-Z])(?=.*[0-9])[A-Z0-9]+$")) {
    //			player.sendMessage("You may not search for alphabetical and numerical combinations.");
    			return;
    		}
    		if(name.matches("vorkath")) {
    //			player.sendMessage("@red@Please note the drop viewer doesn't currently display vorkaths drop table.");
    		}
    		if (System.currentTimeMillis() - player.lastDropTableSearch < TimeUnit.SECONDS.toMillis(5)) {
    //			player.sendMessage("You can only do this once every 5 seconds.");
    			return;
    		}
    		player.lastDropTableSearch = System.currentTimeMillis();
    
    		clear(player);
    
    		List<Integer> definitions = ordered.stream().filter(Objects::nonNull).filter(def -> NPCDefinitions.get(def).getNpcName() != null).filter(def -> NPCDefinitions.get(def).getNpcName().toLowerCase().contains(name.toLowerCase())).collect(Collectors.toList());
    
    		if(definitions.isEmpty()) {
    			definitions = ordered.stream().filter(Objects::nonNull).collect(Collectors.toList());
    			List<Integer> npcs = new ArrayList<>();
    			int count = 0;
    			for(Integer index : definitions) {
    				Optional<TableGroup> group = groups.values().stream().filter(g -> g.getNpcIds().contains(NPCDefinitions.get(index).getNpcId())).findFirst();
    				if(group.isPresent()) {
    					TableGroup g = group.get();
    
    					for(TablePolicy policy : TablePolicy.values()) {
    						Optional<Table> table = g.stream().filter(t -> t.getPolicy() == policy).findFirst();
    						if(table.isPresent()) {
    							for(Drop drop : table.get()) {
    								if(drop == null) {
    									continue;
    								}
    
    								if(ItemAssistant.getItemName(drop.getItemId()).toLowerCase().contains(name.toLowerCase())) {
    									npcs.add(index);
    									player.getPA().sendFrame126(StringUtils.capitalize(NPCDefinitions.get(NPCDefinitions.get(index).getNpcId()).getNpcName().toLowerCase().replaceAll("_", " ")), 33008 + count);
    									count++;
    								}
    							}
    						}
    					}
    				}
    
    			}
    
    			player.searchList = npcs;
    			return;
    
    		}
    
    		for(int index = 0; index < definitions.size(); index++) {
    			if(index >= 150) {
    				break;
    			}
    			player.getPA().sendFrame126(StringUtils.capitalize(NPCDefinitions.get(definitions.get(index)).getNpcName().toLowerCase().replaceAll("_", " ")), 33008 + index);
    		}
    
    		player.searchList = definitions;
    	}
    
    	/**
    	 * Loads the selected npc choosen by the player to view their drops
    	 * @Param player
    	 * @Param button
    	 */
    	public void select(Player player, int button) {
    		int listIndex;
    
    		//So the idiot client dev didn't organize the buttons in a singulatiry order. So i had to shift around the id's
    		//so if you have 50 npcs in the search you can click them all fine
    		if(button <= 128255) {
    			listIndex = button - 128240;
    		} else {
    			listIndex = (128255 - 128240) + 1 + button - 129000;
    		}
    
    		if (listIndex < 0 || listIndex > ordered.size() - 1) {
    			return;
    		}
    
    		//Finding NPC ID
    		int npcId = player.searchList.isEmpty() ? ordered.get(listIndex) : player.searchList.get(listIndex);
    
    		Optional<TableGroup> group = groups.values().stream().filter(g -> g.getNpcIds().contains(npcId)).findFirst();
    
    		//If the group in the search area contains this NPC
    		group.ifPresent(g -> {
    			if (System.currentTimeMillis() - player.lastDropTableSelected < TimeUnit.SECONDS.toMillis(5)) {
    //				player.sendMessage("You can only do this once every 5 seconds.");
    				return;
    			}
    
    			//Loads the definition and maxhit/aggressiveness to display
    			NPCDefinitions npcDef = NPCDefinitions.get(npcId);
    
    			player.getPA().sendFrame126("Hitpoints:@whi@ "/*"Health: @whi@"*/ + npcDef.getNpcHealth(), 43112/*43110*/);
    			player.getPA().sendFrame126("Level:@whi@ "/*"Combat Level: @whi@"*/ + npcDef.getNpcCombat(), 43110/*43111*/);
    			if(NPCHandler.getNpc(npcId) != null){
    				player.getPA().sendFrame126("Maximum:@whi@ "/*"Max Hit: @whi@"*/ + NPCHandler.getNpc(npcId).maxHit, 43111/*43112*/);
    			} else {
    				player.getPA().sendFrame126("Maximum:@whi@ n/a"/*"Max Hit: @whi@?"*/, 43111/*43112*/);
    			}
    			player.getPA().sendFrame126("Aggression:@whi@ "/*"Aggressive: @whi@"*/ + (Server.npcHandler.isAggressive(npcId, true) ? "true" : "false"), 43113);
    
    			player.lastDropTableSelected = System.currentTimeMillis();
    
    			double modifier = getModifier(player);
    
    			//Iterates through all 5 drop table's (Found in TablePolicy -> Enum)
    			for (TablePolicy policy : TablePolicy.POLICIES) {
    				Optional<Table> table = g.stream().filter(t -> t.getPolicy() == policy).findFirst();
    				if (table.isPresent()) {
    					double chance = (1.0 /(table.get().getAccessibility() * modifier)) * 100D;
    					int in_kills = (int) (100 / chance);
    					if (chance > 100.0) {
    						chance = 100.0;
    					}
    					if (in_kills == 0) {
    						in_kills = 1;
    					}
    
    					//Updates the interface with all new information
    					updateAmounts(player, policy, table.get(), in_kills);
    				} else {
    					updateAmounts(player, policy, new ArrayList<>(), -10);
    				}
    			}
    
    			//If the game has displayed all drops and there are empty slots that haven't been filled, clear them
    			if(player.dropSize < 80) {
    				for(int i = player.dropSize;i<80;i++){
    					player.getPA().sendString("", 34200+i);
    					player.getPA().itemOnInterface(-1, 0, 34010+i, 0);
    					player.getPA().sendString("", 34300+i);
    					player.getPA().sendString("", 34100+i);
    					player.getPA().sendString("", 34400+i);
    				}
    			}
    			player.dropSize = 0;
    		});
    	}
    
    	/**
    	 * Updates the interface for the selected NPC
    	 * @Param player
    	 * @Param policy
    	 * @Param drops
    	 * @Param kills
    	 */
    	private void updateAmounts(Player player, TablePolicy policy, List<Drop> drops, int kills) {
    
    		//Iterates through all drops in that catagory
    		for (int index = 0; index < drops.size(); index++) {
    			Drop drop = drops.get(index);
    			int minimum = drop.getMinimumAmount();
    			int maximum = drop.getMaximumAmount();
    			int frame = (34200 + player.dropSize + index);//collumnOffset + (index * 2);
    
    			//if max = min, just send the max
    			if (minimum == maximum) {
    				player.getPA().sendString(Misc.getValueWithoutRepresentation(drop.getMaximumAmount()), frame);
    			} else {
    				player.getPA().sendString(Misc.getValueWithoutRepresentation(drop.getMinimumAmount()) + " - " + Misc.getValueWithoutRepresentation(drop.getMaximumAmount()), frame);
    			}
    			player.getPA().itemOnInterface(drop.getItemId(), 1, 34010+player.dropSize + index, 0);
    			player.getPA().sendString(Misc.optimizeText(policy.name().toLowerCase()), 34300+player.dropSize + index);
    			player.getPA().sendString(Server.itemHandler.getItemList(drop.getItemId()).itemName, 34100 + player.dropSize + index);
    			if(kills == -10){
    				player.getPA().sendString(1 + "/?", 34400 + player.dropSize + index);
    			} else {
    				player.getPA().sendString(1 + "/"+kills, 34400 + player.dropSize + index);
    			}
    		}
    
    		player.dropSize += drops.size();
    	}
    
    	static int amountt = 0;
    
    	private FileReader fileReader;
    Am I just blind?
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Jan 2017
    Posts
    195
    Thanks given
    13
    Thanks received
    27
    Rep Power
    13
    right here in the client:

    Code:
     itemGroup(34010 + i, 1, 1, 1, 1, false, false);
    34010

    and in the server:
    Code:
     player.getPA().itemOnInterface(drop.getItemId(), 1, 34010+player.dropSize + index, 0);
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member
    Join Date
    Mar 2017
    Posts
    45
    Thanks given
    19
    Thanks received
    2
    Rep Power
    58
    Quote Originally Posted by socklol View Post
    right here in the client:

    Code:
     itemGroup(34010 + i, 1, 1, 1, 1, false, false);
    34010

    and in the server:
    Code:
     player.getPA().itemOnInterface(drop.getItemId(), 1, 34010+player.dropSize + index, 0);
    Thank you for your reply! Ended up getting this as a result after selecting another ID, however:

    Code:
    java.lang.NullPointerException: Cannot read field "inv" because "com.client.graphics.interfaces.RSInterface.interfaceCache[...]" is null
    Error: loaderror Unpacking interfaces 95
    	at com.client.graphics.interfaces.RSInterface.OsDropViewer(RSInterface.java:1041)
    	at com.client.graphics.interfaces.RSInterface.unpack(RSInterface.java:258)
    	at com.client.Client.startUp(Client.java:11192)
    	at com.client.RSApplet.run(RSApplet.java:218)
    	at com.client.Client.run(Client.java:6282)
    	at java.base/java.lang.Thread.run(Thread.java:832)
    I am assuming 34010 was the interface ID then?
    Reply With Quote  
     

  5. #4  
    Registered Member
    Join Date
    Jan 2017
    Posts
    195
    Thanks given
    13
    Thanks received
    27
    Rep Power
    13
    yeah check out how pest control reward interface is done:

    Code:
     
    	public static void addPestControlRewardWidget(TextDrawingArea[] tda) {
    		RSInterface main = addInterface(37000);
    		addSprite(37001, 0, "Interfaces/Pest Control/Reward/IMAGE");
    		addButton(37002, 1, "Interfaces/Pest Control/Reward/IMAGE", "Confirm");
    		addText(37003, "10 points", tda, 1, 0xFF981F, true, true);
    		addHoverButton(37004, "Interfaces/Pest Control/Reward/IMAGE", 3, 21,
    				21, "Close", -1, 37005, 3);
    		addHoveredButton(37005, "Interfaces/Pest Control/Reward/IMAGE", 4, 21,
    				21, 37006);
    		addText(37007, "1,000 pts", tda, 2, 0xFF981F, false, true);
    		setChildren(7, main);
    		setBounds(37001, 0, 0, 0, main);
    		setBounds(37002, 181, 273, 1, main);
    		setBounds(37003, 253, 300, 2, main);
    		setBounds(37004, 463, 14, 3, main);
    		setBounds(37005, 463, 14, 4, main);
    		setBounds(37007, 35, 19, 5, main);
    		setBounds(37010, 27, 43, 6, main);
    
    		RSInterface scroll = addInterface(37010);
    		scroll.width = 442;
    		scroll.height = 221;
    		scroll.scrollMax = 520;
    		setChildren(77, scroll);
    		int x = 5;
    		int y = 5;
    		int imageId = 5;
    		String[] names = new String[] { "Attack - 10,000 xp",
    				"Defence - 10,000 xp", "Magic - 10,000 xp",
    				"Prayer - 1,000 xp", "Strength - 10,000 xp",
    				"Range - 10,000 xp", "Hitpoints - 3,300 xp" };
    		for (int index = 0; index < 35; index += 5) {
    			addSprite(37012 + index, imageId,
    					"Interfaces/Pest Control/Reward/IMAGE");
    			addText(37013 + index, names[index / 5], tda, 1, 0x339900, false,
    					true);
    			addClickableText(37014 + index, "(1 Pt)", "(1 Pt)", tda, 0,
    					0xFF981F, false, true, 40);
    			addClickableText(37015 + index, "(10 Pts)", "(10 Pts)", tda, 0,
    					0xFF981F, false, true, 40);
    			addClickableText(37016 + index, "(100 Pts)", "(100 Pts)", tda, 0,
    					0xFF981F, false, true, 40);
    			setBounds(37012 + index, x, y, index, scroll);
    			setBounds(37013 + index, x + 32, y, index + 1, scroll);
    			setBounds(37014 + index, x + 32, y + 16, index + 2, scroll);
    			setBounds(37015 + index, x + 70, y + 16, index + 3, scroll);
    			setBounds(37016 + index, x + 120, y + 16, index + 4, scroll);
    			y += 40;
    			if (imageId == 8) {
    				x += 210;
    				y = 5;
    			}
    			imageId++;
    		}
    		addSprite(37050, 2, "Interfaces/Pest Control/Reward/IMAGE");
    		setBounds(37050, 53, 165, 35, scroll);
    		addSprite(37051, 2, "Interfaces/Pest Control/Reward/IMAGE");
    		setBounds(37051, 53, 265, 36, scroll);
    		x = 5;
    		y = 180;
    		names = new String[] { "Herb Pack", "Seed Pack", "Mineral Pack",
    				"Void Knight Mace", "Void Knight Robe", "Void Mage Helm",
    				"Void Melee Helm", "Void Knight Top", "Void Knight Gloves",
    				"Void Range Helm", "Fighter Torso", "Barrows Gloves",
    				"Fighter Hat" };
    		int[] items = new int[] { 257, 5295, 449, 8841, 8840, 11663, 11665,
    				8839, 8842, 11664, 10551, 7462, 10548 };
    		String[] costs = new String[] { "(30 Pts)", "(15 Pts)", "(15 Pts)",
    				"(125 Pts)", "(150 Pts)", "(125 Pts)", "(125 Pts)",
    				"(150 Pts)", "(100 Pts)", "(125 Pts)", "(275 Pts)",
    				"(35 Pts)", "(50 Pts)" };
    		for (int index = 0; index < 39; index += 3) {
    			addText(37052 + index, names[index / 3], tda, 1, 0x339900, false,
    					true);
    			addClickableText(37053 + index, costs[index / 3], costs[index / 3],
    					tda, 0, 0xFF981F, false, true, 40);
    			addToItemGroup(37054 + index, 1, 1, 0, 0, false, "", "", "");
    			interfaceCache[37054 + index].inv = new int[] { items[index / 3] + 1 };
    			interfaceCache[37054 + index].invStackSizes = new int[] { 1 };
    			setBounds(37052 + index, x + 32, y, 37 + index, scroll);
    			setBounds(37053 + index, x + 32, y + 16, 37 + index + 1, scroll);
    			setBounds(37054 + index, x, y, 37 + index + 2, scroll);
    			y += 40;
    			if (y == 220 && x == 215) {
    				x = 5;
    				y = 280;
    			}
    			if (x == 5 && y == 440) {
    				x += 210;
    				y = 280;
    			}
    			if (y == 260) {
    				x += 210;
    				y = 180;
    			}
    			if (x == 215 && y == 440) {
    				x -= 210;
    			}
    			if (x == 5 && y == 480) {
    				x = 215;
    				y = 440;
    			}
    		}
    		darken(37100, 200, 40, 0x000000, (byte) 100);
    		setBounds(37100, 0, 0, 76, scroll);
    	}


    here we have itemIds in an array:
    Code:
     		int[] items = new int[] { 257, 5295, 449, 8841, 8840, 11663, 11665,
    				8839, 8842, 11664, 10551, 7462, 10548 };
    and here is how the items are displayed:

    Code:
     		addToItemGroup(37054 + index, 1, 1, 0, 0, false, "", "", "");
    			interfaceCache[37054 + index].inv = new int[] { items[index / 3] + 1 };
    			interfaceCache[37054 + index].invStackSizes = new int[] { 1 };
    its saying use interface 37054 + index as start of the items and show the specific item on the interface at the ( [index/3]+1 ) position because
    Code:
     interfaceCache[37054 + index].inv
    is what actually makes it show up
    Reply With Quote  
     

  6. Thankful user:


  7. #5  
    Registered Member
    Join Date
    Mar 2017
    Posts
    45
    Thanks given
    19
    Thanks received
    2
    Rep Power
    58
    Quote Originally Posted by socklol View Post
    yeah check out how pest control reward interface is done:

    Code:
     
    	public static void addPestControlRewardWidget(TextDrawingArea[] tda) {
    		RSInterface main = addInterface(37000);
    		addSprite(37001, 0, "Interfaces/Pest Control/Reward/IMAGE");
    		addButton(37002, 1, "Interfaces/Pest Control/Reward/IMAGE", "Confirm");
    		addText(37003, "10 points", tda, 1, 0xFF981F, true, true);
    		addHoverButton(37004, "Interfaces/Pest Control/Reward/IMAGE", 3, 21,
    				21, "Close", -1, 37005, 3);
    		addHoveredButton(37005, "Interfaces/Pest Control/Reward/IMAGE", 4, 21,
    				21, 37006);
    		addText(37007, "1,000 pts", tda, 2, 0xFF981F, false, true);
    		setChildren(7, main);
    		setBounds(37001, 0, 0, 0, main);
    		setBounds(37002, 181, 273, 1, main);
    		setBounds(37003, 253, 300, 2, main);
    		setBounds(37004, 463, 14, 3, main);
    		setBounds(37005, 463, 14, 4, main);
    		setBounds(37007, 35, 19, 5, main);
    		setBounds(37010, 27, 43, 6, main);
    
    		RSInterface scroll = addInterface(37010);
    		scroll.width = 442;
    		scroll.height = 221;
    		scroll.scrollMax = 520;
    		setChildren(77, scroll);
    		int x = 5;
    		int y = 5;
    		int imageId = 5;
    		String[] names = new String[] { "Attack - 10,000 xp",
    				"Defence - 10,000 xp", "Magic - 10,000 xp",
    				"Prayer - 1,000 xp", "Strength - 10,000 xp",
    				"Range - 10,000 xp", "Hitpoints - 3,300 xp" };
    		for (int index = 0; index < 35; index += 5) {
    			addSprite(37012 + index, imageId,
    					"Interfaces/Pest Control/Reward/IMAGE");
    			addText(37013 + index, names[index / 5], tda, 1, 0x339900, false,
    					true);
    			addClickableText(37014 + index, "(1 Pt)", "(1 Pt)", tda, 0,
    					0xFF981F, false, true, 40);
    			addClickableText(37015 + index, "(10 Pts)", "(10 Pts)", tda, 0,
    					0xFF981F, false, true, 40);
    			addClickableText(37016 + index, "(100 Pts)", "(100 Pts)", tda, 0,
    					0xFF981F, false, true, 40);
    			setBounds(37012 + index, x, y, index, scroll);
    			setBounds(37013 + index, x + 32, y, index + 1, scroll);
    			setBounds(37014 + index, x + 32, y + 16, index + 2, scroll);
    			setBounds(37015 + index, x + 70, y + 16, index + 3, scroll);
    			setBounds(37016 + index, x + 120, y + 16, index + 4, scroll);
    			y += 40;
    			if (imageId == 8) {
    				x += 210;
    				y = 5;
    			}
    			imageId++;
    		}
    		addSprite(37050, 2, "Interfaces/Pest Control/Reward/IMAGE");
    		setBounds(37050, 53, 165, 35, scroll);
    		addSprite(37051, 2, "Interfaces/Pest Control/Reward/IMAGE");
    		setBounds(37051, 53, 265, 36, scroll);
    		x = 5;
    		y = 180;
    		names = new String[] { "Herb Pack", "Seed Pack", "Mineral Pack",
    				"Void Knight Mace", "Void Knight Robe", "Void Mage Helm",
    				"Void Melee Helm", "Void Knight Top", "Void Knight Gloves",
    				"Void Range Helm", "Fighter Torso", "Barrows Gloves",
    				"Fighter Hat" };
    		int[] items = new int[] { 257, 5295, 449, 8841, 8840, 11663, 11665,
    				8839, 8842, 11664, 10551, 7462, 10548 };
    		String[] costs = new String[] { "(30 Pts)", "(15 Pts)", "(15 Pts)",
    				"(125 Pts)", "(150 Pts)", "(125 Pts)", "(125 Pts)",
    				"(150 Pts)", "(100 Pts)", "(125 Pts)", "(275 Pts)",
    				"(35 Pts)", "(50 Pts)" };
    		for (int index = 0; index < 39; index += 3) {
    			addText(37052 + index, names[index / 3], tda, 1, 0x339900, false,
    					true);
    			addClickableText(37053 + index, costs[index / 3], costs[index / 3],
    					tda, 0, 0xFF981F, false, true, 40);
    			addToItemGroup(37054 + index, 1, 1, 0, 0, false, "", "", "");
    			interfaceCache[37054 + index].inv = new int[] { items[index / 3] + 1 };
    			interfaceCache[37054 + index].invStackSizes = new int[] { 1 };
    			setBounds(37052 + index, x + 32, y, 37 + index, scroll);
    			setBounds(37053 + index, x + 32, y + 16, 37 + index + 1, scroll);
    			setBounds(37054 + index, x, y, 37 + index + 2, scroll);
    			y += 40;
    			if (y == 220 && x == 215) {
    				x = 5;
    				y = 280;
    			}
    			if (x == 5 && y == 440) {
    				x += 210;
    				y = 280;
    			}
    			if (y == 260) {
    				x += 210;
    				y = 180;
    			}
    			if (x == 215 && y == 440) {
    				x -= 210;
    			}
    			if (x == 5 && y == 480) {
    				x = 215;
    				y = 440;
    			}
    		}
    		darken(37100, 200, 40, 0x000000, (byte) 100);
    		setBounds(37100, 0, 0, 76, scroll);
    	}


    here we have itemIds in an array:
    Code:
     		int[] items = new int[] { 257, 5295, 449, 8841, 8840, 11663, 11665,
    				8839, 8842, 11664, 10551, 7462, 10548 };
    and here is how the items are displayed:

    Code:
     		addToItemGroup(37054 + index, 1, 1, 0, 0, false, "", "", "");
    			interfaceCache[37054 + index].inv = new int[] { items[index / 3] + 1 };
    			interfaceCache[37054 + index].invStackSizes = new int[] { 1 };
    its saying use interface 37054 + index as start of the items and show the specific item on the interface at the ( [index/3]+1 ) position because
    Code:
     interfaceCache[37054 + index].inv
    is what actually makes it show up
    Thank you for explaining all of this so perfectly!

    Attached image

    Was able to get it taken care of with your help, as well as learn something new!
    Reply With Quote  
     

  8. #6  
    Donator


    Join Date
    Jan 2010
    Age
    29
    Posts
    4,122
    Thanks given
    274
    Thanks received
    551
    Rep Power
    738
    I remember some of the methods using packet 34 in ethos were broken
    Reply With Quote  
     

  9. #7  
    Skotos Founder


    Join Date
    Jan 2017
    Age
    24
    Posts
    954
    Thanks given
    178
    Thanks received
    191
    Rep Power
    199
    Quote Originally Posted by socklol View Post
    yeah check out how pest control reward interface is done:

    Code:
     
    	public static void addPestControlRewardWidget(TextDrawingArea[] tda) {
    		RSInterface main = addInterface(37000);
    		addSprite(37001, 0, "Interfaces/Pest Control/Reward/IMAGE");
    		addButton(37002, 1, "Interfaces/Pest Control/Reward/IMAGE", "Confirm");
    		addText(37003, "10 points", tda, 1, 0xFF981F, true, true);
    		addHoverButton(37004, "Interfaces/Pest Control/Reward/IMAGE", 3, 21,
    				21, "Close", -1, 37005, 3);
    		addHoveredButton(37005, "Interfaces/Pest Control/Reward/IMAGE", 4, 21,
    				21, 37006);
    		addText(37007, "1,000 pts", tda, 2, 0xFF981F, false, true);
    		setChildren(7, main);
    		setBounds(37001, 0, 0, 0, main);
    		setBounds(37002, 181, 273, 1, main);
    		setBounds(37003, 253, 300, 2, main);
    		setBounds(37004, 463, 14, 3, main);
    		setBounds(37005, 463, 14, 4, main);
    		setBounds(37007, 35, 19, 5, main);
    		setBounds(37010, 27, 43, 6, main);
    
    		RSInterface scroll = addInterface(37010);
    		scroll.width = 442;
    		scroll.height = 221;
    		scroll.scrollMax = 520;
    		setChildren(77, scroll);
    		int x = 5;
    		int y = 5;
    		int imageId = 5;
    		String[] names = new String[] { "Attack - 10,000 xp",
    				"Defence - 10,000 xp", "Magic - 10,000 xp",
    				"Prayer - 1,000 xp", "Strength - 10,000 xp",
    				"Range - 10,000 xp", "Hitpoints - 3,300 xp" };
    		for (int index = 0; index < 35; index += 5) {
    			addSprite(37012 + index, imageId,
    					"Interfaces/Pest Control/Reward/IMAGE");
    			addText(37013 + index, names[index / 5], tda, 1, 0x339900, false,
    					true);
    			addClickableText(37014 + index, "(1 Pt)", "(1 Pt)", tda, 0,
    					0xFF981F, false, true, 40);
    			addClickableText(37015 + index, "(10 Pts)", "(10 Pts)", tda, 0,
    					0xFF981F, false, true, 40);
    			addClickableText(37016 + index, "(100 Pts)", "(100 Pts)", tda, 0,
    					0xFF981F, false, true, 40);
    			setBounds(37012 + index, x, y, index, scroll);
    			setBounds(37013 + index, x + 32, y, index + 1, scroll);
    			setBounds(37014 + index, x + 32, y + 16, index + 2, scroll);
    			setBounds(37015 + index, x + 70, y + 16, index + 3, scroll);
    			setBounds(37016 + index, x + 120, y + 16, index + 4, scroll);
    			y += 40;
    			if (imageId == 8) {
    				x += 210;
    				y = 5;
    			}
    			imageId++;
    		}
    		addSprite(37050, 2, "Interfaces/Pest Control/Reward/IMAGE");
    		setBounds(37050, 53, 165, 35, scroll);
    		addSprite(37051, 2, "Interfaces/Pest Control/Reward/IMAGE");
    		setBounds(37051, 53, 265, 36, scroll);
    		x = 5;
    		y = 180;
    		names = new String[] { "Herb Pack", "Seed Pack", "Mineral Pack",
    				"Void Knight Mace", "Void Knight Robe", "Void Mage Helm",
    				"Void Melee Helm", "Void Knight Top", "Void Knight Gloves",
    				"Void Range Helm", "Fighter Torso", "Barrows Gloves",
    				"Fighter Hat" };
    		int[] items = new int[] { 257, 5295, 449, 8841, 8840, 11663, 11665,
    				8839, 8842, 11664, 10551, 7462, 10548 };
    		String[] costs = new String[] { "(30 Pts)", "(15 Pts)", "(15 Pts)",
    				"(125 Pts)", "(150 Pts)", "(125 Pts)", "(125 Pts)",
    				"(150 Pts)", "(100 Pts)", "(125 Pts)", "(275 Pts)",
    				"(35 Pts)", "(50 Pts)" };
    		for (int index = 0; index < 39; index += 3) {
    			addText(37052 + index, names[index / 3], tda, 1, 0x339900, false,
    					true);
    			addClickableText(37053 + index, costs[index / 3], costs[index / 3],
    					tda, 0, 0xFF981F, false, true, 40);
    			addToItemGroup(37054 + index, 1, 1, 0, 0, false, "", "", "");
    			interfaceCache[37054 + index].inv = new int[] { items[index / 3] + 1 };
    			interfaceCache[37054 + index].invStackSizes = new int[] { 1 };
    			setBounds(37052 + index, x + 32, y, 37 + index, scroll);
    			setBounds(37053 + index, x + 32, y + 16, 37 + index + 1, scroll);
    			setBounds(37054 + index, x, y, 37 + index + 2, scroll);
    			y += 40;
    			if (y == 220 && x == 215) {
    				x = 5;
    				y = 280;
    			}
    			if (x == 5 && y == 440) {
    				x += 210;
    				y = 280;
    			}
    			if (y == 260) {
    				x += 210;
    				y = 180;
    			}
    			if (x == 215 && y == 440) {
    				x -= 210;
    			}
    			if (x == 5 && y == 480) {
    				x = 215;
    				y = 440;
    			}
    		}
    		darken(37100, 200, 40, 0x000000, (byte) 100);
    		setBounds(37100, 0, 0, 76, scroll);
    	}


    here we have itemIds in an array:
    Code:
     		int[] items = new int[] { 257, 5295, 449, 8841, 8840, 11663, 11665,
    				8839, 8842, 11664, 10551, 7462, 10548 };
    and here is how the items are displayed:

    Code:
     		addToItemGroup(37054 + index, 1, 1, 0, 0, false, "", "", "");
    			interfaceCache[37054 + index].inv = new int[] { items[index / 3] + 1 };
    			interfaceCache[37054 + index].invStackSizes = new int[] { 1 };
    its saying use interface 37054 + index as start of the items and show the specific item on the interface at the ( [index/3]+1 ) position because
    Code:
     interfaceCache[37054 + index].inv
    is what actually makes it show up
    My guy was just browsing about my way around runeserver came around ur comment randomly read it learned alot lmao didnt even expect learning anything tbh, ur a good man
    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: 1
    Last Post: 11-07-2021, 03:54 PM
  2. Replies: 9
    Last Post: 11-07-2020, 01:51 AM
  3. [ANGUISH/ASCEND/ETHOS] Better ItemOnObject
    By 1047881l in forum Help
    Replies: 5
    Last Post: 09-02-2020, 11:08 PM
  4. Replies: 4
    Last Post: 08-29-2020, 06:38 AM
  5. [ANGUISH-ASCEND]NPC drop table bug
    By runtw2 in forum Help
    Replies: 5
    Last Post: 04-25-2020, 10:02 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
  •