https://github.com/exts/artifactdeckcodego
Artifact Card Game Deck Code based on the original api code written in PHP.
https://github.com/exts/artifactdeckcodego
api artifact card-game golang
Last synced: about 1 year ago
JSON representation
Artifact Card Game Deck Code based on the original api code written in PHP.
- Host: GitHub
- URL: https://github.com/exts/artifactdeckcodego
- Owner: exts
- License: unlicense
- Created: 2018-11-27T11:55:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-21T13:45:13.000Z (over 7 years ago)
- Last Synced: 2025-05-17T04:34:53.026Z (about 1 year ago)
- Topics: api, artifact, card-game, golang
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ArtifactDeckCodeGo
Artifact Card Game Deck Code Encoder & Decoder based on the [original api](https://github.com/ValveSoftware/ArtifactDeckCode) code written in PHP.
# Installation
`go get github.com/exts/ArtifactDeckCodeGo`
# Example Decode Usage
```go
// cardDeck returns a CardDeck struct reference
cardDeck, err := ArtifactDeckCodeGo.ParseDeck("ADCJQEAZX0ivAGABwA4XSXdAUEGQgEFAmIBRF0BDAkYAQUHAwEIBSQBMQFwASgBTw__")
if err != nil {
// handle error
}
// cardDeck.name => string
// cardDeck.heroes => []Card
// cardDeck.cards => []Card
```
# Example Encode Usage
Encoding takes a CardDeck struct reference and spits out a deck code string. So provide the CardDeck struct with a full 40 card deck + 9 items and then 5 heroes and **excluding** signature cards (hero cards) to get a proper deck code back.
```go
// starter deck
codeStr := "ADCJQEAZX0ivAGABwA4XSXdAUEGQgEFAmIBRF0BDAkYAQUHAwEIBSQBMQFwASgBTw__"
cardDeck, err := ArtifactDeckCodeGo.ParseDeck(codeStr)
if err != nil {
// handle error
}
deckCode, err := ArtifactDeckCodeGo.EncodeDeck(cardDeck)
if err != nil {
// handle error
}
println(codeStr == deckCode) // true
```
# Notes
- Use card database to cross reference hero card id's to get the missing hero signature cards (each hero has a certain number of additional cards paired with them)