Fix bug with timezone being set wrong

This commit is contained in:
Melledy
2023-10-19 06:52:27 -07:00
parent 55fd699a72
commit 4d55d4d816
3 changed files with 94 additions and 94 deletions

View File

@@ -29,11 +29,6 @@ public final class PlayerLoginScRspOuterClass {
*/ */
private long serverTimestampMs; private long serverTimestampMs;
/**
* <code>optional int32 cur_timezone = 4;</code>
*/
private int curTimezone;
/** /**
* <code>optional uint32 stamina = 8;</code> * <code>optional uint32 stamina = 8;</code>
*/ */
@@ -44,6 +39,11 @@ public final class PlayerLoginScRspOuterClass {
*/ */
private int retcode; private int retcode;
/**
* <code>optional sint32 cur_timezone = 4;</code>
*/
private int curTimezone;
/** /**
* <code>optional bool GIALIFNNOPN = 7;</code> * <code>optional bool GIALIFNNOPN = 7;</code>
*/ */
@@ -153,49 +153,12 @@ public final class PlayerLoginScRspOuterClass {
return this; return this;
} }
/**
* <code>optional int32 cur_timezone = 4;</code>
* @return whether the curTimezone field is set
*/
public boolean hasCurTimezone() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>optional int32 cur_timezone = 4;</code>
* @return this
*/
public PlayerLoginScRsp clearCurTimezone() {
bitField0_ &= ~0x00000004;
curTimezone = 0;
return this;
}
/**
* <code>optional int32 cur_timezone = 4;</code>
* @return the curTimezone
*/
public int getCurTimezone() {
return curTimezone;
}
/**
* <code>optional int32 cur_timezone = 4;</code>
* @param value the curTimezone to set
* @return this
*/
public PlayerLoginScRsp setCurTimezone(final int value) {
bitField0_ |= 0x00000004;
curTimezone = value;
return this;
}
/** /**
* <code>optional uint32 stamina = 8;</code> * <code>optional uint32 stamina = 8;</code>
* @return whether the stamina field is set * @return whether the stamina field is set
*/ */
public boolean hasStamina() { public boolean hasStamina() {
return (bitField0_ & 0x00000008) != 0; return (bitField0_ & 0x00000004) != 0;
} }
/** /**
@@ -203,7 +166,7 @@ public final class PlayerLoginScRspOuterClass {
* @return this * @return this
*/ */
public PlayerLoginScRsp clearStamina() { public PlayerLoginScRsp clearStamina() {
bitField0_ &= ~0x00000008; bitField0_ &= ~0x00000004;
stamina = 0; stamina = 0;
return this; return this;
} }
@@ -222,7 +185,7 @@ public final class PlayerLoginScRspOuterClass {
* @return this * @return this
*/ */
public PlayerLoginScRsp setStamina(final int value) { public PlayerLoginScRsp setStamina(final int value) {
bitField0_ |= 0x00000008; bitField0_ |= 0x00000004;
stamina = value; stamina = value;
return this; return this;
} }
@@ -232,7 +195,7 @@ public final class PlayerLoginScRspOuterClass {
* @return whether the retcode field is set * @return whether the retcode field is set
*/ */
public boolean hasRetcode() { public boolean hasRetcode() {
return (bitField0_ & 0x00000010) != 0; return (bitField0_ & 0x00000008) != 0;
} }
/** /**
@@ -240,7 +203,7 @@ public final class PlayerLoginScRspOuterClass {
* @return this * @return this
*/ */
public PlayerLoginScRsp clearRetcode() { public PlayerLoginScRsp clearRetcode() {
bitField0_ &= ~0x00000010; bitField0_ &= ~0x00000008;
retcode = 0; retcode = 0;
return this; return this;
} }
@@ -259,11 +222,48 @@ public final class PlayerLoginScRspOuterClass {
* @return this * @return this
*/ */
public PlayerLoginScRsp setRetcode(final int value) { public PlayerLoginScRsp setRetcode(final int value) {
bitField0_ |= 0x00000010; bitField0_ |= 0x00000008;
retcode = value; retcode = value;
return this; return this;
} }
/**
* <code>optional sint32 cur_timezone = 4;</code>
* @return whether the curTimezone field is set
*/
public boolean hasCurTimezone() {
return (bitField0_ & 0x00000010) != 0;
}
/**
* <code>optional sint32 cur_timezone = 4;</code>
* @return this
*/
public PlayerLoginScRsp clearCurTimezone() {
bitField0_ &= ~0x00000010;
curTimezone = 0;
return this;
}
/**
* <code>optional sint32 cur_timezone = 4;</code>
* @return the curTimezone
*/
public int getCurTimezone() {
return curTimezone;
}
/**
* <code>optional sint32 cur_timezone = 4;</code>
* @param value the curTimezone to set
* @return this
*/
public PlayerLoginScRsp setCurTimezone(final int value) {
bitField0_ |= 0x00000010;
curTimezone = value;
return this;
}
/** /**
* <code>optional bool GIALIFNNOPN = 7;</code> * <code>optional bool GIALIFNNOPN = 7;</code>
* @return whether the gIALIFNNOPN field is set * @return whether the gIALIFNNOPN field is set
@@ -532,9 +532,9 @@ public final class PlayerLoginScRspOuterClass {
bitField0_ = other.bitField0_; bitField0_ = other.bitField0_;
loginRandom = other.loginRandom; loginRandom = other.loginRandom;
serverTimestampMs = other.serverTimestampMs; serverTimestampMs = other.serverTimestampMs;
curTimezone = other.curTimezone;
stamina = other.stamina; stamina = other.stamina;
retcode = other.retcode; retcode = other.retcode;
curTimezone = other.curTimezone;
gIALIFNNOPN = other.gIALIFNNOPN; gIALIFNNOPN = other.gIALIFNNOPN;
hNAGOHGGJDH = other.hNAGOHGGJDH; hNAGOHGGJDH = other.hNAGOHGGJDH;
basicInfo.copyFrom(other.basicInfo); basicInfo.copyFrom(other.basicInfo);
@@ -556,15 +556,15 @@ public final class PlayerLoginScRspOuterClass {
if (other.hasServerTimestampMs()) { if (other.hasServerTimestampMs()) {
setServerTimestampMs(other.serverTimestampMs); setServerTimestampMs(other.serverTimestampMs);
} }
if (other.hasCurTimezone()) {
setCurTimezone(other.curTimezone);
}
if (other.hasStamina()) { if (other.hasStamina()) {
setStamina(other.stamina); setStamina(other.stamina);
} }
if (other.hasRetcode()) { if (other.hasRetcode()) {
setRetcode(other.retcode); setRetcode(other.retcode);
} }
if (other.hasCurTimezone()) {
setCurTimezone(other.curTimezone);
}
if (other.hasGIALIFNNOPN()) { if (other.hasGIALIFNNOPN()) {
setGIALIFNNOPN(other.gIALIFNNOPN); setGIALIFNNOPN(other.gIALIFNNOPN);
} }
@@ -592,9 +592,9 @@ public final class PlayerLoginScRspOuterClass {
bitField0_ = 0; bitField0_ = 0;
loginRandom = 0L; loginRandom = 0L;
serverTimestampMs = 0L; serverTimestampMs = 0L;
curTimezone = 0;
stamina = 0; stamina = 0;
retcode = 0; retcode = 0;
curTimezone = 0;
gIALIFNNOPN = false; gIALIFNNOPN = false;
hNAGOHGGJDH = false; hNAGOHGGJDH = false;
basicInfo.clear(); basicInfo.clear();
@@ -628,9 +628,9 @@ public final class PlayerLoginScRspOuterClass {
return bitField0_ == other.bitField0_ return bitField0_ == other.bitField0_
&& (!hasLoginRandom() || loginRandom == other.loginRandom) && (!hasLoginRandom() || loginRandom == other.loginRandom)
&& (!hasServerTimestampMs() || serverTimestampMs == other.serverTimestampMs) && (!hasServerTimestampMs() || serverTimestampMs == other.serverTimestampMs)
&& (!hasCurTimezone() || curTimezone == other.curTimezone)
&& (!hasStamina() || stamina == other.stamina) && (!hasStamina() || stamina == other.stamina)
&& (!hasRetcode() || retcode == other.retcode) && (!hasRetcode() || retcode == other.retcode)
&& (!hasCurTimezone() || curTimezone == other.curTimezone)
&& (!hasGIALIFNNOPN() || gIALIFNNOPN == other.gIALIFNNOPN) && (!hasGIALIFNNOPN() || gIALIFNNOPN == other.gIALIFNNOPN)
&& (!hasHNAGOHGGJDH() || hNAGOHGGJDH == other.hNAGOHGGJDH) && (!hasHNAGOHGGJDH() || hNAGOHGGJDH == other.hNAGOHGGJDH)
&& (!hasBasicInfo() || basicInfo.equals(other.basicInfo)) && (!hasBasicInfo() || basicInfo.equals(other.basicInfo))
@@ -649,17 +649,17 @@ public final class PlayerLoginScRspOuterClass {
output.writeUInt64NoTag(serverTimestampMs); output.writeUInt64NoTag(serverTimestampMs);
} }
if ((bitField0_ & 0x00000004) != 0) { if ((bitField0_ & 0x00000004) != 0) {
output.writeRawByte((byte) 32);
output.writeInt32NoTag(curTimezone);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeRawByte((byte) 64); output.writeRawByte((byte) 64);
output.writeUInt32NoTag(stamina); output.writeUInt32NoTag(stamina);
} }
if ((bitField0_ & 0x00000010) != 0) { if ((bitField0_ & 0x00000008) != 0) {
output.writeRawByte((byte) 120); output.writeRawByte((byte) 120);
output.writeUInt32NoTag(retcode); output.writeUInt32NoTag(retcode);
} }
if ((bitField0_ & 0x00000010) != 0) {
output.writeRawByte((byte) 32);
output.writeSInt32NoTag(curTimezone);
}
if ((bitField0_ & 0x00000020) != 0) { if ((bitField0_ & 0x00000020) != 0) {
output.writeRawByte((byte) 56); output.writeRawByte((byte) 56);
output.writeBoolNoTag(gIALIFNNOPN); output.writeBoolNoTag(gIALIFNNOPN);
@@ -692,14 +692,14 @@ public final class PlayerLoginScRspOuterClass {
size += 1 + ProtoSink.computeUInt64SizeNoTag(serverTimestampMs); size += 1 + ProtoSink.computeUInt64SizeNoTag(serverTimestampMs);
} }
if ((bitField0_ & 0x00000004) != 0) { if ((bitField0_ & 0x00000004) != 0) {
size += 1 + ProtoSink.computeInt32SizeNoTag(curTimezone);
}
if ((bitField0_ & 0x00000008) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(stamina); size += 1 + ProtoSink.computeUInt32SizeNoTag(stamina);
} }
if ((bitField0_ & 0x00000010) != 0) { if ((bitField0_ & 0x00000008) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode); size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
} }
if ((bitField0_ & 0x00000010) != 0) {
size += 1 + ProtoSink.computeSInt32SizeNoTag(curTimezone);
}
if ((bitField0_ & 0x00000020) != 0) { if ((bitField0_ & 0x00000020) != 0) {
size += 2; size += 2;
} }
@@ -739,15 +739,6 @@ public final class PlayerLoginScRspOuterClass {
serverTimestampMs = input.readUInt64(); serverTimestampMs = input.readUInt64();
bitField0_ |= 0x00000002; bitField0_ |= 0x00000002;
tag = input.readTag(); tag = input.readTag();
if (tag != 32) {
break;
}
}
case 32: {
// curTimezone
curTimezone = input.readInt32();
bitField0_ |= 0x00000004;
tag = input.readTag();
if (tag != 64) { if (tag != 64) {
break; break;
} }
@@ -755,7 +746,7 @@ public final class PlayerLoginScRspOuterClass {
case 64: { case 64: {
// stamina // stamina
stamina = input.readUInt32(); stamina = input.readUInt32();
bitField0_ |= 0x00000008; bitField0_ |= 0x00000004;
tag = input.readTag(); tag = input.readTag();
if (tag != 120) { if (tag != 120) {
break; break;
@@ -764,6 +755,15 @@ public final class PlayerLoginScRspOuterClass {
case 120: { case 120: {
// retcode // retcode
retcode = input.readUInt32(); retcode = input.readUInt32();
bitField0_ |= 0x00000008;
tag = input.readTag();
if (tag != 32) {
break;
}
}
case 32: {
// curTimezone
curTimezone = input.readSInt32();
bitField0_ |= 0x00000010; bitField0_ |= 0x00000010;
tag = input.readTag(); tag = input.readTag();
if (tag != 56) { if (tag != 56) {
@@ -839,14 +839,14 @@ public final class PlayerLoginScRspOuterClass {
output.writeUInt64(FieldNames.serverTimestampMs, serverTimestampMs); output.writeUInt64(FieldNames.serverTimestampMs, serverTimestampMs);
} }
if ((bitField0_ & 0x00000004) != 0) { if ((bitField0_ & 0x00000004) != 0) {
output.writeInt32(FieldNames.curTimezone, curTimezone);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeUInt32(FieldNames.stamina, stamina); output.writeUInt32(FieldNames.stamina, stamina);
} }
if ((bitField0_ & 0x00000010) != 0) { if ((bitField0_ & 0x00000008) != 0) {
output.writeUInt32(FieldNames.retcode, retcode); output.writeUInt32(FieldNames.retcode, retcode);
} }
if ((bitField0_ & 0x00000010) != 0) {
output.writeSInt32(FieldNames.curTimezone, curTimezone);
}
if ((bitField0_ & 0x00000020) != 0) { if ((bitField0_ & 0x00000020) != 0) {
output.writeBool(FieldNames.gIALIFNNOPN, gIALIFNNOPN); output.writeBool(FieldNames.gIALIFNNOPN, gIALIFNNOPN);
} }
@@ -896,23 +896,11 @@ public final class PlayerLoginScRspOuterClass {
} }
break; break;
} }
case -929763751:
case 1485930264: {
if (input.isAtField(FieldNames.curTimezone)) {
if (!input.trySkipNullValue()) {
curTimezone = input.readInt32();
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
case -1897344401: { case -1897344401: {
if (input.isAtField(FieldNames.stamina)) { if (input.isAtField(FieldNames.stamina)) {
if (!input.trySkipNullValue()) { if (!input.trySkipNullValue()) {
stamina = input.readUInt32(); stamina = input.readUInt32();
bitField0_ |= 0x00000008; bitField0_ |= 0x00000004;
} }
} else { } else {
input.skipUnknownField(); input.skipUnknownField();
@@ -923,6 +911,18 @@ public final class PlayerLoginScRspOuterClass {
if (input.isAtField(FieldNames.retcode)) { if (input.isAtField(FieldNames.retcode)) {
if (!input.trySkipNullValue()) { if (!input.trySkipNullValue()) {
retcode = input.readUInt32(); retcode = input.readUInt32();
bitField0_ |= 0x00000008;
}
} else {
input.skipUnknownField();
}
break;
}
case -929763751:
case 1485930264: {
if (input.isAtField(FieldNames.curTimezone)) {
if (!input.trySkipNullValue()) {
curTimezone = input.readSInt32();
bitField0_ |= 0x00000010; bitField0_ |= 0x00000010;
} }
} else { } else {
@@ -1043,12 +1043,12 @@ public final class PlayerLoginScRspOuterClass {
static final FieldName serverTimestampMs = FieldName.forField("serverTimestampMs", "server_timestamp_ms"); static final FieldName serverTimestampMs = FieldName.forField("serverTimestampMs", "server_timestamp_ms");
static final FieldName curTimezone = FieldName.forField("curTimezone", "cur_timezone");
static final FieldName stamina = FieldName.forField("stamina"); static final FieldName stamina = FieldName.forField("stamina");
static final FieldName retcode = FieldName.forField("retcode"); static final FieldName retcode = FieldName.forField("retcode");
static final FieldName curTimezone = FieldName.forField("curTimezone", "cur_timezone");
static final FieldName gIALIFNNOPN = FieldName.forField("GIALIFNNOPN"); static final FieldName gIALIFNNOPN = FieldName.forField("GIALIFNNOPN");
static final FieldName hNAGOHGGJDH = FieldName.forField("HNAGOHGGJDH"); static final FieldName hNAGOHGGJDH = FieldName.forField("HNAGOHGGJDH");

View File

@@ -9,7 +9,7 @@ public class GameConstants {
public static String VERSION = "1.4.0"; public static String VERSION = "1.4.0";
public static String MDK_VERSION = ""; public static String MDK_VERSION = "";
public static final ZoneOffset CURRENT_OFFSET = ZoneOffset.systemDefault().getRules().getOffset(Instant.now()); public static final int CURRENT_TIMEZONE = ZoneOffset.systemDefault().getRules().getOffset(Instant.now()).getTotalSeconds() / 3600;
// Game // Game
public static final String DEFAULT_NAME = "Trailblazer"; public static final String DEFAULT_NAME = "Trailblazer";

View File

@@ -13,7 +13,7 @@ public class PacketPlayerLoginScRsp extends BasePacket {
var data = PlayerLoginScRsp.newInstance() var data = PlayerLoginScRsp.newInstance()
.setBasicInfo(session.getPlayer().toProto()) .setBasicInfo(session.getPlayer().toProto())
.setCurTimezone(GameConstants.CURRENT_OFFSET.getTotalSeconds() / 60) .setCurTimezone(GameConstants.CURRENT_TIMEZONE)
.setServerTimestampMs(System.currentTimeMillis()) .setServerTimestampMs(System.currentTimeMillis())
.setStamina(session.getPlayer().getStamina()); .setStamina(session.getPlayer().getStamina());