Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package `in`.dragonbra.javasteam.steam.handlers.steamfriends

/**
* Represents clan-related data for a friend.
*
* @property oggAppId The app ID associated with the clan.
* @property chatGroupID The chat group ID for the clan.
*/
data class ClanData(val oggAppId: Int, val chatGroupID: Long)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package `in`.dragonbra.javasteam.steam.handlers.steamfriends

/**
* Represents a key-value pair, typically used for rich presence data.
*
* @property key The key identifier.
* @property value The value associated with the key.
*/
data class KV(val key: String, val value: String)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package `in`.dragonbra.javasteam.steam.handlers.steamfriends

/**
* Represents game data for other games a user is playing or has played.
*
* @property gameId The game ID.
* @property richPresence The list of rich presence key-value pairs for the game.
*/
data class OtherGameData(val gameId: Long, val richPresence: List<KV>)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import `in`.dragonbra.javasteam.enums.EClientPersonaStateFlag
import `in`.dragonbra.javasteam.enums.EPersonaState
import `in`.dragonbra.javasteam.enums.EPersonaStateFlag
import `in`.dragonbra.javasteam.protobufs.steamclient.SteammessagesClientserverFriends.CMsgClientPersonaState
import `in`.dragonbra.javasteam.steam.handlers.steamfriends.ClanData
import `in`.dragonbra.javasteam.steam.handlers.steamfriends.KV
import `in`.dragonbra.javasteam.steam.handlers.steamfriends.OtherGameData
import `in`.dragonbra.javasteam.steam.steamclient.callbackmgr.CallbackMsg
import `in`.dragonbra.javasteam.types.GameID
import `in`.dragonbra.javasteam.types.SteamID
Expand All @@ -26,44 +29,52 @@ class PersonaStateCallback(
val statusFlags: EnumSet<EClientPersonaStateFlag> = statusFlags

/**
* Gets the friend's [SteamID]
* Gets the friend's [SteamID].
*/
val friendID: SteamID = SteamID(friend.friendid)
val friendId: SteamID = SteamID(friend.friendid)

/**
* Gets the state.
* Gets the persona state.
*/
val state: EPersonaState = EPersonaState.from(friend.personaState) ?: EPersonaState.Offline
@get:JvmName("getState")
val personaState: EPersonaState = EPersonaState.from(friend.personaState) ?: EPersonaState.Offline

/**
* Gets the state flags.
* Gets the game app ID being played.
*/
val stateFlags: EnumSet<EPersonaStateFlag> = EPersonaStateFlag.from(friend.personaStateFlags)
@get:JvmName("getGameAppID")
val gamePlayedAppId: Int = friend.gamePlayedAppId

/**
* Gets the game app ID.
* Gets the game server IP address.
*/
val gameAppID: Int = friend.gamePlayedAppId
val gameServerIp: InetAddress = NetHelpers.getIPAddress(friend.gameServerIp)

/**
* Gets the game ID.
* Gets the game server port.
*/
val gameID: GameID = GameID(friend.gameid)
val gameServerPort: Int = friend.gameServerPort

/**
* Gets the name of the game.
* Gets the persona state flags.
*/
val gameName: String = friend.gameName
val personaStateFlags: EnumSet<EPersonaStateFlag> = EPersonaStateFlag.from(friend.personaStateFlags)

/**
* Gets the game server IP.
* Gets the number of online session instances.
*/
val gameServerIP: InetAddress = NetHelpers.getIPAddress(friend.gameServerIp)
val onlineSessionInstances: Int = friend.onlineSessionInstances

/**
* Gets the game server port.
* Gets whether the persona was set by the user.
*/
val gameServerPort: Int = friend.gameServerPort
val personaSetByUser: Boolean = friend.personaSetByUser

/**
* Gets the player name.
*/
@get:JvmName("getName")
val playerName: String = friend.playerName

/**
* Gets the query port.
Expand All @@ -73,45 +84,125 @@ class PersonaStateCallback(
/**
* Gets the source [SteamID].
*/
val sourceSteamID: SteamID = SteamID(friend.steamidSource)
val steamIdSource: SteamID = SteamID(friend.steamidSource)

/**
* Gets the game data blob.
* Gets the avatar hash.
*/
val gameDataBlob: ByteArray = friend.gameDataBlob.toByteArray()
val avatarHash: ByteArray = friend.avatarHash.toByteArray()

/**
* Gets the name.
* Gets the last logoff time.
*/
val name: String = friend.playerName
val lastLogoff: Date = Date(friend.lastLogoff * 1000L)

/**
* Gets the avatar hash.
* Gets the last logon time.
*/
val avatarHash: ByteArray = friend.avatarHash.toByteArray()
val lastLogon: Date = Date(friend.lastLogon * 1000L)

/**
* Gets the last seen online time.
*/
val lastSeenOnline: Date = Date(friend.lastSeenOnline * 1000L)

/**
* Gets the last log off.
* Gets the clan rank.
*/
val lastLogOff: Date = Date(friend.lastLogoff * 1000L)
val clanRank: Int = friend.clanRank

/**
* Gets the last log on.
* Gets the name of the game.
*/
val lastLogOn: Date = Date(friend.lastLogon * 1000L)
val gameName: String = friend.gameName

/**
* Gets the clan rank.
* Gets the game ID.
*/
val clanRank: Int = friend.clanRank
val gameId: GameID = GameID(friend.gameid)

/**
* Gets the game data blob.
*/
val gameDataBlob: ByteArray = friend.gameDataBlob.toByteArray()

/**
* Gets the clan data.
*/
val clanData: ClanData = ClanData(friend.clanData.oggAppId, friend.clanData.chatGroupId)

/**
* Gets the clan tag.
*/
val clanTag: String = friend.clanTag

/**
* Gets the online session instance.
* Gets the rich presence key-value pairs.
*/
val onlineSessionInstances: Int = friend.onlineSessionInstances
val richPresence: List<KV> = friend.richPresenceList.map { KV(key = it.key, value = it.value) }

/**
* Gets the broadcast ID.
*/
val broadcastId: Long = friend.broadcastId

/**
* Gets the game lobby ID.
*/
val gameLobbyId: Long = friend.gameLobbyId

/**
* Gets the account ID of the broadcast being watched.
*/
val watchingBroadcastAccountId: Int = friend.watchingBroadcastAccountid

/**
* Gets the app ID of the broadcast being watched.
*/
val watchingBroadcastAppId: Int = friend.watchingBroadcastAppid

/**
* Gets the number of viewers watching the broadcast.
*/
val watchingBroadcastViewers: Int = friend.watchingBroadcastViewers

/**
* Gets the title of the broadcast being watched.
*/
val watchingBroadcastTitle: String = friend.watchingBroadcastTitle

/**
* Gets whether the user is community banned.
*/
val isCommunityBanned: Boolean = friend.isCommunityBanned

/**
* Gets whether the player name is pending review.
*/
val playerNamePendingReview: Boolean = friend.playerNamePendingReview

/**
* Gets whether the avatar is pending review.
*/
val avatarPendingReview: Boolean = friend.avatarPendingReview

/**
* Gets whether the user is on Steam Deck.
*/
val onSteamDeck: Boolean = friend.onSteamDeck

/**
* Gets the other game data.
*/
val otherGameData: List<OtherGameData> = friend.otherGameDataList.map { gameData ->
OtherGameData(
gameId = gameData.gameid,
richPresence = gameData.richPresenceList.map { KV(key = it.key, value = it.value) }
)
}

/**
* Gets the gaming device type.
*/
val gamingDeviceType: Int = friend.gamingDeviceType
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ message CMsgClientPersonaState {
optional bool avatar_pending_review = 80;
optional bool on_steam_deck = 81;
repeated .CMsgClientPersonaState.Friend.OtherGameData other_game_data = 82;
optional uint32 gaming_device_type = 83;
}

optional uint32 status_flags = 1;
Expand Down