Skip to content

Commit

Permalink
Merge branch 'release/2.1.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBean355 committed Aug 8, 2022
2 parents 7eb0c9f + 137cac0 commit e1233cb
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/api/lib.api
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public abstract interface class com/github/mrbean355/dota2/hero/talent/TalentTre

public final class com/github/mrbean355/dota2/item/BottledRune : java/lang/Enum {
public static final field Arcane Lcom/github/mrbean355/dota2/item/BottledRune;
public static final field Bounty Lcom/github/mrbean355/dota2/item/BottledRune;
public static final field Companion Lcom/github/mrbean355/dota2/item/BottledRune$Companion;
public static final field DoubleDamage Lcom/github/mrbean355/dota2/item/BottledRune;
public static final field Empty Lcom/github/mrbean355/dota2/item/BottledRune;
Expand Down Expand Up @@ -178,10 +179,12 @@ public final class com/github/mrbean355/dota2/item/Items {
public abstract interface class com/github/mrbean355/dota2/map/DotaMap {
public abstract fun getClockTime ()I
public abstract fun getCustomGameName ()Ljava/lang/String;
public abstract fun getDireScore ()I
public abstract fun getGameTime ()I
public abstract fun getMatchId ()Ljava/lang/String;
public abstract fun getMatchState ()Lcom/github/mrbean355/dota2/map/MatchState;
public abstract fun getName ()Ljava/lang/String;
public abstract fun getRadiantScore ()I
public abstract fun getWinningTeam ()Lcom/github/mrbean355/dota2/map/Team;
public abstract fun isDaytime ()Z
public abstract fun isNightStalkerNight ()Z
Expand Down
2 changes: 1 addition & 1 deletion lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugins {

group = "com.github.mrbean355"
val artifactId by extra("dota2-gsi")
version = "2.0.0"
version = "2.1.0"

dependencies {
implementation(libs.ktor.server.netty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ enum class BottledRune {
@SerialName("arcane")
Arcane,

@SerialName("bounty")
Bounty,

@SerialName("double_damage")
DoubleDamage,

Expand Down
2 changes: 2 additions & 0 deletions lib/src/main/kotlin/com/github/mrbean355/dota2/map/DotaMap.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ interface DotaMap {
val clockTime: Int
val isDaytime: Boolean
val isNightStalkerNight: Boolean
val radiantScore: Int
val direScore: Int
val matchState: MatchState
val isPaused: Boolean
val winningTeam: Team
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ internal data class PlayingMapImpl(
@SerialName("clock_time") override val clockTime: Int,
@SerialName("daytime") override val isDaytime: Boolean,
@SerialName("nightstalker_night") override val isNightStalkerNight: Boolean,
@SerialName("radiant_score") override val radiantScore: Int,
@SerialName("dire_score") override val direScore: Int,
@SerialName("game_state") override val matchState: MatchState,
@SerialName("paused") override val isPaused: Boolean,
@SerialName("win_team") override val winningTeam: Team,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ internal data class SpectatedMapImpl(
@SerialName("clock_time") override val clockTime: Int,
@SerialName("daytime") override val isDaytime: Boolean,
@SerialName("nightstalker_night") override val isNightStalkerNight: Boolean,
@SerialName("radiant_score") override val radiantScore: Int,
@SerialName("dire_score") override val direScore: Int,
@SerialName("game_state") override val matchState: MatchState,
@SerialName("paused") override val isPaused: Boolean,
@SerialName("win_team") override val winningTeam: Team,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ internal class GameStateServerImpl(

private fun authenticate(root: JsonObject) {
val received = root["auth"] as JsonObject?
if (received == null || received.isEmpty()) {
if (received.isNullOrEmpty()) {
check(authentication.isEmpty()) {
"Unauthorized request, auth=$received"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ internal class MapFactoryTest {
assertEquals(713, clockTime)
assertTrue(isDaytime)
assertFalse(isNightStalkerNight)
assertEquals(12, radiantScore)
assertEquals(24, direScore)
assertSame(MatchState.GameInProgress, matchState)
assertFalse(isPaused)
assertSame(Team.None, winningTeam)
Expand All @@ -75,6 +77,8 @@ internal class MapFactoryTest {
assertEquals(713, clockTime)
assertTrue(isDaytime)
assertFalse(isNightStalkerNight)
assertEquals(12, radiantScore)
assertEquals(24, direScore)
assertSame(MatchState.GameInProgress, matchState)
assertFalse(isPaused)
assertSame(Team.None, winningTeam)
Expand Down
2 changes: 2 additions & 0 deletions lib/src/test/resources/map_invalid.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"clock_time": 713,
"daytime": true,
"nightstalker_night": false,
"radiant_score": 12,
"dire_score": 24,
"game_state": "DOTA_GAMERULES_STATE_GAME_IN_PROGRESS",
"paused": false,
"win_team": "none",
Expand Down
2 changes: 2 additions & 0 deletions lib/src/test/resources/map_playing.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"clock_time": 713,
"daytime": true,
"nightstalker_night": false,
"radiant_score": 12,
"dire_score": 24,
"game_state": "DOTA_GAMERULES_STATE_GAME_IN_PROGRESS",
"paused": false,
"win_team": "none",
Expand Down
2 changes: 2 additions & 0 deletions lib/src/test/resources/map_spectating.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"clock_time": 713,
"daytime": true,
"nightstalker_night": false,
"radiant_score": 12,
"dire_score": 24,
"game_state": "DOTA_GAMERULES_STATE_GAME_IN_PROGRESS",
"paused": false,
"win_team": "none",
Expand Down

0 comments on commit e1233cb

Please sign in to comment.