Jump to content
Sign in to follow this  
Google rapes Bing

Farming Tutorial part one released!

Recommended Posts

Hey guys i thought i would release part of the farming class since its very easy to do.
I hope you guys enjoy.
Some of the ints aren't needed but are used as a reference.
This is only the raking part. Like the title is PART ONE.
This is my own code, any reposting of my code MUST be given credits to me.
Credits:me 100%




Code:
package com.rs.game.player.actions;
import com.rs.game.Animation;
import com.rs.game.World;
import com.rs.game.WorldObject;
import com.rs.game.player.Player;
import com.rs.game.player.Skills;
import com.rs.utils.Utils;


public class Farming {
public static int RAKE = 5341;
public static final Animation USERAKE = new Animation(2273);
private final static int PATCH_CLEAN_ALLOTMENT = 8132;
private final static int PATCH_CLEAN_HERB = 8132;
private static boolean patchCleaned = false;
private final static int[] VALID_SEEDS = {5291, 5292, 5293, 5294, 5296, 5297, 5298, 5299, 5300, 5301, 5302, 5303, 5295, 5304};
private final static int[] HERBS = {199, 201, 203, 205, 207, 209, 211, 213, 3051, 215, 2485, 217, 3049, 219};
private final static int[] SEED_PLANT_EXP = {10, 15, 30, 35, 70, 75, 150, 155, 310, 315, 630, 635, 1270, 1275};
private final static int[] HERB_EXPS = {220, 330, 660, 770, 1540, 1650, 3300, 3410, 6820, 6930, 13860, 13970, 27940, 28050};
private final static int[] FARMING_REQS = {1, 7, 14, 22, 28, 35, 43, 49, 56, 64, 70, 77, 85, 91};
private static Player player;
static int seedId;
static int herbId;
static int exp;
static int slot;
private static boolean seedPlanted = false;
private static boolean seedWatered = false;
private static boolean patchRaked = false;

private final static int PATCH_HERBS = 8143;
private final static int PATCH_CLEAN = 8132;
private final static int PATCH_WEEDS = 8389;
private final static int PATCH_FLOWER = 7848; /// The unraked flower patch.
private final static int PATCH_FLOWERS = 7840; ///the raked flower patch.
private final static int WATER_CAN = 5340;
private final static int SEED_DIBBER = 5343;
private final static int SPADE = 952;

public Farming(Player player) {
this.player = player;
}


public static void startRake(Player player) {
if (player.getInventory().containsItem(RAKE, 1)) {
player.lock(4);
// the 1000 is the xp once you rake the patch
player.getSkills().addXp(Skills.FARMING, 1000);
player.getPackets().sendGameMessage("You rake the weed.");
player.getInventory().addItem(6055, 1);
player.setNextAnimation(USERAKE);
//calling cleanPatch() so it can spawn the object
cleanPatch();
//refreshs the player's inventory so you will get the item
player.getInventory().refresh();
}
else {
player.getPackets().sendGameMessage("You must have rake, buy one at general store.");
}
}

public static void cleanPatch() {
if (!patchCleaned) {
patchCleaned = true;
//Alright so this will be spawning a object at a location
//it will spawn at this location (click on the link to see the picture).
// [url]http://gyazo.com/5a34718779584ccecae9b4b0a19c9cc1[/url]
//where is says you are here

World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3058, 3308, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3059, 3308, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3058, 3307, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3059, 3307, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3058, 3306, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3059, 3306, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3058, 3305, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3059, 3305, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3055, 3304, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3056, 3304, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3057, 3304, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3058, 3304, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3059, 3304, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3055, 3303, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3056, 3303, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3057, 3303, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3058, 3303, 0), patchCleaned);
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3059, 3303, 0), patchCleaned);


} else {
player.getPackets().sendGameMessage("You have already cleaned the patch.");
}
}

Share this post


Link to post
Share on other sites
This is absolutely atrocious. You don't send new objects for farming patches, you use configurations...

Second, there are much more efficient ways to put your ints[] together. Try an enum.

Thirdly, since you're sending objects instead of configurations...

This:

[code]
World.spawnObject(new WorldObject(PATCH_CLEAN_ALLOTMENT, 10, 0, 3058, 3305, 0), patchCleaned);
[/code]

sends an object to the WHOLE WORLD for ALL the players, not individually like it should be. Since farming is an independent skill.... Edited by Hope
Grammar

Share this post


Link to post
Share on other sites
you can do that but one you click on the patch it spawns the patch also this is part one. I have other methods and files that fixes this but this is just part of it. I like to spawn things to the patch you can use your configs if you want. Unless you want me to fix this and then release the config one. Honestly, if you want me to redo this and do config not a problem. Edited by Google rapes Bing

Share this post


Link to post
Share on other sites
[quote name='Google rapes Bing']you can do that but one you click on the patch it spawns the patch[/QUOTE]

You're not listening though. Your method of farming is inefficient and you should go about re-creating it with configurations and more organized values. Also, use code tags and make sure your conventions are correct...

Share this post


Link to post
Share on other sites
It might be inefficient to you but not to me. I see where you are coming from with this and yes i'll go back and change my code for your benefit. My way of doing this isn't the correct way of going about this but i wanted just to make it simple for people. I will make configs and correct the code. Thank you for your input.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×