mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-22 10:15:51 +01:00
3h - Add more Characters to the Map-Chars.
This commit is contained in:
parent
259cf71e27
commit
1b03e64387
@ -1,5 +1,7 @@
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class Const
|
||||
{
|
||||
// Collections & Aspects
|
||||
@ -20,7 +22,11 @@ public class Const
|
||||
public static final int MAP_HEIGHT = 8;
|
||||
public static final int MAP_HEIGHT_FULL = 17;
|
||||
|
||||
public static final char[] MAP_KEY_CHARS = "\\/#?$%=&^ABCDEFGHJKLMNOPQRSTUVWXYZ1234567890abcdeghjmnopqrsuvwxyz".toCharArray();
|
||||
public static final char[] MAP_KEY_CHARS = "\\/#?笣$%=&^ABCDEFGHJKLMNOPQRSTUVWXYZÄÖÜÆØÅ1234567890abcdeghjmnopqrsuvwxyÿzäöüæøåâêîûô".toCharArray();
|
||||
public static final String MAP_KEY_WILDERNESS = ChatColor.GRAY.toString() + "-";
|
||||
public static final String MAP_KEY_SEPARATOR = ChatColor.AQUA.toString() + "+";
|
||||
public static final String MAP_KEY_OVERFLOW = ChatColor.MAGIC.toString() + "-" + ChatColor.RESET.toString();
|
||||
public static final String MAP_OVERFLOW_MESSAGE = MAP_KEY_OVERFLOW + ": Too Many Factions (>" + MAP_KEY_CHARS.length + ") on this Map.";
|
||||
|
||||
// SHOW
|
||||
|
||||
|
@ -355,7 +355,7 @@ public class Board extends Entity<Board> implements BoardInterface
|
||||
ArrayList<String> ret = new ArrayList<String>();
|
||||
Faction centerFaction = this.getFactionAt(centerPs);
|
||||
|
||||
ret.add(Txt.titleize("("+centerPs.getChunkX() + "," + centerPs.getChunkZ()+") "+centerFaction.getName(observer)));
|
||||
ret.add(Txt.titleize("(" + centerPs.getChunkX() + "," + centerPs.getChunkZ() + ") " + centerFaction.getName(observer)));
|
||||
|
||||
int halfWidth = width / 2;
|
||||
int halfHeight = height / 2;
|
||||
@ -369,50 +369,58 @@ public class Board extends Entity<Board> implements BoardInterface
|
||||
|
||||
Map<Faction, Character> fList = new HashMap<Faction, Character>();
|
||||
int chrIdx = 0;
|
||||
boolean overflown = false;
|
||||
|
||||
// For each row
|
||||
for (int dz = 0; dz < height; dz++)
|
||||
{
|
||||
// Draw and add that row
|
||||
String row = "";
|
||||
StringBuilder row = new StringBuilder();
|
||||
for (int dx = 0; dx < width; dx++)
|
||||
{
|
||||
if(dx == halfWidth && dz == halfHeight)
|
||||
if (dx == halfWidth && dz == halfHeight)
|
||||
{
|
||||
row += ChatColor.AQUA+"+";
|
||||
row.append(Const.MAP_KEY_SEPARATOR);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ( ! overflown && chrIdx >= Const.MAP_KEY_CHARS.length) overflown = true;
|
||||
|
||||
PS herePs = topLeftPs.plusChunkCoords(dx, dz);
|
||||
Faction hereFaction = this.getFactionAt(herePs);
|
||||
boolean contains = fList.containsKey(hereFaction);
|
||||
if (hereFaction.isNone())
|
||||
{
|
||||
row += ChatColor.GRAY+"-";
|
||||
row.append(Const.MAP_KEY_WILDERNESS);
|
||||
}
|
||||
else if ( ! contains && overflown)
|
||||
{
|
||||
row.append(Const.MAP_KEY_OVERFLOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!fList.containsKey(hereFaction))
|
||||
fList.put(hereFaction, Const.MAP_KEY_CHARS[chrIdx++]);
|
||||
if ( ! contains) fList.put(hereFaction, Const.MAP_KEY_CHARS[chrIdx++]);
|
||||
char fchar = fList.get(hereFaction);
|
||||
row += hereFaction.getColorTo(observer) + "" + fchar;
|
||||
row.append(hereFaction.getColorTo(observer).toString()).append(fchar);
|
||||
}
|
||||
}
|
||||
ret.add(row);
|
||||
ret.add(row.toString());
|
||||
}
|
||||
|
||||
// Get the compass
|
||||
ArrayList<String> asciiCompass = AsciiCompass.getAsciiCompass(inDegrees, ChatColor.RED, Txt.parse("<a>"));
|
||||
|
||||
// Add the compass
|
||||
ret.set(1, asciiCompass.get(0)+ret.get(1).substring(3*3));
|
||||
ret.set(2, asciiCompass.get(1)+ret.get(2).substring(3*3));
|
||||
ret.set(3, asciiCompass.get(2)+ret.get(3).substring(3*3));
|
||||
ret.set(1, asciiCompass.get(0) + ret.get(1).substring(3*3));
|
||||
ret.set(2, asciiCompass.get(1) + ret.get(2).substring(3*3));
|
||||
ret.set(3, asciiCompass.get(2) + ret.get(3).substring(3*3));
|
||||
|
||||
String fRow = "";
|
||||
for (Faction keyfaction : fList.keySet())
|
||||
{
|
||||
fRow += ""+keyfaction.getColorTo(observer) + fList.get(keyfaction) + ": " + keyfaction.getName() + " ";
|
||||
fRow += keyfaction.getColorTo(observer).toString() + fList.get(keyfaction) + ": " + keyfaction.getName() + " ";
|
||||
}
|
||||
if (overflown) fRow += Const.MAP_OVERFLOW_MESSAGE;
|
||||
fRow = fRow.trim();
|
||||
ret.add(fRow);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user