Thread: Crystal Chest

Results 1 to 9 of 9
  1. #1 Crystal Chest 
    The internet's reject
    Andy's Avatar
    Join Date
    Jun 2007
    Age
    31
    Posts
    4,376
    Thanks given
    148
    Thanks received
    1,522
    Rep Power
    3133
    Code:
    /*
     * @author Codeusa
     */
    
    public class CrystalChest {
    
    	private static final int[] CHEST_REWARDS = { 1079, 1093, 526, 1969, 371, 2363, 451 };
    
    	private static final int DRAGONSTONE = 1631;
    	private static final int OPEN_ANIMATION = 881;
    public static final int[] KEY_HALVES = { 985, 987 };
    	public static final int KEY = 989;
    
    	public static void createKey(User u) {
    		if (u.getInventory().contains(toothHalf(), 1)
    				&& u.getInventory().contains(loopHalf(), 1)) {
    			u.getInventory().getContainer().remove(new Item(toothHalf(), 1));
    			u.getInventory().getContainer().remove(new Item(loopHalf(), 1));
    			u.getInventory().addItem(KEY, 1);
    		}
    	}
    
    	public static boolean canOpen(User u) {
    		if (u.getInventory().contains(KEY)) {
    			return true;
    		} else {
    			u.sendMessage("The chest is locked");
    			return false;
    		}
    	}
    
    	public static void searchChest(final User u) {
    		if (canOpen(p)) {
    			u.sendMessage("You unlock the chest with your key.");
    			u.getInventory().getContainer().remove(new Item(KEY, 1));
    		u.animate(OPEN_ANIMATION);
    		World.getWorld().submit(new Tick(2) {
    				public void execute() {
    					u.getInventory().addItem(DRAGONSTONE, 1);
    					u.getInventory().addItem(995, Misc.random(8230));
    					u.getInventory().addItem(CHEST_REWARDS[Misc.random(getLength() - 1)], 1);
    					u.sendMessage("You find some treasure in the chest.");
    
    					this.stop();
    				}
    			});
    		}
    	}
    
    	public static int getLength() {
    		return CHEST_REWARDS.length;
    	}
    	public static int toothHalf(){
    		return KEY_HALVES[0];
    	}
    	public static int loopHalf(){
    		return KEY_HALVES[1];
    	}
    }
    There you go, a proper chest. Woop dee doo.
    What am I watching now?

    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    Registered Member wildking72's Avatar
    Join Date
    Sep 2011
    Age
    24
    Posts
    506
    Thanks given
    62
    Thanks received
    36
    Rep Power
    11
    Thank's

    There does seem to be a bit too much there though.
    Reply With Quote  
     

  4. #3  
    Banned
    Join Date
    Jun 2012
    Age
    25
    Posts
    709
    Thanks given
    521
    Thanks received
    87
    Rep Power
    0
    This was already released, but nonetheless, good work.
    Reply With Quote  
     

  5. #4  
    touched like seafood
    Tyluur's Avatar
    Join Date
    Jun 2010
    Age
    23
    Posts
    4,838
    Thanks given
    1,676
    Thanks received
    1,567
    Discord
    View profile
    Rep Power
    1390
    So now you're doing Misc.random(array.length - 1)?
    [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ] (official dog of rune-server)
    Quote Originally Posted by blakeman8192 View Post
    Keep trying. Quitting is the only true failure.
    Reply With Quote  
     

  6. #5  
    Registered Member wildking72's Avatar
    Join Date
    Sep 2011
    Age
    24
    Posts
    506
    Thanks given
    62
    Thanks received
    36
    Rep Power
    11
    Quote Originally Posted by vichy View Post
    This was already released, but nonetheless, good work.
    No it wasn't, the only thing that was released was a couple if statements and an array in 2 different posts, not the Crystal chest.
    Reply With Quote  
     

  7. #6  
    The internet's reject
    Andy's Avatar
    Join Date
    Jun 2007
    Age
    31
    Posts
    4,376
    Thanks given
    148
    Thanks received
    1,522
    Rep Power
    3133
    Quote Originally Posted by Tyluur View Post
    So now you're doing Misc.random(array.length - 1)?
    This was the class I bench marked, never changed it back.
    What am I watching now?

    Reply With Quote  
     

  8. #7  
    Registered Member 741Vick's Avatar
    Join Date
    Apr 2013
    Posts
    101
    Thanks given
    10
    Thanks received
    4
    Rep Power
    11
    whats the chest id?
    Reply With Quote  
     

  9. #8  
    Xerologic Owner
    infinitykill's Avatar
    Join Date
    Jul 2013
    Posts
    57
    Thanks given
    7
    Thanks received
    5
    Rep Power
    11
    Quote Originally Posted by 741Vick View Post
    whats the chest id?
    the chest id is 172?
    Reply With Quote  
     

  10. #9  
    Registered Member _Reece's Avatar
    Join Date
    Oct 2014
    Posts
    830
    Thanks given
    176
    Thanks received
    147
    Rep Power
    31
    Quote Originally Posted by infinitykill View Post
    the chest id is 172?
    Again posting on a 2 year old post.
    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. [667/***] Crystal Chest
    By EpicMeme in forum Snippets
    Replies: 38
    Last Post: 04-06-2013, 05:35 PM
  2. Better Crystal Chest
    By Aksel in forum Snippets
    Replies: 7
    Last Post: 08-11-2012, 07:22 PM
  3. Crystal Chest reward using BoxReward
    By Zanix in forum Snippets
    Replies: 1
    Last Post: 04-02-2012, 10:28 AM
  4. [PI] Crystal Chest
    By killerj012 in forum Snippets
    Replies: 6
    Last Post: 01-13-2012, 11:45 PM
  5. Crystal chest V2
    By Volcom in forum Tutorials
    Replies: 18
    Last Post: 12-11-2007, 12:54 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
  •