mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-20 09:17:29 +07:00
Added D2S#getTownsString() and implemented it into D2S Reader logging
This commit is contained in:
parent
c85f1b9e44
commit
2eb773633a
@ -127,6 +127,22 @@ public class D2S {
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getTownsString() {
|
||||
final int DIFF_ACT_MASK = 0x7;
|
||||
final int DIFF_FLAG_ACTIVE = 1 << 7;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("[");
|
||||
for (byte town : towns) {
|
||||
sb.append('A').append((town & DIFF_ACT_MASK) + 1);
|
||||
if ((town & DIFF_FLAG_ACTIVE) == DIFF_FLAG_ACTIVE) sb.append('*');
|
||||
sb.append(", ");
|
||||
}
|
||||
|
||||
sb.setLength(sb.length() - 2);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static class MercData {
|
||||
int flags;
|
||||
int seed;
|
||||
|
@ -105,7 +105,7 @@ public class D2SReader96 {
|
||||
d2s.colors = in.readBytes(COF.Component.NUM_COMPONENTS);
|
||||
if (log.isDebugEnabled()) log.debug("colors: {}", ByteBufUtil.hexDump(d2s.colors));
|
||||
d2s.towns = in.readBytes(Riiablo.MAX_DIFFS);
|
||||
if (log.isDebugEnabled()) log.debug("towns: {}", ByteBufUtil.hexDump(d2s.towns));
|
||||
if (log.isDebugEnabled()) log.debug("towns: {} ({})", ByteBufUtil.hexDump(d2s.towns), d2s.getTownsString());
|
||||
d2s.mapSeed = in.read32();
|
||||
Log.debugf(log, "mapSeed: 0x%08X", d2s.mapSeed);
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user