
Originally Posted by
Quacked
Vouch for Kyoto, if Patrick can release would even be better!
Here:
Code:
public class IronmanSelection {
enum Types {
NONE, IRON_MAN, ULTIMATE_IRON_MAN, NPC, PERM;
private Types() {
}
public int getSpriteId() {
return 42402 + (ordinal() * 1);
}
public int getButtonId() {
return 165162 + (ordinal() * 1);
}
public static final Set<Types> TYPE = Collections.unmodifiableSet(EnumSet.allOf(Types.class));
}
public void open(Player player) {
player.write(new SendChangeSprite(42402, (byte) 0));
player.write(new SendChangeSprite(42403, (byte) 0));
player.write(new SendChangeSprite(42404, (byte) 2));
player.write(new SendChangeSprite(42405, (byte) 1));// setting the X
player.write(new SendChangeSprite(42406, (byte) 1));//disable
player.write(new SendInterface(42400));
}
public void selectMode(Player player, int buttonId) {
for (Types type : Types.values()) {
if (type.getButtonId() == buttonId) {
if (player.selectedIronmanButton == buttonId) {
player.write(new SendGameMessage("You've already selected this option."));
} else {
if (buttonId == 165165) {
//if (!npcon)
player.write(new SendChangeSprite(42405, (byte) 2));//Tick the selection
//else if (npcon)
player.write(new SendChangeSprite(42406, (byte) 1));//X the one below
} else if (buttonId == 165166) {
player.write(new SendChangeSprite(42405, (byte) 1));//X the one above
player.write(new SendChangeSprite(42406, (byte) 2));//Tick the selection
} else {
Types.TYPE.forEach(p -> player.write(new SendChangeSprite(p.getSpriteId(), (byte) 0)));//hide
player.write(new SendChangeSprite(type.getSpriteId(), (byte) 2));//tick
player.selectedIronmanButton = buttonId;
if (buttonId == 165162 || buttonId == 165163) {
player.write(new SendChangeSprite(42405, (byte) 1));// PIN
player.write(new SendChangeSprite(42406, (byte) 2));// PERM
}
}
}
}
}
}
public void confirm(Player player) {
switch (player.selectedIronmanButton) {
case 165162:
player.getAccount().setType(Account.REGULAR_TYPE);
player.setRights(Rights.PLAYER);
player.write(new RemoveWindow());
break;
case 165163:
player.write(new SendGameMessage("Ultimate iron man has not been pushed yet."));
break;
case 165164:
break;
}
}
}
Here this is for the interface. You guys could build from this.