feat(5.0): Remove field setters which aren't available

these have comments indicating why they were removed/unset
This commit is contained in:
KingRainbow44 2024-09-28 17:30:01 -04:00
parent 45a3cf0b8b
commit 255d0a041c
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
5 changed files with 32 additions and 27 deletions

View File

@ -11,10 +11,14 @@ public class HandlerAvatarUpgradeReq extends PacketHandler {
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
AvatarUpgradeReq req = AvatarUpgradeReq.parseFrom(payload); AvatarUpgradeReq req = AvatarUpgradeReq.parseFrom(payload);
// Level up avatar // Changed in 5.0:
session // Players can now pass multiple different kinds of books in at once.
// These are bundled into a list of items.
for (var item : req.getItemParamListList()) {
session
.getServer() .getServer()
.getInventorySystem() .getInventorySystem()
.upgradeAvatar(session.getPlayer(), req.getAvatarGuid(), req.getItemId(), req.getCount()); .upgradeAvatar(session.getPlayer(), req.getAvatarGuid(), item.getItemId(), item.getCount());
}
} }
} }

View File

@ -17,8 +17,9 @@ public class PacketAvatarUpgradeRsp extends BasePacket {
.setAvatarGuid(avatar.getGuid()) .setAvatarGuid(avatar.getGuid())
.setOldLevel(oldLevel) .setOldLevel(oldLevel)
.setCurLevel(avatar.getLevel()) .setCurLevel(avatar.getLevel())
.putAllOldFightPropMap(oldFightPropMap) // Removed in 5.0
.putAllCurFightPropMap(avatar.getFightProperties()) // .putAllOldFightPropMap(oldFightPropMap)
// .putAllCurFightPropMap(avatar.getFightProperties())
.build(); .build();
this.setData(proto); this.setData(proto);

View File

@ -23,10 +23,10 @@ public class PacketGetPlayerTokenRsp extends BasePacket {
.setSecretKeySeed(session.getEncryptSeed()) .setSecretKeySeed(session.getEncryptSeed())
.setSecurityCmdBuffer(ByteString.copyFrom(Crypto.ENCRYPT_SEED_BUFFER)) .setSecurityCmdBuffer(ByteString.copyFrom(Crypto.ENCRYPT_SEED_BUFFER))
.setPlatformType(3) .setPlatformType(3)
.setChannelId(1) // .setChannelId(1) // Removed in 5.0; we don't know what it is
.setCountryCode("US") .setCountryCode("US")
.setClientVersionRandomKey("c25-314dd05b0b5f") .setClientVersionRandomKey("c25-314dd05b0b5f")
.setRegPlatform(3) // .setRegPlatform(3) // Removed in 5.0; we don't know what it is
.setClientIpStr(session.getAddress().getAddress().getHostAddress()) .setClientIpStr(session.getAddress().getAddress().getHostAddress())
.build(); .build();
@ -45,7 +45,7 @@ public class PacketGetPlayerTokenRsp extends BasePacket {
.setRetcode(retcode) .setRetcode(retcode)
.setMsg(msg) .setMsg(msg)
.setBlackUidEndTime(blackEndTime) .setBlackUidEndTime(blackEndTime)
.setRegPlatform(3) // .setRegPlatform(3) // Removed in 5.0; we don't know what it is
.setCountryCode("US") .setCountryCode("US")
.setClientIpStr(session.getAddress().getAddress().getHostAddress()) .setClientIpStr(session.getAddress().getAddress().getHostAddress())
.build(); .build();
@ -69,10 +69,10 @@ public class PacketGetPlayerTokenRsp extends BasePacket {
.setSecretKeySeed(session.getEncryptSeed()) .setSecretKeySeed(session.getEncryptSeed())
.setSecurityCmdBuffer(ByteString.copyFrom(Crypto.ENCRYPT_SEED_BUFFER)) .setSecurityCmdBuffer(ByteString.copyFrom(Crypto.ENCRYPT_SEED_BUFFER))
.setPlatformType(3) .setPlatformType(3)
.setChannelId(1) // .setChannelId(1) // Removed in 5.0; we don't know what it is
.setCountryCode("US") .setCountryCode("US")
.setClientVersionRandomKey("c25-314dd05b0b5f") .setClientVersionRandomKey("c25-314dd05b0b5f")
.setRegPlatform(3) // .setRegPlatform(3) // Removed in 5.0; we don't know what it is
.setClientIpStr(session.getAddress().getAddress().getHostAddress()) .setClientIpStr(session.getAddress().getAddress().getHostAddress())
.setServerRandKey(encryptedSeed) .setServerRandKey(encryptedSeed)
.setSign(encryptedSeedSign) .setSign(encryptedSeedSign)

View File

@ -28,9 +28,9 @@ public class PacketPlayerEnterSceneNotify extends BasePacket {
.setTargetUid(player.getUid()) .setTargetUid(player.getUid())
.setEnterSceneToken(player.getEnterSceneToken()) .setEnterSceneToken(player.getEnterSceneToken())
.setWorldLevel(player.getWorldLevel()) .setWorldLevel(player.getWorldLevel())
.setEnterReason(EnterReason.Login.getValue()) // .setEnterReason(EnterReason.Login.getValue()) // Removed in 5.0; we don't know what it is
.setIsFirstLoginEnterScene(player.isFirstLoginEnterScene()) // .setIsFirstLoginEnterScene(player.isFirstLoginEnterScene()) // Removed in 5.0; we don't know what it is
.setWorldType(1) // .setWorldType(1) // Removed in 5.0; we don't know what it is
.setSceneTransaction( .setSceneTransaction(
"3-" "3-"
+ player.getUid() + player.getUid()
@ -79,8 +79,8 @@ public class PacketPlayerEnterSceneNotify extends BasePacket {
var proto = var proto =
PlayerEnterSceneNotify.newBuilder() PlayerEnterSceneNotify.newBuilder()
.setPrevSceneId(player.getSceneId()) // .setPrevSceneId(player.getSceneId()) // Removed in 5.0; we don't know what it is
.setPrevPos(player.getPosition().toProto()) // .setPrevPos(player.getPosition().toProto()) // Removed in 5.0; we don't know what it is
.setSceneId(teleportProperties.getSceneId()) .setSceneId(teleportProperties.getSceneId())
.setPos(teleportProperties.getTeleportTo().toProto()) .setPos(teleportProperties.getTeleportTo().toProto())
.setSceneBeginTime(System.currentTimeMillis()) .setSceneBeginTime(System.currentTimeMillis())
@ -88,8 +88,8 @@ public class PacketPlayerEnterSceneNotify extends BasePacket {
.setTargetUid(target.getUid()) .setTargetUid(target.getUid())
.setEnterSceneToken(player.getEnterSceneToken()) .setEnterSceneToken(player.getEnterSceneToken())
.setWorldLevel(target.getWorld().getWorldLevel()) .setWorldLevel(target.getWorld().getWorldLevel())
.setEnterReason(teleportProperties.getEnterReason().getValue()) // .setEnterReason(teleportProperties.getEnterReason().getValue()) // Removed in 5.0; we don't know what it is
.setWorldType(1) // .setWorldType(1) // Removed in 5.0; we don't know what it is
.setSceneTransaction( .setSceneTransaction(
teleportProperties.getSceneId() teleportProperties.getSceneId()
+ "-" + "-"
@ -117,16 +117,16 @@ public class PacketPlayerEnterSceneNotify extends BasePacket {
var proto = var proto =
PlayerEnterSceneNotify.newBuilder() PlayerEnterSceneNotify.newBuilder()
.setPrevSceneId(player.getSceneId()) // .setPrevSceneId(player.getSceneId()) // Removed in 5.0; we don't know what it is
.setPrevPos(player.getPosition().toProto()) // .setPrevPos(player.getPosition().toProto()) // Removed in 5.0; we don't know what it is
.setSceneId(teleportProperties.getSceneId()) .setSceneId(teleportProperties.getSceneId())
.setPos(teleportProperties.getTeleportTo().toProto()) .setPos(teleportProperties.getTeleportTo().toProto())
.setSceneBeginTime(System.currentTimeMillis()) .setSceneBeginTime(System.currentTimeMillis())
.setType(other ? EnterType.ENTER_TYPE_OTHER_HOME : EnterType.ENTER_TYPE_SELF_HOME) .setType(other ? EnterType.ENTER_TYPE_OTHER_HOME : EnterType.ENTER_TYPE_SELF_HOME)
.setTargetUid(targetUid) .setTargetUid(targetUid)
.setEnterSceneToken(player.getEnterSceneToken()) .setEnterSceneToken(player.getEnterSceneToken())
.setEnterReason(teleportProperties.getEnterReason().getValue()) // .setEnterReason(teleportProperties.getEnterReason().getValue()) // Removed in 5.0; we don't know what it is
.setWorldType(64) // .setWorldType(64) // Removed in 5.0; we don't know what it is
.setSceneTransaction( .setSceneTransaction(
teleportProperties.getSceneId() teleportProperties.getSceneId()
+ "-" + "-"

View File

@ -52,19 +52,19 @@ public class PacketPlayerLoginRsp extends BasePacket {
PlayerLoginRsp p = PlayerLoginRsp p =
PlayerLoginRsp.newBuilder() PlayerLoginRsp.newBuilder()
.setIsUseAbilityHash(true) // true // .setIsUseAbilityHash(true) // true, Removed in 5.0; we don't know what it is
.setAbilityHashCode(1844674) // 1844674 .setAbilityHashCode(1844674) // 1844674
.setGameBiz("hk4e_global") .setGameBiz("hk4e_global")
.setClientDataVersion(info.getClientDataVersion()) .setClientDataVersion(info.getClientDataVersion())
.setClientSilenceDataVersion(info.getClientSilenceDataVersion()) .setClientSilenceDataVersion(info.getClientSilenceDataVersion())
.setClientMd5(info.getClientDataMd5()) // .setClientMd5(info.getClientDataMd5()) // Removed in 5.0; we don't know what it is
.setClientSilenceMd5(info.getClientSilenceDataMd5()) // .setClientSilenceMd5(info.getClientSilenceDataMd5()) // Removed in 5.0; we don't know what it is
.setResVersionConfig(info.getResVersionConfig()) .setResVersionConfig(info.getResVersionConfig())
.setClientVersionSuffix(info.getClientVersionSuffix()) .setClientVersionSuffix(info.getClientVersionSuffix())
.setClientSilenceVersionSuffix(info.getClientSilenceVersionSuffix()) .setClientSilenceVersionSuffix(info.getClientSilenceVersionSuffix())
// .setIsScOpen(false) // .setIsScOpen(false) // Unknown for ??.??
// .setScInfo(ByteString.copyFrom(new byte[] {})) // .setScInfo(ByteString.copyFrom(new byte[] {})) // Unknown for ??.??
// .setRegisterCps("mihoyo") // .setRegisterCps("mihoyo") // Unknown for ??.??
.setCountryCode("US") .setCountryCode("US")
.build(); .build();