Thread: varbit issu

Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1 varbit issu 
    Donator
    Gladius.'s Avatar
    Join Date
    May 2010
    Posts
    1,160
    Thanks given
    112
    Thanks received
    58
    Rep Power
    11
    hello rune server i have a issu with my varbit (i think it's the varbit)



    as you can see i can use the falador farming for the allotment north-west the flower and herb patch and when i want to clear the allotment south-east it does nothing and i have the same on all patch's in catherby
    can sombody tell me how i can fix it?
    and yea i have already tried to use another varbit.

    i use for the allotment west config 504 and for the one south 505 and when i change the 505 to the 504 it will use the west allotment



    Reply With Quote  
     

  2. #2  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    I didn't really understand much here.
    Read the object definitions and get the varbit id that's associated to the object there. You're using some random numbers right now with no proof of them being the correct ones.
    Attached image
    Reply With Quote  
     

  3. #3  
    Donator
    Gladius.'s Avatar
    Join Date
    May 2010
    Posts
    1,160
    Thanks given
    112
    Thanks received
    58
    Rep Power
    11
    Quote Originally Posted by Kris View Post
    I didn't really understand much here.
    Read the object definitions and get the varbit id that's associated to the object there. You're using some random numbers right now with no proof of them being the correct ones.
    i have add a video. Perhaps this makes it clearer


    Reply With Quote  
     

  4. #4  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    You're sending an incorrect varbit for the last patch. Simple.
    Attached image
    Reply With Quote  
     

  5. #5  
    Donator
    Gladius.'s Avatar
    Join Date
    May 2010
    Posts
    1,160
    Thanks given
    112
    Thanks received
    58
    Rep Power
    11
    bump


    Reply With Quote  
     

  6. #6  
    Donator
    Gladius.'s Avatar
    Join Date
    May 2010
    Posts
    1,160
    Thanks given
    112
    Thanks received
    58
    Rep Power
    11
    bump


    Reply With Quote  
     

  7. #7  
    Donator


    Join Date
    Jan 2014
    Posts
    1,652
    Thanks given
    428
    Thanks received
    501
    Rep Power
    221
    When i was doing osrs i noticed that just 1 regular config is used for all patches in rs.
    Reply With Quote  
     

  8. #8  
    Donator

    Join Date
    Nov 2012
    Posts
    252
    Thanks given
    40
    Thanks received
    10
    Rep Power
    24
    I remember this thread from Stan, perhaps it could help you out: https://www.rune-server.ee/runescape...fig-value.html
    Reply With Quote  
     

  9. #9  
    Donator
    Gladius.'s Avatar
    Join Date
    May 2010
    Posts
    1,160
    Thanks given
    112
    Thanks received
    58
    Rep Power
    11
    this is how i have it now and i have now idea how i must use this

    Code:
    Config value: configValue = (configValues[0] << 16) + (configValues[1] << 8 << 16) + configValues[2] + (configValues[3] << 8);
    Code:
    package com.gladius.game.content.skill.member.farming;
    
    public enum FarmingPatches {
    	
    	/*CATHERBY_ALLOTMENT_NORTH(2805, 3465, 2815, 3469, 65536, 504, 5343, 2275, 5329, SeedType.ALLOTMENT), 
    	CATHERBY_ALLOTMENT_SOUTH(2805, 3458, 2815, 3461, 16777216, 504, 5343, 2275, 5329, SeedType.ALLOTMENT), 
    	CATHERBY_HERB(2813, 3462, 2815, 3464, 256, 515, 5343, 2275, 5329, SeedType.HERB), 
    	CATHERBY_FLOWER(2808, 3462, 2811, 3465, 256, 508, 5343, 2275, 5329, SeedType.FLOWER),*/
    	
    	SOUTH_FALADOR_HERB(3058, 3310, 3060, 3313, 1, 515, 5343, 2275, 5329, SeedType.HERB),
    	SOUTH_FALADOR_FLOWER(3054, 3306, 3056, 3307, 1, 508, 5343, 2275, 5329, SeedType.FLOWER),
    	SOUTH_FALADOR_ALLOTMENT_WEST(3050, 3306, 3055, 3312, 1, 504, 5343, 2275, 5329, SeedType.ALLOTMENT),
    	SOUTH_FALADOR_ALLOTMENT_SOUTH(3055, 3302, 3059, 3309, 1, 504, 5343, 2275, 5329, SeedType.ALLOTMENT);
    	
    	public final int x;
    	public final int y;
    	public final int x2;
    	public final int y2;
    	public final int mod;
    	public final int config;
    	public final int harvestAnimation;
    	public final int harvestItem;
    	public final int planter;
    	public final SeedType seedType;
    
    	private FarmingPatches(int x, int y, int x2, int y2, int mod, int config, int planter, int harvestAnimation,
    			int harvestItem, SeedType seedType) {
    		this.x = x;
    		this.y = y;
    		this.x2 = x2;
    		this.y2 = y2;
    		this.mod = mod;
    		this.config = config;
    		this.harvestAnimation = harvestAnimation;
    		this.harvestItem = harvestItem;
    		this.planter = planter;
    		this.seedType = seedType;
    	}
    }

    and if it may help here is my farming.java

    Code:
    package com.gladius.game.content.skill.member.farming;
    
    import java.io.*;
    
    import com.gladius.cache.def.ItemDefinition;
    import com.gladius.game.content.skill.Skill;
    import com.gladius.game.entity.character.player.Player;
    import com.gladius.game.world.update.flag.block.Animation;
    import com.gladius.util.Misc;
    
    public class Farming {
    	private final Player player;
    	private Plant[] plants = new Plant[4];//Is there only 4 types of plants? doesnt seem right
    	private GrassyPatch[] patches = new GrassyPatch[4];
    
    	public Farming(Player player) {
    		this.player = player;
    
    		for (int i = 0; i < patches.length; i++)
    			if (patches[i] == null)
    				patches[i] = new GrassyPatch();
    	}
    
    	public void sequence() {
    		for (Plant i : plants) {
    			if (i != null) {
    				i.process(player);
    			}
    		}
    		for (int i = 0; i < patches.length; i++) {
    			if (i >= FarmingPatches.values().length)
    				break;
    			if ((patches[i] != null) && (!inhabited(FarmingPatches.values()[i].x, FarmingPatches.values()[i].y))) {
    				patches[i].process(player, i);
    			}
    		}
    	}
    
    	public void doConfig() {
    		for (int i = 0; i < FarmingPatches.values().length; i++) {
    			int value = getConfigFor(FarmingPatches.values()[i].config), config = FarmingPatches.values()[i].config;
    			if(value < Byte.MIN_VALUE || value > Byte.MAX_VALUE)
    				player.getPacketSender().sendToggle(config, value);
    			else
    				player.getPacketSender().sendConfig(config, value);
    		}
    	}
    
    	public int getConfigFor(int configId) {
    		int config = 0;
    
    		for (FarmingPatches i : FarmingPatches.values()) {
    			if (i.config == configId) {
    				if (inhabited(i.x, i.y)) {
    					for (Plant plant : plants)
    						if ((plant != null) && (plant.getPatch().ordinal() == i.ordinal())) {
    							config += plant.getConfig();
    							break;
    						}
    				} else {
    					config += patches[i.ordinal()].getConfig(i.ordinal());
    				}
    			}
    		}
    
    		return config;
    	}
    
    	public void clear() {
    		for (int i = 0; i < plants.length; i++) {
    			plants[i] = null;
    		}
    
    		for (int i = 0; i < patches.length; i++)
    			patches[i] = new GrassyPatch();
    	}
    
    	public void nextWateringCan(int id) {
    		player.getInventory().delete(id, 1).add(id > 5333 ? (id - 1) : (id - 2), 1);
    	}
    
    	public void insert(Plant patch) {
    		for (int i = 0; i < plants.length; i++)
    			if (plants[i] == null) {
    				plants[i] = patch;
    				break;
    			}
    	}
    
    	public boolean inhabited(int x, int y) {
    		for (int i = 0; i < plants.length; i++) {
    			if (plants[i] != null) {
    				FarmingPatches patch = plants[i].getPatch();
    				if ((x >= patch.x) && (y >= patch.y) && (x <= patch.x2) && (y <= patch.y2)) {
    					if(x == 3054 && y == 3307 && patch != FarmingPatches.SOUTH_FALADOR_FLOWER)
    						continue;
    					return true;
    				}
    			}
    		}
    
    		return false;
    	}
    
    	public boolean click(Player player, int x, int y, int option) {
    		if(option == 1)
    			for (int i = 0; i < FarmingPatches.values().length; i++) {
    				FarmingPatches patch = FarmingPatches.values()[i];
    				if ((x >= patch.x) && (y >= patch.y) && (x <= patch.x2) && (y <= patch.y2)) {
    					if(x == 3054 && y == 3307 && patch != FarmingPatches.SOUTH_FALADOR_FLOWER)
    						continue;
    					//if(patch == FarmingPatches.SOUTH_FALADOR_ALLOTMENT_SOUTH) {
    						//player.getPacketSender().sendMessage("This patch is currently disabled.");
    						//return true;
    					//}
    					if ((inhabited(x, y)) || (patches[i] == null))
    						break;
    					patches[i].click(player, option, i);
    					return true;
    				}
    
    			}
    		for (int i = 0; i < plants.length; i++) {
    			if (plants[i] != null) {
    				FarmingPatches patch = plants[i].getPatch();
    				if ((x >= patch.x) && (y >= patch.y) && (x <= patch.x2) && (y <= patch.y2)) {
    					if(x == 3054 && y == 3307 && patch != FarmingPatches.SOUTH_FALADOR_FLOWER)
    						continue;
    					plants[i].click(player, option);
    					return true;
    				}
    			}
    		}
    
    		return false;
    	}
    
    	public void remove(Plant plant) {
    		for (int i = 0; i < plants.length; i++)
    			if ((plants[i] != null) && (plants[i] == plant)) {
    				patches[plants[i].getPatch().ordinal()].setTime();
    				plants[i] = null;
    				doConfig();
    				return;
    			}
    	}
    
    	public boolean useItemOnPlant(int item, int x, int y) {
    		if (item == 5341) {
    			for (int i = 0; i < FarmingPatches.values().length; i++) {
    				FarmingPatches patch = FarmingPatches.values()[i];
    				if ((x >= patch.x) && (y >= patch.y) && (x <= patch.x2) && (y <= patch.y2)) {
    					if(x == 3054 && y == 3307 && patch != FarmingPatches.SOUTH_FALADOR_FLOWER)
    						continue;
    					patches[i].rake(player, i);
    					break;
    				}
    			}
    			return true;
    		}
    		for (int i = 0; i < plants.length; i++) {
    			if (plants[i] != null) {
    				FarmingPatches patch = plants[i].getPatch();
    				if ((x >= patch.x) && (y >= patch.y) && (x <= patch.x2) && (y <= patch.y2)) {
    					if(x == 3054 && y == 3307 && patch != FarmingPatches.SOUTH_FALADOR_FLOWER)
    						continue;
    					plants[i].useItemOnPlant(player, item);
    					return true;
    				}
    			}
    		}
    
    		return false;
    	}
    
    	public boolean plant(int seed, int object, int x, int y) {
    		if (!Plants.isSeed(seed)) {
    			return false;
    		}
    		
    		for (FarmingPatches patch : FarmingPatches.values()) {
    			if ((x >= patch.x) && (y >= patch.y) && (x <= patch.x2) && (y <= patch.y2)) {
    				if(x == 3054 && y == 3307 && patch != FarmingPatches.SOUTH_FALADOR_FLOWER)
    					continue;
    				if (!patches[patch.ordinal()].isRaked()) {
    					player.getPacketSender().sendMessage("This patch needs to be raked before anything can grow in it.");
    					return true;
    				}
    
    				for (Plants plant : Plants.values()) {
    					if (plant.seed == seed) {
    						if (player.getSkillManager().getCurrentLevel(Skill.FARMING) >= plant.level) {
    							if (inhabited(x, y)) {
    								player.getPacketSender().sendMessage("There are already seeds planted here.");
    								return true;
    							}
    
    							if (patch.seedType != plant.type) {
    								player.getPacketSender().sendMessage("You can't plant this type of seed here.");
    								return true;
    							}
    							boolean MAGIC_SECATEURS = player.getInventory().contains(FarmingConstants.MAGIC_SECATEURS) || player.getEquipment().contains(FarmingConstants.MAGIC_SECATEURS);
    							if (player.getInventory().contains(FarmingConstants.SECATEURS) || MAGIC_SECATEURS) {
    								player.performAnimation(new Animation(2291));
    								player.getPacketSender().sendMessage("You bury the seed in the dirt.");
    								player.getInventory().delete(seed, 1, true);
    								Plant planted = new Plant(patch.ordinal(), plant.ordinal());
    								double XP = 1;//percentage
    								planted.setTime();
    								insert(planted);
    								doConfig();
    								if(MAGIC_SECATEURS)XP = 1.1;//percentage
    								player.getSkillManager().addExperience(Skill.FARMING, plant.plantExperience, XP);
    							} else {
    								String name = ItemDefinition.forId(FarmingConstants.SECATEURS).getName();
    								player.getPacketSender().sendMessage("You need " + Misc.anOrA(name) + " " +name+ " to plant seeds.");
    							}
    
    						} else {
    							player.getPacketSender().sendMessage("You need a Farming level of " + plant.level + " to plant this.");
    						}
    
    						return true;
    					}
    				}
    
    				return false;
    			}
    		}
    
    		return false;
    	}
    
    	public Plant[] getPlants() {
    		return plants;
    	}
    
    	public void setPlants(Plant[] plants) {
    		this.plants = plants;
    	}
    
    	public GrassyPatch[] getPatches() {
    		return patches;
    	}
    
    	public void setPatches(GrassyPatch[] patches) {
    		this.patches = patches;
    	}
    
    	/*
    	 * Saving
    	 * Don't wanna fill up player class lol
    	 */
    	private static final String DIR = "./data/saves/farming/";
    
    	public void save() {
    		if(!player.shouldProcessFarming())
    			return;
    		try {
    			BufferedWriter writer = new BufferedWriter(new FileWriter(DIR + ""+player.getUsername()+".txt"));
    			for (int i = 0; i < patches.length; i++) {
    				if (i >= FarmingPatches.values().length)
    					break;
    				if (patches[i] != null) {
    					writer.write("[PATCH]");
    					writer.newLine();
    					writer.write("patch: "+i);
    					writer.newLine();
    					writer.write("stage: "+patches[i].stage);
    					writer.newLine();
    					writer.write("minute: "+patches[i].minute);
    					writer.newLine();
    					writer.write("hour: "+patches[i].hour);
    					writer.newLine();
    					writer.write("day: "+patches[i].day);
    					writer.newLine();
    					writer.write("year: "+patches[i].year);
    					writer.newLine();
    					writer.write("END PATCH");
    					writer.newLine();
    					writer.newLine();
    				}
    			}
    			for (int i = 0; i < plants.length; i++) {
    				if (plants[i] != null) {
    					writer.write("[PLANT]");
    					writer.newLine();
    					writer.write("patch: "+plants[i].patch);
    					writer.newLine();
    					writer.write("plant: "+plants[i].plant);
    					writer.newLine();
    					writer.write("stage: "+plants[i].stage);
    					writer.newLine();
    					writer.write("watered: "+plants[i].watered);
    					writer.newLine();
    					writer.write("harvested: "+plants[i].harvested);
    					writer.newLine();
    					writer.write("minute: "+plants[i].minute);
    					writer.newLine();
    					writer.write("hour: "+plants[i].hour);
    					writer.newLine();
    					writer.write("day: "+plants[i].day);
    					writer.newLine();
    					writer.write("year: "+plants[i].year);
    					writer.newLine();
    					writer.write("END PLANT");
    					writer.newLine();
    					writer.newLine();
    				}
    			}
    			writer.close();
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    	}
    
    	public void load() {
    		if(!player.shouldProcessFarming())
    			return;
    		try {
    			BufferedReader r = new BufferedReader(new FileReader(DIR + ""+player.getUsername()+".txt"));
    			int stage = -1, patch = -1, plant = -1, watered = -1, minute = -1, hour = -1, day = -1, year = -1, harvested = -1;
    			while(true) {
    				String line = r.readLine();
    				if(line == null) {
    					break;
    				} else {
    					line = line.trim();
    				}
    				if(line.startsWith("patch"))
    					patch = Integer.valueOf(line.substring(line.indexOf(":")+2));
    				else if(line.startsWith("stage"))
    					stage = Integer.valueOf(line.substring(line.indexOf(":")+2));
    				else if(line.startsWith("plant"))
    					plant = Integer.valueOf(line.substring(line.indexOf(":")+2));
    				else if(line.startsWith("watered"))
    					watered = Integer.valueOf(line.substring(line.indexOf(":")+2));
    				else if(line.startsWith("minute"))
    					minute = Integer.valueOf(line.substring(line.indexOf(":")+2));
    				else if(line.startsWith("harvested"))
    					harvested = Integer.valueOf(line.substring(line.indexOf(":")+2));
    				else if(line.startsWith("hour"))
    					hour = Integer.valueOf(line.substring(line.indexOf(":")+2));
    				else if(line.startsWith("day"))
    					day = Integer.valueOf(line.substring(line.indexOf(":")+2));
    				else if(line.startsWith("year"))
    					year = Integer.valueOf(line.substring(line.indexOf(":")+2));
    				else if(line.equals("END PATCH") && patch >= 0) {
    					patches[patch].stage = (byte)stage;
    					patches[patch].minute = minute;
    					patches[patch].hour = hour;
    					patches[patch].day = day;
    					patches[patch].year = year;
    					patch = -1;
    				}
    				else if(line.equals("END PLANT") && patch >= 0) {
    					plants[patch] = new Plant(patch, plant);
    					plants[patch].watered = (byte) watered;
    					plants[patch].stage = (byte) stage;
    					plants[patch].harvested = (byte) harvested;
    					plants[patch].minute = minute;
    					plants[patch].hour = hour;
    					plants[patch].day = day;
    					plants[patch].year = year;
    					patch = -1;
    				}
    			}
    			r.close();
    			doConfig();
    		} catch (IOException e) {
    			//e.printStackTrace();
    		}
    	}
    	
    }


    Reply With Quote  
     

  10. #10  
    Donator
    Gladius.'s Avatar
    Join Date
    May 2010
    Posts
    1,160
    Thanks given
    112
    Thanks received
    58
    Rep Power
    11
    bump


    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. Replies: 29
    Last Post: 08-15-2016, 10:15 AM
  2. New Varrock Guard (issue two)
    By Bobster in forum Tutorials
    Replies: 33
    Last Post: 02-24-2008, 03:49 AM
  3. Bundle 1 (Issue three)
    By Bobster in forum Tutorials
    Replies: 9
    Last Post: 12-21-2007, 03:11 PM
  4. New Goblin (Issue one)
    By Bobster in forum Tutorials
    Replies: 21
    Last Post: 12-20-2007, 02:00 PM
  5. webclient issues[PLEASE HELP ME]
    By Spoonkitty in forum RS2 Client
    Replies: 5
    Last Post: 08-15-2007, 11:29 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
  •