Browse Source

invisible cities on map logging

lakebane-master
FatBoy-DOTC 6 months ago
parent
commit
eec5861944
  1. 182
      src/engine/objects/City.java

182
src/engine/objects/City.java

@ -199,117 +199,118 @@ public class City extends AbstractWorldObject { @@ -199,117 +199,118 @@ public class City extends AbstractWorldObject {
}
public static void serializeForClientMsg(City city, ByteBufferWriter writer) {
AbstractCharacter guildRuler;
Guild rulingGuild;
Guild rulingNation;
java.time.LocalDateTime dateTime1900;
// Cities aren't a city without a TOL. Time to early exit.
// No need to spam the log here as non-existant TOL's are indicated
// during bootstrap routines.
try {
AbstractCharacter guildRuler;
Guild rulingGuild;
Guild rulingNation;
java.time.LocalDateTime dateTime1900;
if (city.getTOL() == null) {
// Cities aren't a city without a TOL. Time to early exit.
// No need to spam the log here as non-existant TOL's are indicated
// during bootstrap routines.
Logger.error("NULL TOL FOR " + city.cityName);
}
if (city.getTOL() == null) {
Logger.error("NULL TOL FOR " + city.cityName);
}
// Assign city owner
if (city.getTOL() != null)
guildRuler = city.getTOL().getOwner();
else
guildRuler = null;
// Assign city owner
// If is an errant tree, use errant guild for serialization.
// otherwise we serialize the soverign guild
if (city.getTOL() != null)
guildRuler = city.getTOL().getOwner();
else
guildRuler = null;
if (guildRuler == null)
rulingGuild = Guild.getErrantGuild();
else
rulingGuild = guildRuler.getGuild();
// If is an errant tree, use errant guild for serialization.
// otherwise we serialize the soverign guild
rulingNation = rulingGuild.getNation();
if (guildRuler == null)
rulingGuild = Guild.getErrantGuild();
else
rulingGuild = guildRuler.getGuild();
// Begin Serialzing soverign guild data
writer.putInt(city.getObjectType().ordinal());
writer.putInt(city.getObjectUUID());
writer.putString(city.cityName);
writer.putInt(rulingGuild.getObjectType().ordinal());
writer.putInt(rulingGuild.getObjectUUID());
rulingNation = rulingGuild.getNation();
writer.putString(rulingGuild.getName());
writer.putString(city.motto);
writer.putString(rulingGuild.getLeadershipType());
// Begin Serialzing soverign guild data
writer.putInt(city.getObjectType().ordinal());
writer.putInt(city.getObjectUUID());
writer.putString(city.cityName);
writer.putInt(rulingGuild.getObjectType().ordinal());
writer.putInt(rulingGuild.getObjectUUID());
// Serialize guild ruler's name
// If tree is abandoned blank out the name
// to allow them a rename.
writer.putString(rulingGuild.getName());
writer.putString(city.motto);
writer.putString(rulingGuild.getLeadershipType());
if (guildRuler == null)
writer.putString("");
else
writer.putString(guildRuler.getFirstName() + ' ' + guildRuler.getLastName());
// Serialize guild ruler's name
// If tree is abandoned blank out the name
// to allow them a rename.
writer.putInt(rulingGuild.getCharter());
writer.putInt(0); // always 00000000
if (guildRuler == null)
writer.putString("");
else
writer.putString(guildRuler.getFirstName() + ' ' + guildRuler.getLastName());
writer.put(city.isSafeHold);
writer.putInt(rulingGuild.getCharter());
writer.putInt(0); // always 00000000
writer.put((byte) 1);
writer.put((byte) 1); // *** Refactor: What are these flags?
writer.put((byte) 1);
writer.put((byte) 1);
writer.put((byte) 1);
writer.put(city.isSafeHold);
GuildTag._serializeForDisplay(rulingGuild.getGuildTag(), writer);
GuildTag._serializeForDisplay(rulingNation.getGuildTag(), writer);
writer.put((byte) 1);
writer.put((byte) 1); // *** Refactor: What are these flags?
writer.put((byte) 1);
writer.put((byte) 1);
writer.put((byte) 1);
writer.putInt(0);// TODO Implement description text
GuildTag._serializeForDisplay(rulingGuild.getGuildTag(), writer);
GuildTag._serializeForDisplay(rulingNation.getGuildTag(), writer);
writer.put((byte) 1);
writer.putInt(0);// TODO Implement description text
if (city.isCapital > 0)
writer.put((byte) 1);
else
writer.put((byte) 0);
writer.put((byte) 1);
if (city.isCapital > 0)
writer.put((byte) 1);
else
writer.put((byte) 0);
// Begin serializing nation guild info
writer.put((byte) 1);
if (rulingNation.isEmptyGuild()) {
writer.putInt(rulingGuild.getObjectType().ordinal());
writer.putInt(rulingGuild.getObjectUUID());
} else {
writer.putInt(rulingNation.getObjectType().ordinal());
writer.putInt(rulingNation.getObjectUUID());
}
// Begin serializing nation guild info
if (rulingNation.isEmptyGuild()) {
writer.putInt(rulingGuild.getObjectType().ordinal());
writer.putInt(rulingGuild.getObjectUUID());
} else {
writer.putInt(rulingNation.getObjectType().ordinal());
writer.putInt(rulingNation.getObjectUUID());
}
// Serialize nation name
if (rulingNation.isEmptyGuild())
writer.putString("None");
else
writer.putString(rulingNation.getName());
// Serialize nation name
writer.putInt(city.getTOL().getRank());
if (rulingNation.isEmptyGuild())
writer.putString("None");
else
writer.putString(rulingNation.getName());
if (city.isNoobIsle > 0)
writer.putInt(1);
else
writer.putInt(0xFFFFFFFF);
writer.putInt(city.getTOL().getRank());
writer.putInt(city.population);
if (city.isNoobIsle > 0)
writer.putInt(1);
else
writer.putInt(0xFFFFFFFF);
if (rulingNation.isEmptyGuild())
writer.putString(" ");
else
writer.putString(Guild.GetGL(rulingNation).getFirstName() + ' ' + Guild.GetGL(rulingNation).getLastName());
writer.putInt(city.population);
if (rulingNation.isEmptyGuild())
writer.putString(" ");
else
writer.putString(Guild.GetGL(rulingNation).getFirstName() + ' ' + Guild.GetGL(rulingNation).getLastName());
writer.putLocalDateTime(city.established);
writer.putLocalDateTime(city.established);
// writer.put((byte) city.established.getDayOfMonth());
// writer.put((byte) city.established.minusMonths(1).getMonth().getValue());
@ -318,16 +319,19 @@ public class City extends AbstractWorldObject { @@ -318,16 +319,19 @@ public class City extends AbstractWorldObject {
// writer.put((byte) minutes);
// writer.put((byte) seconds);
writer.putFloat(city.location.x);
writer.putFloat(city.location.y);
writer.putFloat(city.location.z);
writer.putInt(ZergManager.getBaneCap(city.getGuild()));
writer.put((byte) 1);
writer.put((byte) 0);
writer.putInt(0x64);
writer.put((byte) 0);
writer.put((byte) 0);
writer.put((byte) 0);
writer.putFloat(city.location.x);
writer.putFloat(city.location.y);
writer.putFloat(city.location.z);
writer.putInt(ZergManager.getBaneCap(city.getGuild()));
writer.put((byte) 1);
writer.put((byte) 0);
writer.putInt(0x64);
writer.put((byte) 0);
writer.put((byte) 0);
writer.put((byte) 0);
}catch(Exception e){
Logger.error(city.getObjectUUID() + " failed ot serialize because: " + e.getMessage());
}
}
public static Vector3fImmutable getBindLoc(int cityID) {

Loading…
Cancel
Save