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 {
AvatarUpgradeReq req = AvatarUpgradeReq.parseFrom(payload);
// Level up avatar
session
// Changed in 5.0:
// 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()
.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())
.setOldLevel(oldLevel)
.setCurLevel(avatar.getLevel())
.putAllOldFightPropMap(oldFightPropMap)
.putAllCurFightPropMap(avatar.getFightProperties())
// Removed in 5.0
// .putAllOldFightPropMap(oldFightPropMap)
// .putAllCurFightPropMap(avatar.getFightProperties())
.build();
this.setData(proto);

View File

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

View File

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

View File

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