-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
507 additions
and
262 deletions.
There are no files selected for viewing
3 changes: 0 additions & 3 deletions
3
game-server/src/main/kotlin/work/fking/pangya/game/model/Coord.kt
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
game-server/src/main/kotlin/work/fking/pangya/game/model/Coord2D.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package work.fking.pangya.game.model | ||
|
||
import io.netty.buffer.ByteBuf | ||
|
||
data class Coord2D(val x: Float, val z: Float) { | ||
|
||
constructor(buffer: ByteBuf) : this( | ||
x = buffer.readFloatLE(), | ||
z = buffer.readFloatLE() | ||
) | ||
} | ||
|
||
fun ByteBuf.write(coord: Coord2D) { | ||
this.writeFloatLE(coord.x) | ||
this.writeFloatLE(coord.z) | ||
} |
18 changes: 18 additions & 0 deletions
18
game-server/src/main/kotlin/work/fking/pangya/game/model/Coord3D.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package work.fking.pangya.game.model | ||
|
||
import io.netty.buffer.ByteBuf | ||
|
||
data class Coord3D(val x: Float, val y: Float, val z: Float) { | ||
constructor(buffer: ByteBuf) : this( | ||
x = buffer.readFloatLE(), | ||
y = buffer.readFloatLE(), | ||
z = buffer.readFloatLE() | ||
) | ||
|
||
} | ||
|
||
fun ByteBuf.write(coord: Coord3D) { | ||
this.writeFloatLE(coord.x) | ||
this.writeFloatLE(coord.y) | ||
this.writeFloatLE(coord.z) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...in/kotlin/work/fking/pangya/game/packet/handler/match/MatchPlayerShotSyncPacketHandler.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package work.fking.pangya.game.packet.handler.match | ||
|
||
import io.netty.buffer.ByteBuf | ||
import work.fking.pangya.game.GameServer | ||
import work.fking.pangya.game.net.ClientPacketHandler | ||
import work.fking.pangya.game.player.Player | ||
import work.fking.pangya.game.room.match.PlayerShotSyncEvent | ||
|
||
class MatchPlayerShotSyncPacketHandler : ClientPacketHandler { | ||
|
||
override fun handle(server: GameServer, player: Player, packet: ByteBuf) { | ||
val room = player.currentRoom ?: throw IllegalStateException("Player ${player.nickname} tried to sync shot but is not in a room") | ||
val roomPlayer = room.findSelf(player) | ||
|
||
val connectionId = packet.readIntLE() | ||
val x = packet.readFloatLE() | ||
val y = packet.readFloatLE() | ||
val z = packet.readFloatLE() | ||
val state = packet.readByte().toInt() | ||
val bunker = packet.readByte().toInt() | ||
val unknown = packet.readByte().toInt() | ||
val pang = packet.readIntLE() | ||
val bonusPang = packet.readIntLE() | ||
val cameraFlags = packet.readIntLE() | ||
val shotFlags = packet.readIntLE() | ||
val shotFrames = packet.readShortLE().toInt() // i think this is the travel time in frames? | ||
val grandPrixPenalties = packet.readByte().toInt() | ||
|
||
room.handleMatchEvent(PlayerShotSyncEvent( | ||
player = roomPlayer, | ||
x = x, | ||
z = z, | ||
shotFlags = shotFlags, | ||
frames = shotFrames | ||
)) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
.../main/kotlin/work/fking/pangya/game/packet/handler/match/MatchTourneyShotPacketHandler.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package work.fking.pangya.game.packet.handler.match | ||
|
||
import io.netty.buffer.ByteBuf | ||
import work.fking.pangya.game.GameServer | ||
import work.fking.pangya.game.net.ClientPacketHandler | ||
import work.fking.pangya.game.player.Player | ||
import work.fking.pangya.game.room.match.PlayerTourneyShotEvent | ||
import work.fking.pangya.game.room.match.TourneyShotData | ||
|
||
class MatchTourneyShotPacketHandler : ClientPacketHandler { | ||
|
||
override fun handle(server: GameServer, player: Player, packet: ByteBuf) { | ||
val room = player.currentRoom ?: throw IllegalStateException("Player ${player.nickname} tried to sync tourney shot but is not in a room") | ||
val roomPlayer = room.findSelf(player) | ||
|
||
val shotData = TourneyShotData(packet) | ||
|
||
room.handleMatchEvent(PlayerTourneyShotEvent(roomPlayer, shotData)) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.