Okay, so I'll first show my code, then I'll explain what I need help with.
Random isServerChance = new Random();
Random isGood = new Random();
Random isBad = new Random();
// Some IDs which are considered "Good"
int isGoodTable[] =
{ 1038, 1040, 1042, 1044 };
// Some IDs which are considered "Bad"
int isBadTable[] =
{ 6570, 6585, 952, 969 };
// Based on this roll, will pick which cat is used. Good, or Bad.
int isServerRoll = isServerChance.nextInt(6);
// If it's > 3 it's going to be a "Good" item, if it's not, it's a bad
// item.
if (isServerRoll > 3)
{
int isGoodValue = isGood.nextInt(isGoodTable.length);
System.out.println("You've received a rare item! You got a: " + isGoodTable[isGoodValue]);
} else
{
int isBadValue = isBad.nextInt(isBadTable.length);
System.out.println("You've received a normal item. You've got a: " + isBadTable[isBadValue]);
}
}
Okay, so this will print: You've received a normal item. You've got a: 969 || You've received a rare item! You got a: 1042.
Let's say the int value of 969 is a Spade. Is it possible for me to make 969 equal to an array of Strings from one of the int tables above?
So, if I land on 969, it'll say: "You've received a normal item. You've got a: Spade!"
I'm sort of new, so I'm not sure if this is even possible, but I don't want to make loads of if statements for each ID.
Thanks
Random- no reason to have 3 of them...