Thread: [667/***] Correct Toy Horsey

Results 1 to 9 of 9
  1. #1 [667/***] Correct Toy Horsey 
    Registered Member
    Join Date
    Apr 2014
    Posts
    75
    Thanks given
    32
    Thanks received
    4
    Rep Power
    12
    I've seen a couple toy horsey snippets. For example: if they use the grey horsey, it will show the brown horsey animation.

    This snippet has the correct animation/messages for them.

    ToyHorsey.java
    Code:
    package com.rs.game.player.content;
    
    import java.util.Random;
    
    import com.rs.game.Animation;
    import com.rs.game.ForceTalk;
    import com.rs.game.player.Player;
    
    /**
     * @author Ronan & TaterMater (Small fix)
     * @information Handles the Toy Horsey.
     */
    
    public class ToyHorsey {
    
    	/**
    	 * The Toy Horsey ID's
    	 */
    	private static final int Brown = 2520;
    	private static final int White = 2522;
    	private static final int Black = 2524;
    	private static final int Grey = 2526;
    
    	/*
    	 * Handles the Animations.
    	 */
    	public static Animation getAnimation(int horseId) {
    		switch(horseId) {
    		case (Brown):
    			return new Animation(918);
    		case (White):
    			return new Animation(919);
    		case (Black):
    			return new Animation(920);
    		case (Grey):
    			return new Animation(921);
    		}
    		return null;
    	}
    	
    	/**
    	 * Handles the Messages.
    	 */
    	private static String Message [][] = 
    		{{"Come on Dobbin, we can win the race!"}, 
    		{"Just say neigh to gambling!"},
    		{"Hi-ho Silver, and away!"},
    		{"Neaahhhyyy! Giddy-up horsey!"}};
    
    	/**
    	 * Handles the playing.
    	 * @param itemId 
    	 */
    	public static void play(Player player, int itemId) {
    		int rand = RandomMessage();
    		player.setNextForceTalk(new ForceTalk(Message[rand][0]));
    		player.setNextAnimation(getAnimation(itemId));
    	}
    
    	/**
    	 * Handles the randomizing of the Messages.
    	 */
    	public static int RandomMessage() {
    		int random = 0;
    		Random rand = new Random();
    		random = rand.nextInt(Message.length);
    		return random;
    	}
    	
    }
    InventoryOptionsHandler.java
    Code:
    ToyHorsey.play(player, itemId);
    Reply With Quote  
     

  2. #2  
    Extreme Donator

    TaterMater's Avatar
    Join Date
    Aug 2011
    Posts
    1,511
    Thanks given
    218
    Thanks received
    375
    Rep Power
    121

    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Apr 2014
    Posts
    75
    Thanks given
    32
    Thanks received
    4
    Rep Power
    12
    Yeah? I gave you credits for the fix?
    Reply With Quote  
     

  4. #4  
    Extreme Donator

    TaterMater's Avatar
    Join Date
    Aug 2011
    Posts
    1,511
    Thanks given
    218
    Thanks received
    375
    Rep Power
    121
    Quote Originally Posted by Ronan View Post
    Yeah? I gave you credits for the fix?
    My bad I didn't realize the thread was in snippets, I thought you accidentally posted another thread in the help section

    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Oct 2015
    Posts
    24
    Thanks given
    5
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by RIST0 View Post
    Code:
    package com.rs.game.player.content;
    
    import com.rs.game.Animation;
    import com.rs.game.ForceTalk;
    import com.rs.game.item.Item;
    import com.rs.game.player.Player;
    import com.rs.utils.Utils;
    import java.util.Random;
    
    /**
     * 
     * @author FUZENSETH
     * @information Handles all the toy horseys with correct anims.
     */
    public class ToyHorsey {
            
    	private static final String CHAT[]= {"Come on Dobbin, we can win the race!",
            "Just say neigh to gambling!", 
            "Hi-ho Silver, and away!",
            "Neaahhhyyy! Giddy-up horsey!"};
    	
            
            public enum Horseys {
                BROWN(2520, 918),  WHITE(2522, 919),
                BLACK(2524, 920),  GREY(2526, 921);
                
                private final int item;
                private final int animation;
                
                private Horseys(int item, int animation) {
                    this.item = item;
                    this.animation = animation;
                }
                
                public int getItemId() {
                    return item;
                }
                
                public int getAnimationId() {
                    return animation;
                }
            }
            
            public static boolean contains(Player player, Item item) {
                for (final Horseys horsey : Horseys.values()) {
                    if (item.getId() == horsey.getItemId()) {
                        player.addStopDelay(3);
                        player.setNextAnimation(new Animation(horsey.getAnimationId()));
                        player.setNextForceTalk(new ForceTalk(CHAT[Utils.random(CHAT.length)]));
                    }
                }
                return false;
            }
    }
    Could you Re-Upload Enso For me Please?
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Apr 2014
    Posts
    75
    Thanks given
    32
    Thanks received
    4
    Rep Power
    12
    Quote Originally Posted by TaterMater View Post
    My bad I didn't realize the thread was in snippets, I thought you accidentally posted another thread in the help section
    Naa, haha

    Quote Originally Posted by RIST0 View Post
    Code:
    package com.rs.game.player.content;
    
    import com.rs.game.Animation;
    import com.rs.game.ForceTalk;
    import com.rs.game.item.Item;
    import com.rs.game.player.Player;
    import com.rs.utils.Utils;
    import java.util.Random;
    
    /**
     * 
     * @author FUZENSETH
     * @information Handles all the toy horseys with correct anims.
     */
    public class ToyHorsey {
            
    	private static final String CHAT[]= {"Come on Dobbin, we can win the race!",
            "Just say neigh to gambling!", 
            "Hi-ho Silver, and away!",
            "Neaahhhyyy! Giddy-up horsey!"};
    	
            
            public enum Horseys {
                BROWN(2520, 918),  WHITE(2522, 919),
                BLACK(2524, 920),  GREY(2526, 921);
                
                private final int item;
                private final int animation;
                
                private Horseys(int item, int animation) {
                    this.item = item;
                    this.animation = animation;
                }
                
                public int getItemId() {
                    return item;
                }
                
                public int getAnimationId() {
                    return animation;
                }
            }
            
            public static boolean contains(Player player, Item item) {
                for (final Horseys horsey : Horseys.values()) {
                    if (item.getId() == horsey.getItemId()) {
                        player.addStopDelay(3);
                        player.setNextAnimation(new Animation(horsey.getAnimationId()));
                        player.setNextForceTalk(new ForceTalk(CHAT[Utils.random(CHAT.length)]));
                    }
                }
                return false;
            }
    }
    Yeah... I guess it's a lot cleaner. Thanks Miko.
    Reply With Quote  
     

  7. #7  
    Registered Member

    Join Date
    Dec 2012
    Posts
    2,999
    Thanks given
    894
    Thanks received
    921
    Rep Power
    2555
    What's the point of the multiple dimensional array
    Attached image
    Reply With Quote  
     

  8. Thankful user:


  9. #8  
    Registered Member
    Join Date
    Apr 2014
    Posts
    75
    Thanks given
    32
    Thanks received
    4
    Rep Power
    12
    Quote Originally Posted by Kaleem View Post
    What's the point of the multiple dimensional array
    Dunno lel
    Reply With Quote  
     

  10. #9  
    Developer


    Join Date
    Aug 2012
    Posts
    2,493
    Thanks given
    180
    Thanks received
    1,732
    Rep Power
    2487
    Quote Originally Posted by RIST0 View Post
    Code:
    public enum Horseys {
                BROWN(2520, 918),  WHITE(2522, 919),
                BLACK(2524, 920),  GREY(2526, 921);
                
                private final int item;
                private final int animation;
                
                private Horseys(int item, int animation) {
                    this.item = item;
                    this.animation = animation;
                }
                
                public int getItemId() {
                    return item;
                }
                
                public int getAnimationId() {
                    return animation;
                }
            }
    why do you use an enumeration for that
    Reply With Quote  
     

  11. Thankful user:



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/***] Toy Horsey
    By Ronan in forum Help
    Replies: 6
    Last Post: 11-18-2015, 11:09 PM
  2. [667/***]Correct Ring of Wealth
    By TaterMater in forum Snippets
    Replies: 11
    Last Post: 04-05-2014, 02:30 AM
  3. 718 - Toy Horseys (Gambling)
    By Fuzen Seth in forum Snippets
    Replies: 22
    Last Post: 01-22-2013, 07:40 AM
  4. Toy Horsey 718 problem
    By Skyfall in forum Help
    Replies: 6
    Last Post: 01-20-2013, 04:38 PM
  5. Lol Toy Horsey;3
    By Taylor Moon in forum Snippets
    Replies: 14
    Last Post: 08-17-2012, 09:08 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
  •