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);