Thread: trying to add silver crafting

Results 1 to 4 of 4
  1. #1 trying to add silver crafting 
    Registered Member
    Join Date
    May 2012
    Posts
    111
    Thanks given
    10
    Thanks received
    3
    Rep Power
    9
    as title says looking to add sliver crafting ive got the use silver on furnace down and have the interface 13782 to open for silver casting but its got no buttons to click anyone able to help add buttons and things i can get the rest from there hoping it something simple
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Mar 2019
    Posts
    57
    Thanks given
    3
    Thanks received
    2
    Rep Power
    13
    Isn’t there another form of crafting for you can use to get an idea how to add it like gems/gold bar? Then just change the buttons when you find out what the button ID’s are for silver crafting. Not familiar with silver crafting so this might be useless.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    May 2012
    Posts
    111
    Thanks given
    10
    Thanks received
    3
    Rep Power
    9
    Code:
    package com.mayhem.rs2.content.skill.crafting;
    
    import com.mayhem.core.task.Task;
    import com.mayhem.core.task.TaskQueue;
    import com.mayhem.core.task.impl.TaskIdentifier;
    import com.mayhem.core.util.Utility;
    import com.mayhem.rs2.content.skill.smithing.Smelting;
    import com.mayhem.rs2.entity.item.Item;
    import com.mayhem.rs2.entity.player.Player;
    import com.mayhem.rs2.entity.player.net.out.impl.SendInterface;
    import com.mayhem.rs2.entity.player.net.out.impl.SendInterfaceConfig;
    import com.mayhem.rs2.entity.player.net.out.impl.SendMessage;
    import com.mayhem.rs2.entity.player.net.out.impl.SendRemoveInterfaces;
    import com.mayhem.rs2.entity.player.net.out.impl.SendSound;
    import com.mayhem.rs2.entity.player.net.out.impl.SendString;
    import com.mayhem.rs2.entity.player.net.out.impl.SendUpdateItemsAlt;
    
    public class JewelryCreationTask extends Task {
    	
    	public static void sendInterface(Player p) {
    		for (int k = 0; k < 3; k++) {
    			int interfaceId = 4233;
    
    			if (k == 1)
    				interfaceId = 4239;
    			else if (k == 2) {
    				interfaceId = 4245;
    			}
    			for (int i = 0; i < JEWELRY_INTERFACE_ITEMS[k].length; i++) {
    				p.getClient().queueOutgoingPacket(new SendUpdateItemsAlt(interfaceId, JEWELRY_INTERFACE_ITEMS[k][i], 1, i));
    			}
    		}
    
    		p.getClient().queueOutgoingPacket(new SendInterfaceConfig(4229, 0, -1));
    		p.getClient().queueOutgoingPacket(new SendInterfaceConfig(4235, 0, -1));
    		p.getClient().queueOutgoingPacket(new SendInterfaceConfig(4241, 0, -1));
    
    		p.getClient().queueOutgoingPacket(new SendString("", 4230));
    		p.getClient().queueOutgoingPacket(new SendString("", 4236));
    		p.getClient().queueOutgoingPacket(new SendString("", 4242));
    
    		p.getClient().queueOutgoingPacket(new SendInterface(4161));
    	}
    
    	private final Player player;
    	private final Jewelry data;
    	private byte amount;
    
    	public static final int[][] JEWELRY_INTERFACE_ITEMS = { 
    		{ 1635, 1637, 1639, 1641, 1643, 1645, 6575 }, 
    		
    		{ 1654, 1656, 1658, 1660, 1662, 1664, 6577 }, 
    		
    		{ 1673, 1675, 1677, 1679, 1681, 1683, 6579 }
    	};
    
    	public static boolean clickButton(Player p, int id) {
    		return false;
    	}
    
    	public static void start(Player p, int item, int amount) {
    		if (Jewelry.forReward(item) != null) {
    			TaskQueue.queue(new JewelryCreationTask(p, Jewelry.forReward(item), amount));
    			p.getClient().queueOutgoingPacket(new SendRemoveInterfaces());
    		}
    	}
    
    	public JewelryCreationTask(Player player, Jewelry data, int amount) {
    		super(player, 2, false, Task.StackType.NEVER_STACK, Task.BreakType.ON_MOVE, TaskIdentifier.CURRENT_ACTION);
    		this.data = data;
    		this.player = player;
    		this.amount = ((byte) amount);
    
    		if (player.getMaxLevels()[12] < data.getRequiredLevel()) {
    			player.send(new SendMessage("This requires a crafting level of " + data.getRequiredLevel() + "!"));
    			stop();
    			return;
    		}
    
    		for (int i : data.getMaterialsRequired())
    			if (!player.getInventory().hasItemId(i)) {
    				String req = Item.getDefinition(i).getName();
    				player.send(new SendMessage("You need " + Utility.getAOrAn(req) + " " + req + " to make this!"));
    				stop();
    				return;
    			}
    	}
    
    	@Override
    	public void execute() {
    		for (int i : data.getMaterialsRequired()) {
    			if (!player.getInventory().hasItemId(i)) {
    				player.send(new SendMessage("You have run out of " + Item.getDefinition(i).getName() + "s."));
    				stop();
    				return;
    			}
    		}
    
    		for (int i : data.getMaterialsRequired()) {
    			if (i != 0)
    				player.getInventory().remove(i, 1, true);
    		}
    
    		if ((this.amount = (byte) (amount - 1)) == 0) {
    			stop();
    		}
    
    		player.getUpdateFlags().sendAnimation(Smelting.SMELTING_ANIMATION);
    
    		player.getClient().queueOutgoingPacket(new SendSound(469, 0, 0));
    
    		player.getInventory().add(data.getReward(), true);
    
    		player.getSkill().addExperience(12, data.getExperience());
    		
    		String name = Item.getDefinition(data.getReward().getId()).getName();
    		
    		player.send(new SendMessage("You have crafted " + Utility.getAOrAn(name) + " " + name + "."));
    	}
    
    	@Override
    	public void onStop() {
    	}
    }
    this is my creation class for gold with opens a different then normal style creations for making gold stuff just didn't really want to make one for silver since theres not much but may have to but don't think it will add buttons to the interface
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Mar 2019
    Posts
    57
    Thanks given
    3
    Thanks received
    2
    Rep Power
    13
    Clickingbuttons file?
    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. run error(trying to add npcs)
    By ic e in forum Help
    Replies: 3
    Last Post: 02-21-2009, 09:49 PM
  2. Trying to add in a gameframe..
    By Philz in forum Help
    Replies: 6
    Last Post: 02-20-2009, 12:36 AM
  3. Replies: 2
    Last Post: 02-09-2009, 10:32 PM
  4. Replies: 6
    Last Post: 09-07-2008, 10:02 AM
  5. to add gold crafting and silvercrafting - basic
    By WH:II:DOW in forum Tutorials
    Replies: 2
    Last Post: 08-20-2008, 09:30 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
  •