package net.sourceforge.pain.logic.fn; import net.sourceforge.pain.network.console.*; import net.sourceforge.pain.data.type.*; public final class PromptFn { public static void printPrompt(Console console) { Player p = console.getPlayer(); LifeForm life = (LifeForm) p.getRole(LifeForm.class); Mobile mobile = (Mobile) p.getRole(Mobile.class); MessageOutFn.out(console, "\n"); LinkedSpace exits = (LinkedSpace) p.getLocation().getRole(LinkedSpace.class); if (life != null) { MessageOutFn.out(console, "" + life.getLifePoints() + "/" + life.getMaxLifePoints() + "hp "); } if (mobile != null) { MessageOutFn.out(console, mobile.getMoves() + "/" + mobile.getMaxMoves() + "mv "); } if (life != null || mobile != null) { MessageOutFn.out(console, ": {c"); } else { MessageOutFn.out(console, "{c"); } boolean exitsFound = false; if (exits != null) { if (exits.getExit(LinkedSpace.DIR_NORTH) != null) { MessageOutFn.out(console, "N"); exitsFound = true; } if (exits.getExit(LinkedSpace.DIR_EAST) != null) { MessageOutFn.out(console, "E"); exitsFound = true; } if (exits.getExit(LinkedSpace.DIR_SOUTH) != null) { MessageOutFn.out(console, "S"); exitsFound = true; } if (exits.getExit(LinkedSpace.DIR_WEST) != null) { MessageOutFn.out(console, "W"); exitsFound = true; } if (exits.getExit(LinkedSpace.DIR_UP) != null) { MessageOutFn.out(console, "U"); exitsFound = true; } if (exits.getExit(LinkedSpace.DIR_DOWN) != null) { MessageOutFn.out(console, "D"); exitsFound = true; } } if (!exitsFound) { MessageOutFn.out(console, "*"); } MessageOutFn.out(console, " {x# "); } }