Thread: [Project Insanity] 100% Bird Nests remake

Page 1 of 3 123 LastLast
Results 1 to 10 of 22
  1. #1 [Project Insanity] 100% Bird Nests remake 
    Registered Member
    Optimum's Avatar
    Join Date
    Apr 2012
    Posts
    3,570
    Thanks given
    871
    Thanks received
    1,745
    Rep Power
    5000
    So a little while ago i made this: http://www.rune-server.org/runescape...i-copy-pi.html

    This is what you're adding:


    Now that i have started my woodcutting base on my server i have made a better birds nests class. than my other class - First make a new class called BirdsNests.java and add all this in it You will need to change the impot of your client and the package location

    Code:
    package org.rs2server.entity.players.skills.woodcutting;
    
    import java.util.Random;
    
    import org.rs2server.Server;
    import org.rs2server.entity.players.Client;
    
    /**
     * This will handle the opening of the birds nests and
     * it will handle dropping the birds nest
     * @author Zack/optimum
     *
     */
    public class BirdsNests {
    	
    	/**
    	 * This will randomly generate a percentage
    	 */
    	private static Random rnd = new Random();
    	
    	/**
    	 * This contains all of the nest item ids.
    	 */
    	private static final int[] NESTS = {
    			5070, 5071, 5072, 5073, 5074, 5075
    	};
    	
    	/**
    	 * This holds all the ring data: ItemId, Percentage
    	 */
    	private static final int[][] RINGS = {
    			{1635, 35}, {1637, 75}, {1639, 90}, {1641, 99}, {1643, 100}
    	};
    	
    	/**
    	 * This holds all the seeds data: ItemId, Percentage
    	 */
    	private static final int[][] SEEDS = {
    			{5317, 1}, {5290, 3}, {5289, 5}, {5288, 9}, {5287, 13},
    			{5286, 19}, {5285, 28}, {5284, 38}, {5283, 54}, {5316, 55},
    			{5315, 58}, {5314, 64}, {5313, 79}, {5312, 100}, 
    	};
    	
    	/**
    	 * This method will check if the item being clicked is
    	 * a nest.
    	 * @param itemId - Is the item being clicked
    	 * @return if the itemIf is a nest
    	 */
    	public static boolean isNest(int itemId) {
    		for(int i : NESTS) {
    			if(i == itemId) {
    				return true;
    			}
    		}
    		return false;
    	}
    	
    	/**
    	 * This handles the opening of a birds nest
    	 * @param player
    	 * @param itemId - this is the item id thats being clicked
    	 */
    	public static void handleOpen(Client player, int itemId) {
    		if(player.getItems().freeSlots() < 1){
    			player.sendMessage("You need atleast 1 free inventory space to open this!");
    			return;
    		}
    		switch(itemId) {
    			case 5073:
    				openSeedNest(player);
    				player.getItems().deleteItem(itemId, 1);
    				player.getItems().addItem(5075, 1);
    				return;
    			case 5074:
    				openRingNest(player);
    				player.getItems().deleteItem(itemId, 1);
    				player.getItems().addItem(5075, 1);
    				return;
    			case 5070:
    			case 5071:
    			case 5072:
    				player.getItems().deleteItem(itemId, 1);
    				player.getItems().addItem(itemId + 6, 1);
    				player.getItems().addItem(5075, 1);
    				return;
    		}
    	}
    	
    	/**
    	 * This opens the Seed Nests and gives the player
    	 * a random seed item based on the seed percentage.
    	 * @param player
    	 */
    	private static void openSeedNest(Client player) {
    		int random = 1 + rnd.nextInt(100);
    		for(int i = 0; i < SEEDS.length; i++) {
    			if(random <= SEEDS[i][1]) {
    				player.getItems().addItem(SEEDS[i][0], 1);
    				return;
    			}
    		}
    	}
    	
    	/**
    	 * This opens the Ring Nests and gives the player
    	 * a random ring item based on the ring percentage.
    	 * @param player
    	 */
    	private static void openRingNest(Client player) {
    		int random = 1 + rnd.nextInt(100);
    		for(int i = 0; i < RINGS.length; i++) {
    			if(random <= RINGS[i][1]) {
    				player.getItems().addItem(RINGS[i][0], 1);
    				return;
    			}
    		}
    	}
    	
    	/**
    	 * This method drops a birds nest right at a players feet
    	 * at a chance of 500
    	 */
    	public static void dropNest(Client player) {
    		if(rnd.nextInt(500) == 0) {
    			Server.itemHandler.createGroundItem(
    					player, NESTS[rnd.nextInt(NESTS.length)],
    					player.getX(), player.getY(), 1, player.playerId);
    		}
    	}
    
    }

    open up the class ClickItem and go to this method - processPacket add this:

    Code:
    		if(BirdsNests.isNest(itemId)){
    			BirdsNests.handleOpen(c, itemId);
    			return;
    		}
    Thats you done. A thanks would be appretiated. Constructive critisism is welcome. Feel free to use the rep button

    Also if i have missed anything please tell me

    Quote Originally Posted by DownGrade View Post
    Don't let these no life creeps get to you, its always the same on here. They'd rather spend hours upon hours in the rune-server spam section then getting laid! ha ha!Its honestly pathetic i haven't seen so many lowlifes in my life its actually insane i wish that this section would just vanish its probably the only way to get these people out of the community...
    PLEASE BE AWARE OF IMPOSTERS MY DISCORD ID: 362240000760348683
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    Donator
    Smile Cow's Avatar
    Join Date
    Apr 2014
    Posts
    214
    Thanks given
    51
    Thanks received
    34
    Rep Power
    40
    Nice, much more organized than I did it
    Reply With Quote  
     

  4. #3  
    Registered Member
    Optimum's Avatar
    Join Date
    Apr 2012
    Posts
    3,570
    Thanks given
    871
    Thanks received
    1,745
    Rep Power
    5000
    Quote Originally Posted by Smile Cow View Post
    Nice, much more organized than I did it
    Thanks

    Quote Originally Posted by DownGrade View Post
    Don't let these no life creeps get to you, its always the same on here. They'd rather spend hours upon hours in the rune-server spam section then getting laid! ha ha!Its honestly pathetic i haven't seen so many lowlifes in my life its actually insane i wish that this section would just vanish its probably the only way to get these people out of the community...
    PLEASE BE AWARE OF IMPOSTERS MY DISCORD ID: 362240000760348683
    Reply With Quote  
     

  5. #4  
    Registered Member Pseudo's Avatar
    Join Date
    Jan 2014
    Posts
    227
    Thanks given
    31
    Thanks received
    43
    Rep Power
    37
    All in all it's a decent release. If I was to be critical I would say that you could make some modifications for code reusability (though very minimal).

    Also, by convention, a constant is static final.
    Reply With Quote  
     

  6. #5  
    Registered Member
    Optimum's Avatar
    Join Date
    Apr 2012
    Posts
    3,570
    Thanks given
    871
    Thanks received
    1,745
    Rep Power
    5000
    Quote Originally Posted by Pseudo_ View Post
    All in all it's a decent release. If I was to be critical I would say that you could make some modifications for code reusability (though very minimal).

    Also, by convention, a constant is static final.
    Thanks for the feed back, I shall change my final variable and also, there is really no need to reuse any methods as it's a bird nest changed it there

    Quote Originally Posted by DownGrade View Post
    Don't let these no life creeps get to you, its always the same on here. They'd rather spend hours upon hours in the rune-server spam section then getting laid! ha ha!Its honestly pathetic i haven't seen so many lowlifes in my life its actually insane i wish that this section would just vanish its probably the only way to get these people out of the community...
    PLEASE BE AWARE OF IMPOSTERS MY DISCORD ID: 362240000760348683
    Reply With Quote  
     

  7. #6  
    Registered Member
    Join Date
    Jul 2014
    Posts
    49
    Thanks given
    1
    Thanks received
    15
    Rep Power
    23
    Why are you instantiating the class?
    Reply With Quote  
     

  8. Thankful user:


  9. #7  
    Registered Member
    Optimum's Avatar
    Join Date
    Apr 2012
    Posts
    3,570
    Thanks given
    871
    Thanks received
    1,745
    Rep Power
    5000
    Quote Originally Posted by Regnier View Post
    Why are you instantiating the class?
    Because its not static

    Quote Originally Posted by DownGrade View Post
    Don't let these no life creeps get to you, its always the same on here. They'd rather spend hours upon hours in the rune-server spam section then getting laid! ha ha!Its honestly pathetic i haven't seen so many lowlifes in my life its actually insane i wish that this section would just vanish its probably the only way to get these people out of the community...
    PLEASE BE AWARE OF IMPOSTERS MY DISCORD ID: 362240000760348683
    Reply With Quote  
     

  10. #8  
    Registered Member
    Zivik's Avatar
    Join Date
    Oct 2007
    Age
    28
    Posts
    4,421
    Thanks given
    891
    Thanks received
    1,527
    Rep Power
    3285
    Quote Originally Posted by Optimum View Post
    Because its not static
    Is there a reason you didn't use an enum for something like this? I get the data is small enough to compact it into an array like you have, would look nicer imo.
    Reply With Quote  
     

  11. #9  
    Registered Member
    Optimum's Avatar
    Join Date
    Apr 2012
    Posts
    3,570
    Thanks given
    871
    Thanks received
    1,745
    Rep Power
    5000
    Quote Originally Posted by Zivik View Post
    Is there a reason you didn't use an enum for something like this? I get the data is small enough to compact it into an array like you have, would look nicer imo.
    As you said. Its a small array

    Quote Originally Posted by DownGrade View Post
    Don't let these no life creeps get to you, its always the same on here. They'd rather spend hours upon hours in the rune-server spam section then getting laid! ha ha!Its honestly pathetic i haven't seen so many lowlifes in my life its actually insane i wish that this section would just vanish its probably the only way to get these people out of the community...
    PLEASE BE AWARE OF IMPOSTERS MY DISCORD ID: 362240000760348683
    Reply With Quote  
     

  12. #10  
    Registered Member DamoRSPS's Avatar
    Join Date
    Feb 2014
    Posts
    192
    Thanks given
    38
    Thanks received
    6
    Rep Power
    12
    My errors..

    src\server\content\BirdsNests.java.java:12: error: class BirdsNests is public, s
    hould be declared in a file named BirdsNests.java
    public class BirdsNests {
    ^
    src\server\content\BirdsNests.java.java:5: error: cannot find symbol
    import org.rs2server.Server;
    ^
    symbol: class Server
    location: package org.rs2server
    src\server\content\BirdsNests.java.java:6: error: cannot find symbol
    import org.rs2server.entity.players.Client;
    ^
    symbol: class Client
    location: package org.rs2server.entity.players
    src\server\content\BirdsNests.java.java:62: error: cannot find symbol
    public void handleOpen(Client player, int itemId) {
    ^
    symbol: class Client
    location: class BirdsNests
    src\server\content\BirdsNests.java.java:93: error: cannot find symbol
    void openSeedNest(Client player) {
    ^
    symbol: class Client
    location: class BirdsNests
    src\server\content\BirdsNests.java.java:108: error: cannot find symbol
    void openRingNest(Client player) {
    ^
    symbol: class Client
    location: class BirdsNests
    src\server\content\BirdsNests.java.java:122: error: cannot find symbol
    public void dropNest(Client player) {
    ^
    symbol: class Client
    location: class BirdsNests
    src\server\model\players\packets\ClickItem.java:58 : error: cannot find symbol
    BirdsNests nest = new BirdsNests();
    ^
    symbol: class BirdsNests
    location: class ClickItem
    src\server\model\players\packets\ClickItem.java:58 : error: cannot find symbol
    BirdsNests nest = new BirdsNests();
    ^
    symbol: class BirdsNests
    location: class ClickItem
    src\server\model\players\packets\Commands.java:104 1: error: cannot find symbol
    for (Player client : PlayerHandler.players) {
    ^
    symbol: class Player
    location: class Commands
    src\server\content\BirdsNests.java.java:124: error: package Server does not exis
    t
    Server.itemHandler.createGroundItem(
    ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    11 errors
    Press any key to continue . . .


    Dont hate, just tell what i did wrong. :L


    Reply With Quote  
     

Page 1 of 3 123 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: 77
    Last Post: 08-29-2014, 09:22 PM
  2. [100%] Bird Nest's
    By LittleMac7 in forum Snippets
    Replies: 20
    Last Post: 03-13-2014, 06:56 AM
  3. Replies: 35
    Last Post: 06-30-2013, 02:35 PM
  4. Replies: 33
    Last Post: 12-01-2011, 12:59 AM
  5. Project-Insanity By Sanity [317] [100% uptime]
    By Mr Brent in forum Advertise
    Replies: 297
    Last Post: 01-30-2010, 07:48 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •