sharedutils/utils/game/gameUtils.go

38 lines
914 B
Go
Raw Normal View History

2023-01-05 03:31:53 +00:00
package gameUtils
2022-10-27 18:05:45 +00:00
2023-01-05 03:31:53 +00:00
import gamesModels "git.gregbrzezinski.com/Skirda/skirdagoutils/models/games"
func FindGameByID(id string, list gamesModels.Games) gamesModels.SteamGame {
2022-10-27 20:31:39 +00:00
for _, game := range list.SteamGames {
if game.GameId == id {
return game
}
}
2023-01-05 03:31:53 +00:00
var temp gamesModels.SteamGame = gamesModels.SteamGame{}
2022-10-27 20:31:39 +00:00
return temp
}
2022-10-27 18:05:45 +00:00
// func findSteamGameByID(id string) SteamGame {
// for _, game := range localGames.St {
// if game.GameId == id {
// return game
// }
// }
// var game SteamGame = SteamGame{}
// return game
// }
2023-01-05 03:31:53 +00:00
func GetJSGameInterface(game gamesModels.SteamGame) gamesModels.JSGameInterface {
newInterface := gamesModels.JSGameInterface{
2022-10-27 18:05:45 +00:00
GameID: game.GameId,
Title: game.Assets.Title,
2022-10-28 15:23:04 +00:00
Icon: game.Assets.Icon,
2022-10-27 18:05:45 +00:00
Description: game.Assets.Description,
}
return newInterface
}
2022-11-03 20:12:26 +00:00
2023-01-05 03:31:53 +00:00
func ArgToStr(a gamesModels.Argument) string {
2022-11-03 20:12:26 +00:00
return a.Body + " " + a.Value
}