chore(style): spotlessApply
This commit is contained in:
1 parent
a0dc6d961b
commit
a93efe624f
43 files changed
+162
-105
No files matched your search
@@ -594,6 +594,5 @@ object GameProtocol : Protocol() {
|
||||
s2c<GtlListingsPagePacket>(0xFEu, GtlListingsPagePacketCodec)
|
||||
|
||||
s2c<WorldSessionStatePacket>(0xFFu, WorldSessionStatePacketCodec)
|
||||
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -75,9 +75,7 @@ private val EventsCodec: Codec<List<InputEventSample>> =
|
||||
shortB = S16LE.read(buf)
|
||||
}
|
||||
}
|
||||
result.add(
|
||||
InputEventSample(type, timestamp, byteA, byteB, intA, shortA, shortB, intB)
|
||||
)
|
||||
result.add(InputEventSample(type, timestamp, byteA, byteB, intA, shortA, shortB, intB))
|
||||
previous = timestamp
|
||||
}
|
||||
return result
|
||||
|
||||
+15
-3
@@ -75,9 +75,21 @@ private class BattleParticipantCodec(private val isCapture: Boolean) :
|
||||
}
|
||||
}
|
||||
return BattleActionParticipant(
|
||||
entityId, kind, intA, intB, intC, shortA, critByte, critShort, capturedShort, capturedByte,
|
||||
xpShort, xpByteA, xpByteB, pokemon, statStages
|
||||
)
|
||||
entityId,
|
||||
kind,
|
||||
intA,
|
||||
intB,
|
||||
intC,
|
||||
shortA,
|
||||
critByte,
|
||||
critShort,
|
||||
capturedShort,
|
||||
capturedByte,
|
||||
xpShort,
|
||||
xpByteA,
|
||||
xpByteB,
|
||||
pokemon,
|
||||
statStages)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -28,7 +28,8 @@ private val BattleActionSelectBody: Codec<BattleActionSelectPacket> =
|
||||
S8.write(buf, value.extraFlag)
|
||||
}
|
||||
|
||||
2, 3 -> {
|
||||
2,
|
||||
3 -> {
|
||||
S16LE.write(buf, value.moveOrItemId)
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -157,7 +157,8 @@ internal val BattleSerializedEntryCodec: Codec<BattleSerializedEntry> =
|
||||
S16LE.write(buf, value.y)
|
||||
}
|
||||
|
||||
is EmptyCreatureDataEntry -> throw MalformedPacketException("cannot encode default battle entry")
|
||||
is EmptyCreatureDataEntry ->
|
||||
throw MalformedPacketException("cannot encode default battle entry")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-3
@@ -28,14 +28,18 @@ internal val MessageArgCodec: Codec<MessageArg> =
|
||||
when (type) {
|
||||
28 -> {}
|
||||
30 -> longValue = field(S64LE) { it.longValue!! }
|
||||
9, 10, 17 -> intValue = field(S32LE) { it.intValue!! }
|
||||
5, 18 -> stringValue = field(Utf16LeNullTerminated) { it.stringValue!! }
|
||||
9,
|
||||
10,
|
||||
17 -> intValue = field(S32LE) { it.intValue!! }
|
||||
5,
|
||||
18 -> stringValue = field(Utf16LeNullTerminated) { it.stringValue!! }
|
||||
else -> {
|
||||
val count = field(U8) { it.shortValues!!.size }
|
||||
shortValues = (0 until count).map { i -> field(S16LE) { it.shortValues!![i] } }
|
||||
}
|
||||
}
|
||||
return MessageArg(argId, type, hasExtra, extra, longValue, intValue, stringValue, shortValues)
|
||||
return MessageArg(
|
||||
argId, type, hasExtra, extra, longValue, intValue, stringValue, shortValues)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -88,7 +88,8 @@ object BattleEntityDeltaPacketCodec : PacketCodec<BattleEntityDeltaPacket>() {
|
||||
val ivs = if (m and 262144 != 0) field(S16LE.repeat(5)) { it.ivs!! } else null
|
||||
val caughtBall = if (m and 524288 != 0) field(S8) { it.caughtBall!! } else null
|
||||
val statusFlags2 = if (m and 1048576 != 0) field(S16LE) { it.statusFlags2!! } else null
|
||||
val statusList = if (m and 4194304 != 0) field(S8.listPrefixed(U8)) { it.statusList!! } else null
|
||||
val statusList =
|
||||
if (m and 4194304 != 0) field(S8.listPrefixed(U8)) { it.statusList!! } else null
|
||||
val status = if (m and 8388608 != 0) field(S8) { it.status!! } else null
|
||||
|
||||
return BattleEntityDeltaPacket(
|
||||
|
||||
+14
-7
@@ -35,9 +35,18 @@ private val BattleRankingEntryCodec: Codec<BattleRankingEntry> =
|
||||
val bool2 = field(Bool) { it.bool2 }
|
||||
field(S8) { 0 }
|
||||
return BattleRankingEntry(
|
||||
entityId, flag1, flag2, name, value1, genderId, ribbons, byte1, int1, byte2, bool1,
|
||||
bool2
|
||||
)
|
||||
entityId,
|
||||
flag1,
|
||||
flag2,
|
||||
name,
|
||||
value1,
|
||||
genderId,
|
||||
ribbons,
|
||||
byte1,
|
||||
int1,
|
||||
byte2,
|
||||
bool1,
|
||||
bool2)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,8 +157,7 @@ private val BattleStorageItemCodec: Codec<BattleStorageItem> =
|
||||
val pokemonByte = field(S8) { it.pokemonByte }
|
||||
val boxByte = field(S8) { it.boxByte }
|
||||
return BattleStorageItem(
|
||||
typeByte, short1, short2, short3, short4, byte1, pokemonByte, boxByte
|
||||
)
|
||||
typeByte, short1, short2, short3, short4, byte1, pokemonByte, boxByte)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,8 +175,7 @@ object BattleScreenOpenPacketCodec : PacketCodec<BattleScreenOpenPacket>() {
|
||||
val active = field(U8) { if (it.active) 1 else 0 } == 1
|
||||
if (!active) {
|
||||
return BattleScreenOpenPacket(
|
||||
false, false, emptyList(), emptyList(), emptyList(), emptyList()
|
||||
)
|
||||
false, false, emptyList(), emptyList(), emptyList(), emptyList())
|
||||
}
|
||||
val wild = field(U8) { if (it.wild) 1 else 0 } == 1
|
||||
var participants = emptyList<BattleRankingEntry>()
|
||||
|
||||
+11
-4
@@ -40,9 +40,16 @@ object BattleSendOutActivePacketCodec : PacketCodec<BattleSendOutActivePacket>()
|
||||
return BattleSendOutActivePacket(
|
||||
opponent,
|
||||
BattleSendOutMember(
|
||||
entityIdA, entityIdB, entityIdC, speciesByte, nickname, ownerName, value, nameA, nameB,
|
||||
levelByte, flag
|
||||
)
|
||||
)
|
||||
entityIdA,
|
||||
entityIdB,
|
||||
entityIdC,
|
||||
speciesByte,
|
||||
nickname,
|
||||
ownerName,
|
||||
value,
|
||||
nameA,
|
||||
nameB,
|
||||
levelByte,
|
||||
flag))
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -43,8 +43,7 @@ private val BattleAddPokemonCodec: Codec<BattleAddPokemon> =
|
||||
BattleAddStatusEffect(durationTurns, effectType, sourceSlot)
|
||||
} else null
|
||||
return BattleAddPokemon(
|
||||
entityId, frontSpriteId, backSpriteId, side, slot, partyIndex, statusEffect
|
||||
)
|
||||
entityId, frontSpriteId, backSpriteId, side, slot, partyIndex, statusEffect)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -45,8 +45,7 @@ private val BattlePartyPokemonCodec: Codec<BattlePartyPokemon> =
|
||||
BattlePartyStatusEffect(durationTurns, effectType, sourceSlot)
|
||||
} else null
|
||||
return BattlePartyPokemon(
|
||||
entityId, frontSpriteId, backSpriteId, side, slot, partyIndex, statusEffect
|
||||
)
|
||||
entityId, frontSpriteId, backSpriteId, side, slot, partyIndex, statusEffect)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -17,7 +17,8 @@ private val SimulationConfigPayload: Codec<ByteArray> =
|
||||
|
||||
data class BattleSimulationRequestPacket(val simulationConfig: ByteArray) {
|
||||
override fun equals(other: Any?): Boolean =
|
||||
other is BattleSimulationRequestPacket && simulationConfig.contentEquals(other.simulationConfig)
|
||||
other is BattleSimulationRequestPacket &&
|
||||
simulationConfig.contentEquals(other.simulationConfig)
|
||||
|
||||
override fun hashCode(): Int = simulationConfig.contentHashCode()
|
||||
}
|
||||
|
||||
+11
-3
@@ -33,9 +33,17 @@ private class BattlePreviewMemberCodec(
|
||||
val levelByte = field(S8) { it.levelByte }
|
||||
val flag = field(Bool) { it.flag }
|
||||
return BattlePreviewMember(
|
||||
entityIdA, entityIdB, entityIdC, speciesByte, nickname, ownerName, value, nameA, nameB,
|
||||
levelByte, flag
|
||||
)
|
||||
entityIdA,
|
||||
entityIdB,
|
||||
entityIdC,
|
||||
speciesByte,
|
||||
nickname,
|
||||
ownerName,
|
||||
value,
|
||||
nameA,
|
||||
nameB,
|
||||
levelByte,
|
||||
flag)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -34,7 +34,8 @@ object CharacterAppearanceApplyPacketCodec : PacketCodec<CharacterAppearanceAppl
|
||||
val moves = mutableListOf<AppearanceMoveEntry>()
|
||||
for (slot in 0 until 15) {
|
||||
if (mask and (1 shl slot) != 0) {
|
||||
val packed = field(S16LE) { v -> v.creatureMoves.moves.first { it.slot == slot }.packedMove }
|
||||
val packed =
|
||||
field(S16LE) { v -> v.creatureMoves.moves.first { it.slot == slot }.packedMove }
|
||||
val pp: Byte? =
|
||||
if (hasPp) field(S8) { v -> v.creatureMoves.moves.first { it.slot == slot }.ppUp ?: 0 }
|
||||
else null
|
||||
|
||||
+1
-2
@@ -15,8 +15,7 @@ object ChatMessageSendPacketCodec : PacketCodec<ChatMessageSendPacket>() {
|
||||
override fun CodecScope<ChatMessageSendPacket>.body(): ChatMessageSendPacket {
|
||||
val mode = field(S8) { it.mode }
|
||||
val target = field(Utf16LeNullTerminated) { it.target }
|
||||
val message =
|
||||
if (mode.toInt() == 4) field(Utf16LeNullTerminated) { it.message ?: "" } else null
|
||||
val message = if (mode.toInt() == 4) field(Utf16LeNullTerminated) { it.message ?: "" } else null
|
||||
return ChatMessageSendPacket(mode, target, message)
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -49,8 +49,7 @@ data class CustomizeCharacterAppearancePacket(
|
||||
val paletteIndex: Byte,
|
||||
)
|
||||
|
||||
object CustomizeCharacterAppearancePacketCodec :
|
||||
PacketCodec<CustomizeCharacterAppearancePacket>() {
|
||||
object CustomizeCharacterAppearancePacketCodec : PacketCodec<CustomizeCharacterAppearancePacket>() {
|
||||
override fun CodecScope<CustomizeCharacterAppearancePacket>.body():
|
||||
CustomizeCharacterAppearancePacket {
|
||||
val entityId = field(S64LE) { it.entityId }
|
||||
@@ -59,7 +58,6 @@ object CustomizeCharacterAppearancePacketCodec :
|
||||
val moveSet = field(CreatureMovesetCodec) { it.moveSet }
|
||||
val paletteIndex = field(S8) { it.paletteIndex }
|
||||
return CustomizeCharacterAppearancePacket(
|
||||
entityId, colorCategoryId, colorSlot, moveSet, paletteIndex
|
||||
)
|
||||
entityId, colorCategoryId, colorSlot, moveSet, paletteIndex)
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -53,7 +53,8 @@ object EntityAppearancePatchPacketCodec : PacketCodec<EntityAppearancePatchPacke
|
||||
val flagsInt = flags.toInt()
|
||||
val direction = if (flagsInt and 1 != 0) field(S8) { it.direction!! } else null
|
||||
val animation = if (flagsInt and 2 != 0) field(S16LE) { it.animation!! } else null
|
||||
val appearance = if (flagsInt and 4 != 0) field(EntityAppearanceCodec) { it.appearance!! } else null
|
||||
val appearance =
|
||||
if (flagsInt and 4 != 0) field(EntityAppearanceCodec) { it.appearance!! } else null
|
||||
val cosmetics =
|
||||
if (flagsInt and 8 != 0) {
|
||||
val count = field(S8) { it.cosmetics!!.size.toByte() }.toInt()
|
||||
@@ -64,7 +65,6 @@ object EntityAppearancePatchPacketCodec : PacketCodec<EntityAppearancePatchPacke
|
||||
}
|
||||
} else null
|
||||
return EntityAppearancePatchPacket(
|
||||
entityId, spriteId, direction, animation, appearance, cosmetics
|
||||
)
|
||||
entityId, spriteId, direction, animation, appearance, cosmetics)
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -112,7 +112,8 @@ private val EventOverlayStateCodec: Codec<EventOverlayStatePacket> =
|
||||
S16LE.write(buf, r.regionId)
|
||||
S16LE.write(buf, r.secondary)
|
||||
if (grid) {
|
||||
val points = r.gridPoints ?: throw MalformedPacketException("grid overlay region missing points")
|
||||
val points =
|
||||
r.gridPoints ?: throw MalformedPacketException("grid overlay region missing points")
|
||||
U8.write(buf, points.size)
|
||||
for (p in points) {
|
||||
S16LE.write(buf, p.x)
|
||||
|
||||
+3
-1
@@ -15,7 +15,9 @@ data class ReconnectHelloAuth(val entityId: Long, val sessionToken: ByteArray) :
|
||||
|
||||
data class NewHelloAuth(val userId: Int, val sessionToken: ByteArray) : HelloAuthData() {
|
||||
override fun equals(other: Any?): Boolean =
|
||||
other is NewHelloAuth && userId == other.userId && sessionToken.contentEquals(other.sessionToken)
|
||||
other is NewHelloAuth &&
|
||||
userId == other.userId &&
|
||||
sessionToken.contentEquals(other.sessionToken)
|
||||
|
||||
override fun hashCode(): Int = userId * 31 + sessionToken.contentHashCode()
|
||||
}
|
||||
|
||||
+41
-8
@@ -88,10 +88,36 @@ private val GmCharacterSessionCodec: Codec<GmCharacterSession> =
|
||||
val statusCount = field(U8) { it.statusList.size }
|
||||
val statusList = (0 until statusCount).map { i -> field(S8) { it.statusList[i] } }
|
||||
return GmCharacterSession(
|
||||
entityId, name, secondaryName, intA, byteA, intB, longA, intC, intD, intE, shortA, intF,
|
||||
byteB, byteC, byteD, shortB, byteE, intG, byteF, byteG, byteH, byteI, byteJ, shortC,
|
||||
shortD, shortE, statusByte, shortF, shortG, statusList
|
||||
)
|
||||
entityId,
|
||||
name,
|
||||
secondaryName,
|
||||
intA,
|
||||
byteA,
|
||||
intB,
|
||||
longA,
|
||||
intC,
|
||||
intD,
|
||||
intE,
|
||||
shortA,
|
||||
intF,
|
||||
byteB,
|
||||
byteC,
|
||||
byteD,
|
||||
shortB,
|
||||
byteE,
|
||||
intG,
|
||||
byteF,
|
||||
byteG,
|
||||
byteH,
|
||||
byteI,
|
||||
byteJ,
|
||||
shortC,
|
||||
shortD,
|
||||
shortE,
|
||||
statusByte,
|
||||
shortF,
|
||||
shortG,
|
||||
statusList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,9 +183,15 @@ object GmPlayerLookupPacketCodec : PacketCodec<GmPlayerLookupPacket>() {
|
||||
val stringB = field(Utf16LeNullTerminated) { it.account!!.stringB }
|
||||
val stringC = field(Utf16LeNullTerminated) { it.account!!.stringC }
|
||||
GmAccountInfo(
|
||||
rankExtraA, rankExtraB, rankExtraC, ipAddress, playtime, accountId, stringA, stringB,
|
||||
stringC
|
||||
)
|
||||
rankExtraA,
|
||||
rankExtraB,
|
||||
rankExtraC,
|
||||
ipAddress,
|
||||
playtime,
|
||||
accountId,
|
||||
stringA,
|
||||
stringB,
|
||||
stringC)
|
||||
} else null
|
||||
val extraByte = field(U8) { if (it.extra != null) 1 else 0 }
|
||||
val extra =
|
||||
@@ -169,7 +201,8 @@ object GmPlayerLookupPacketCodec : PacketCodec<GmPlayerLookupPacket>() {
|
||||
GmExtraDetail(value, text)
|
||||
} else null
|
||||
val charCount = field(U16LE) { it.characters.size }
|
||||
val characters = (0 until charCount).map { i -> field(GmCharacterListingCodec) { it.characters[i] } }
|
||||
val characters =
|
||||
(0 until charCount).map { i -> field(GmCharacterListingCodec) { it.characters[i] } }
|
||||
return GmPlayerLookupPacket(true, session, rank, account, extra, characters)
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -47,8 +47,6 @@ object GtlCreateListingPacketCodec : PacketCodec<GtlCreateListingPacket>() {
|
||||
val itemKind = field(S8) { it.itemKind }
|
||||
val priceShort = field(S16LE) { it.priceShort }
|
||||
val filterCriteria = field(FilterCriteriaBytes) { it.filterCriteria }
|
||||
return GtlCreateListingPacket(
|
||||
categoryIndex, listingCount, itemKind, priceShort, filterCriteria
|
||||
)
|
||||
return GtlCreateListingPacket(categoryIndex, listingCount, itemKind, priceShort, filterCriteria)
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -39,7 +39,6 @@ object GtlSellPokemonListingPacketCodec : PacketCodec<GtlSellPokemonListingPacke
|
||||
val criteriaCount = field(U8) { it.criteriaCount }
|
||||
val criteriaData = field(RemainingBytes) { it.criteriaData }
|
||||
return GtlSellPokemonListingPacket(
|
||||
listingType, entryKindId, listingCategory, itemTypeId, criteriaCount, criteriaData
|
||||
)
|
||||
listingType, entryKindId, listingCategory, itemTypeId, criteriaCount, criteriaData)
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -38,7 +38,8 @@ private object GuildProfileDataCodec : PacketCodec<GuildProfileData>() {
|
||||
val value5 = field(S16LE, GuildProfileData::value5)
|
||||
val value6 = field(S32LE, GuildProfileData::value6)
|
||||
val rankCount = field(S8) { it.rankNames.size.toByte() }
|
||||
val rankNames = List(rankCount.toInt()) { i -> field(Utf16LeNullTerminated) { it.rankNames[i] } }
|
||||
val rankNames =
|
||||
List(rankCount.toInt()) { i -> field(Utf16LeNullTerminated) { it.rankNames[i] } }
|
||||
return GuildProfileData(
|
||||
guildId,
|
||||
name,
|
||||
|
||||
+2
-1
@@ -33,7 +33,8 @@ object GuildProfileSyncPacketCodec : PacketCodec<GuildProfileSyncPacket>() {
|
||||
val value5 = field(S16LE, GuildProfileSyncPacket::value5)
|
||||
val value6 = field(S32LE, GuildProfileSyncPacket::value6)
|
||||
val rankCount = field(S8) { it.rankNames.size.toByte() }
|
||||
val rankNames = List(rankCount.toInt()) { i -> field(Utf16LeNullTerminated) { it.rankNames[i] } }
|
||||
val rankNames =
|
||||
List(rankCount.toInt()) { i -> field(Utf16LeNullTerminated) { it.rankNames[i] } }
|
||||
return GuildProfileSyncPacket(
|
||||
guildId,
|
||||
name,
|
||||
|
||||
+2
-1
@@ -43,7 +43,8 @@ private val HighScoreEntryCodec: Codec<HighScoreEntry> =
|
||||
val rank = field(S32LE) { it.rank }
|
||||
val score = field(S32LE) { it.score }
|
||||
val count = field(U8) { it.appearances.size }
|
||||
val appearances = (0 until count).map { i -> field(HighScoreAppearanceCodec) { it.appearances[i] } }
|
||||
val appearances =
|
||||
(0 until count).map { i -> field(HighScoreAppearanceCodec) { it.appearances[i] } }
|
||||
return HighScoreEntry(entityId, rank, score, appearances)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -47,8 +47,6 @@ object ListWindowPagePacketCodec : PacketCodec<ListWindowPagePacket>() {
|
||||
val headerB = field(S8) { it.headerB }
|
||||
val headerC = field(S8) { it.headerC }
|
||||
val rows = field(ListWindowRowCodec.listPrefixed(U16LE)) { it.rows }
|
||||
return ListWindowPagePacket(
|
||||
windowId, firstPage, lastPage, headerA, headerB, headerC, rows
|
||||
)
|
||||
return ListWindowPagePacket(windowId, firstPage, lastPage, headerA, headerB, headerC, rows)
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -52,7 +52,8 @@ object LocalCharacterDeltaPacketCodec : PacketCodec<LocalCharacterDeltaPacket>()
|
||||
value64a = null
|
||||
value64b = null
|
||||
}
|
||||
val statusConditions = if (m and 128 != 0) field(S8.listPrefixed(U8)) { it.statusConditions!! } else null
|
||||
val statusConditions =
|
||||
if (m and 128 != 0) field(S8.listPrefixed(U8)) { it.statusConditions!! } else null
|
||||
val value256 = if (m and 256 != 0) field(S8) { it.value256!! } else null
|
||||
return LocalCharacterDeltaPacket(
|
||||
mask = mask,
|
||||
|
||||
+1
-2
@@ -26,7 +26,6 @@ object MapTileObjectSlotSetPacketCodec : PacketCodec<MapTileObjectSlotSetPacket>
|
||||
val objectZ = if (present) field(S8) { it.objectZ!! } else null
|
||||
val relative = if (present) field(U8) { if (it.relative == true) 1 else 0 } == 1 else null
|
||||
return MapTileObjectSlotSetPacket(
|
||||
blockX, blockY, blockZ, slot, present, objectX, objectY, objectZ, relative
|
||||
)
|
||||
blockX, blockY, blockZ, slot, present, objectX, objectY, objectZ, relative)
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -42,7 +42,6 @@ object MarketBoardPagePacketCodec : PacketCodec<MarketBoardPagePacket>() {
|
||||
entries.add(MarketBoardEntry(itemId, valueA, valueB, rank))
|
||||
}
|
||||
return MarketBoardPagePacket(
|
||||
hasData, page, category, total, expiryOffsetMillis, count, categoryRanked, entries
|
||||
)
|
||||
hasData, page, category, total, expiryOffsetMillis, count, categoryRanked, entries)
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,6 @@ object NpcSpawnPacketCodec : PacketCodec<NpcSpawnPacket>() {
|
||||
val facing = field(U8) { it.facing }
|
||||
val unk6 = field(U16LE) { it.unk6 }
|
||||
return NpcSpawnPacket(
|
||||
entityId, unk1, unk2, unk3, unk4, regionId, bankId, mapId, x, y, facing, unk5, unk6
|
||||
)
|
||||
entityId, unk1, unk2, unk3, unk4, regionId, bankId, mapId, x, y, facing, unk5, unk6)
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -16,7 +16,6 @@ object RequestConfirmationPromptPacketCodec : PacketCodec<RequestConfirmationPro
|
||||
val requestTimeoutSeconds = if (visible) field(U16LE) { it.requestTimeoutSeconds!! } else null
|
||||
val responseTimeoutSeconds = if (visible) field(U16LE) { it.responseTimeoutSeconds!! } else null
|
||||
return RequestConfirmationPromptPacket(
|
||||
visible, entityId, requestTimeoutSeconds, responseTimeoutSeconds
|
||||
)
|
||||
visible, entityId, requestTimeoutSeconds, responseTimeoutSeconds)
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -40,8 +40,7 @@ private val ServerMessageArgCodec: Codec<ServerMessageArg> =
|
||||
else -> shortValues = field(S16LE.listPrefixed(U8)) { it.shortValues!! }
|
||||
}
|
||||
return ServerMessageArg(
|
||||
argId, type, hasExtra, extra, longValue, intValue, stringValue, shortValues
|
||||
)
|
||||
argId, type, hasExtra, extra, longValue, intValue, stringValue, shortValues)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-5
@@ -24,16 +24,13 @@ private val ColorPaletteCodec: Codec<List<Short>> =
|
||||
}
|
||||
}
|
||||
|
||||
object SetBattleMonsterAppearancePacketCodec :
|
||||
PacketCodec<SetBattleMonsterAppearancePacket>() {
|
||||
object SetBattleMonsterAppearancePacketCodec : PacketCodec<SetBattleMonsterAppearancePacket>() {
|
||||
override fun CodecScope<SetBattleMonsterAppearancePacket>.body():
|
||||
SetBattleMonsterAppearancePacket {
|
||||
val partySlot = field(S16LE) { it.partySlot }
|
||||
val pokemonEntityId = field(S64LE) { it.pokemonEntityId }
|
||||
val shininessType = field(S8) { it.shininessType }
|
||||
val colorPalette = field(ColorPaletteCodec) { it.colorPalette }
|
||||
return SetBattleMonsterAppearancePacket(
|
||||
partySlot, pokemonEntityId, shininessType, colorPalette
|
||||
)
|
||||
return SetBattleMonsterAppearancePacket(partySlot, pokemonEntityId, shininessType, colorPalette)
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -11,10 +11,8 @@ data class SocialActionOutcomePacket(
|
||||
object SocialActionOutcomePacketCodec : PacketCodec<SocialActionOutcomePacket>() {
|
||||
override fun CodecScope<SocialActionOutcomePacket>.body(): SocialActionOutcomePacket {
|
||||
val action = field(U8) { it.action }
|
||||
val entityId: Long? =
|
||||
if (resolveKind(action) == 1) field(S64LE) { it.entityId!! } else null
|
||||
val value: Short? =
|
||||
if (resolveKind(action) == 2) field(S16LE) { it.value!! } else null
|
||||
val entityId: Long? = if (resolveKind(action) == 1) field(S64LE) { it.entityId!! } else null
|
||||
val value: Short? = if (resolveKind(action) == 2) field(S16LE) { it.value!! } else null
|
||||
return SocialActionOutcomePacket(action, entityId, value)
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -16,8 +16,7 @@ object SpatialGroupInsertPacketCodec : PacketCodec<SpatialGroupInsertPacket>() {
|
||||
val entityId = field(S64LE) { it.entityId }
|
||||
val value = field(S16LE) { it.value }
|
||||
val extraCoordPresent = false
|
||||
val extraValue: Short? =
|
||||
if (extraCoordPresent) field(S16LE) { it.extraValue ?: 0 } else null
|
||||
val extraValue: Short? = if (extraCoordPresent) field(S16LE) { it.extraValue ?: 0 } else null
|
||||
return SpatialGroupInsertPacket(group, entityId, value, extraCoordPresent, extraValue)
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -11,7 +11,8 @@ data class StorageBoxFilterPacket(
|
||||
other is StorageBoxFilterPacket &&
|
||||
listTypeIndex == other.listTypeIndex &&
|
||||
boxName == other.boxName &&
|
||||
(cookieData?.contentEquals(other.cookieData ?: ByteArray(0)) ?: (other.cookieData == null))
|
||||
(cookieData?.contentEquals(other.cookieData ?: ByteArray(0))
|
||||
?: (other.cookieData == null))
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var r = listTypeIndex?.hashCode() ?: 0
|
||||
@@ -26,9 +27,7 @@ private val CookieBytes = bytesPrefixed(U8)
|
||||
object StorageBoxFilterPacketCodec : PacketCodec<StorageBoxFilterPacket>() {
|
||||
override fun CodecScope<StorageBoxFilterPacket>.body(): StorageBoxFilterPacket {
|
||||
val typeFlags =
|
||||
field(U8) {
|
||||
(if (it.boxName != null) 1 else 0) or (if (it.cookieData != null) 2 else 0)
|
||||
}
|
||||
field(U8) { (if (it.boxName != null) 1 else 0) or (if (it.cookieData != null) 2 else 0) }
|
||||
val listTypeIndex: Byte? =
|
||||
if (typeFlags and 1 != 0) field(S8) { it.listTypeIndex ?: 0 } else null
|
||||
val boxName: String? =
|
||||
|
||||
+1
-3
@@ -35,9 +35,7 @@ object StorageContextWindowPacketCodec : PacketCodec<StorageContextWindowPacket>
|
||||
val quantity = field(S8) { it.items[i].quantity }
|
||||
val ball = field(S8) { it.items[i].ball }
|
||||
val location = field(S8) { it.items[i].location }
|
||||
items.add(
|
||||
StorageBoxItem(slot, valueA, valueB, valueC, valueD, quantity, ball, location)
|
||||
)
|
||||
items.add(StorageBoxItem(slot, valueA, valueB, valueC, valueD, quantity, ball, location))
|
||||
}
|
||||
return StorageContextWindowPacket(kind, items)
|
||||
}
|
||||
|
||||
+1
-2
@@ -50,7 +50,6 @@ object StorageInventoryPacketCodec : PacketCodec<StorageInventoryPacket>() {
|
||||
val listC = field(StorageQuantityCodec.listPrefixed(U8)) { it.listC }
|
||||
val listD = field(StorageQuantityCodec.listPrefixed(U8)) { it.listD }
|
||||
return StorageInventoryPacket(
|
||||
header, totalA, totalB, valueC, usedA, usedB, listA, listB, listC, listD
|
||||
)
|
||||
header, totalA, totalB, valueC, usedA, usedB, listA, listB, listC, listD)
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -56,8 +56,7 @@ object TeamPreviewLeadSubmitPacketCodec : PacketCodec<TeamPreviewLeadSubmitPacke
|
||||
val pokemonEntityId = field(S64LE) { it.pokemonEntityId }
|
||||
val battleSlot = field(S8) { it.battleSlot }
|
||||
val present = field(U8) { if (it.appearance != null) 1 else 0 }
|
||||
val appearance =
|
||||
if (present != 0) field(AppearanceCodec) { it.appearance!! } else null
|
||||
val appearance = if (present != 0) field(AppearanceCodec) { it.appearance!! } else null
|
||||
val teamSide = field(S16LE) { it.teamSide }
|
||||
val reserved = field(S8) { it.reserved }
|
||||
return TeamPreviewLeadSubmitPacket(
|
||||
|
||||
+1
-3
@@ -7,9 +7,7 @@ data class TypedBinaryDataPacket(
|
||||
val data: ByteArray,
|
||||
) {
|
||||
override fun equals(other: Any?): Boolean =
|
||||
other is TypedBinaryDataPacket &&
|
||||
dataType == other.dataType &&
|
||||
data.contentEquals(other.data)
|
||||
other is TypedBinaryDataPacket && dataType == other.dataType && data.contentEquals(other.data)
|
||||
|
||||
override fun hashCode(): Int = dataType * 31 + data.contentHashCode()
|
||||
}
|
||||
|
||||
+6
-4
@@ -28,16 +28,18 @@ private val WorldNoticeArgCodec: Codec<WorldNoticeArg> =
|
||||
when (type) {
|
||||
28 -> {}
|
||||
30 -> longValue = field(S64LE) { it.longValue!! }
|
||||
9, 10, 17 -> intValue = field(S32LE) { it.intValue!! }
|
||||
5, 18 -> stringValue = field(Utf16LeNullTerminated) { it.stringValue!! }
|
||||
9,
|
||||
10,
|
||||
17 -> intValue = field(S32LE) { it.intValue!! }
|
||||
5,
|
||||
18 -> stringValue = field(Utf16LeNullTerminated) { it.stringValue!! }
|
||||
else -> {
|
||||
val count = field(U8) { it.shortValues!!.size }
|
||||
shortValues = (0 until count).map { i -> field(S16LE) { it.shortValues!![i] } }
|
||||
}
|
||||
}
|
||||
return WorldNoticeArg(
|
||||
argId, type, hasExtra, extra, longValue, intValue, stringValue, shortValues
|
||||
)
|
||||
argId, type, hasExtra, extra, longValue, intValue, stringValue, shortValues)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -9,7 +9,8 @@ data class WorldObjectInstanceDespawnPacket(
|
||||
)
|
||||
|
||||
object WorldObjectInstanceDespawnPacketCodec : PacketCodec<WorldObjectInstanceDespawnPacket>() {
|
||||
override fun CodecScope<WorldObjectInstanceDespawnPacket>.body(): WorldObjectInstanceDespawnPacket {
|
||||
override fun CodecScope<WorldObjectInstanceDespawnPacket>.body():
|
||||
WorldObjectInstanceDespawnPacket {
|
||||
val entityId = field(S64LE) { it.entityId }
|
||||
return WorldObjectInstanceDespawnPacket(entityId)
|
||||
}
|
||||
|
||||
@@ -60,7 +60,9 @@ constructor(
|
||||
val state = ctx.attributes[PLAYER_STATE] ?: return
|
||||
val packet = event.packet
|
||||
socialStore.block(state.userId, packet.username)
|
||||
log.info { "BlockPlayer user=${state.userId} name='${packet.username}' reason='${packet.reason}'" }
|
||||
log.info {
|
||||
"BlockPlayer user=${state.userId} name='${packet.username}' reason='${packet.reason}'"
|
||||
}
|
||||
ctx.send(
|
||||
PartyMemberJoinPacket(
|
||||
player = syntheticId(packet.username),
|
||||
|
||||
Reference in new issue
Block a user