• Stars
    star
    276
  • Rank 143,886 (Top 3 %)
  • Language
    PHP
  • License
    BSD 3-Clause "New...
  • Created over 5 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Reference code and documentation for Artifact deck codes

ArtifactDeckCode

This repository consists of 2 files that will assist in the encoding and decoding of deck codes. These are source examples in PHP that can be used as is or as reference for porting to other languages. This README also contains an explanation of the card set API and corresponding json responses.

Contents

  • deck_encoder.php - the deck encoder used to convert deck info into a text code
  • deck_decoder.php - the deck decoder used to take a text code and return the deck info

About Deck Codes

Deck Codes are URL friendly base64 encoded strings that allow communication of deck contents. They will always begin with the characters ADC followed by the encoded string.

The Artifact Website supports viewing of decks via a URL of the form:

https://playartifact.com/d/<deck code >

We encourage people to encode and generate a URL for sharing as this URL will show deck previews on Twitter, Facebook, Steam and other applications which support Open Graph and oEmbed.

Example Deck Codes:

Green/Black Example

https://playartifact.com/d/ADCJWkTZX05uwGDCRV4XQGy3QGLmqUBg4GQJgGLGgO7AaABR3JlZW4vQmxhY2sgRXhhbXBsZQ__

Heroes:
1 Lycan
1 Rix
1 Phantom Assassin
1 Debbi the Cunning
1 Chen

Main Deck:
3 Pick Off
3 Payday
3 Steam Cannon
3 Mist of Avernus
3 Selemene's Favor
3 Iron Fog Goldmine
3 Untested Grunt
3 Thunderhide Pack
3 Revtel Convoy

Item Deck:
1 Apotheosis Blade
1 Horn of the Alpha
3 Poaching Knife
1 Red Mist Maul
1 Leather Armor
2 Traveler's Cloak

Blue/Red Example

https://playartifact.com/d/ADCJQUQI30zuwEYg2ABeF1Bu94BmWIBTEkLtAKlAZakAYmHh0JsdWUvUmVkIEV4YW1wbGU_

Heroes:
1 Keefe the Bold
1 Luna
1 Bristleback
1 Zeus
1 Earthshaker

Main Deck:
3 Time of Triumph
3 Ventriloquy
3 Cunning Plan
3 Tower Barrage
3 New Orders
3 Clear the Deck
3 Foresight
3 Conflagration
3 Red Mist Pillager
2 Routed

Item Deck:
1 Red Mist Maul
2 Blade of the Vigil
2 Phase Boots
2 Leather Armor
2 Traveler's Cloak

Usage

The specification for the deck is a series of nested arrays in the structure below:


array
  heroes (array, expected size 5 with 3 heroes on turn 1, 1 hero on 2 and 1 hero on 3 )
    0 - (array)
      id - int
      turn - int
    ...

  cards (array)
    0 - (array)
      id - int
      count - int
    ...

  name - (string, will be clamped to 63 bytes)

Card Set API

If you're making a site that needs to show card information such as card images, names, and card text, you will need to do a 2 stage request to our servers. The first request is to request the information for the set. Current supported sets are 00 and 01. You will need both to get all currently available cards.

First, make a request to the url of the form below where setid is 00 or 01. You will receive a response similar to the one below.

https://playartifact.com/cardset/<setid>/

{
  "cdn_root": "https:\/\/<some host>\/",
  "url": "\/<some path>\/somefile.json",
  "expire_time": <unix timestamp>
}

After receiving the response, you must then request the JSON file from the host specified. In this example, "https://some host/some path/somefile.json". Please cache the provided JSON for AT LEAST until the expire time provided.

The response will look similar to the one below for set 00

{
  "card_set": {
    "version": 1,
    "set_info": {
      "set_id": 0,
      "pack_item_def": 0,
      "name": {
        "english": "Base Set"
      }
    },
    "card_list": [{

      "card_id": 4000,
      "base_card_id": 4000,
      "card_type": "Hero",
      "card_name": {
        "english": "Farvhan the Dreamer"
      },
      "card_text": {
        "english": "Pack Leadership<BR>\nFarvhan the Dreamer's allied neighbors have +1 Armor."
      },
      "mini_image": {
        "default": "<url to png>"
      },
      "large_image": {
        "default": "<url to png>"
      },
      "ingame_image": {
        "default": "<url to png>"
      },
      "is_green": true,
      "attack": 4,
      "hit_points": 10,
      "references": [{
          "card_id": 4002,
          "ref_type": "includes",
          "count": 3
        },
        {
          "card_id": 4001,
          "ref_type": "passive_ability"
        }
      ]


    },
    ..... more cards ....

    ]
  }
}

Some notes about the json format

  • Text fields (card_name, card_text and the name on set_info) will contain english and additional languages.
  • Image fields (mini-image, large-image, ingame-image) provide a default image and keys for each supported language.
  • ref_type indicates a type of card reference:
    • "includes" - indicates a secondary card which will be automatically included into decks when the card is added. These should NOT be sent to the deck encoder. The ref_type block will include the total count of these cards that will be added.
    • "references" - indicates that the card text mentions the specified card.
    • "passive_ability" - a passive ability
    • "active_ability" - an ability which is activated by clicking on it.

More Repositories

1

Proton

Compatibility tool for Steam Play based on Wine and additional components
C++
22,477
star
2

GameNetworkingSockets

Reliable & unreliable messages over UDP. Robust message fragmentation & reassembly. P2P networking / NAT traversal. Encryption.
C++
7,681
star
3

openvr

OpenVR SDK
C++
5,946
star
4

steam-for-linux

Issue tracking for the Steam for Linux beta client
4,034
star
5

source-sdk-2013

The 2013 edition of the Source SDK
C++
3,591
star
6

halflife

Half-Life 1 engine based games
C++
2,971
star
7

steam-audio

Steam Audio
C++
2,055
star
8

ToGL

Direct3D to OpenGL abstraction layer
C++
2,009
star
9

SteamOS

SteamOS community tracker
1,465
star
10

vogl

OpenGL capture / playback debugger.
C++
1,415
star
11

Dota2-Gameplay

Public Bug Tracker for Dota2
1,388
star
12

steam-runtime

A runtime environment for Steam applications
Shell
1,133
star
13

wine

Wine with a bit of extra spice
C
1,093
star
14

steamvr_unity_plugin

SteamVR Unity Plugin - Documentation at: https://valvesoftware.github.io/steamvr_unity_plugin/
C#
1,010
star
15

SteamVR-for-Linux

Issue tracker for the Linux port of SteamVR
901
star
16

csgo-osx-linux

Counter-Strike: Global Offensive
750
star
17

Source-1-Games

Source 1 based games such as TF2 and Counter-Strike: Source
572
star
18

Fossilize

A serialization format for various persistent Vulkan object types.
C++
510
star
19

IndexHardware

474
star
20

csgo-demoinfo

CS:GO demo parsing tool
C++
472
star
21

Dota-2

Tracker for issues specific to Linux and Mac in the Reborn client. If you have a general issue or non-system-specific feature request please go to dev.dota2.com
454
star
22

steamlink-sdk

450
star
23

counter-strike

CS:GO
JavaScript
430
star
24

steamos_kernel

SteamOS kernel branches
C
388
star
25

dxvk

dxvk tree containing branches used by Proton
C++
342
star
26

unity-xr-plugin

OpenVR plugin for Unity's XR API
C#
298
star
27

the_lab_renderer

Valve’s VR renderer used in The Lab (Valve’s VR launch title for the HTC Vive).
C#
272
star
28

voglperf

Benchmarking tool for Linux OpenGL games. Spews frame information, logs frametimes.
C
198
star
29

steamvr_unreal_plugin

SteamVR Input Unreal Plugin - Documentation at: https://github.com/ValveSoftware/steamvr_unreal_plugin/wiki Sample project (UE4.15-4.23): https://github.com/ValveSoftware/steamvr_unreal_plugin/wiki/sample/SteamVRInputPlugin.zip Sample Project (UE.424+): https://github.com/ValveSoftware/steamvr_unreal_plugin/wiki/sample/SteamVRInputPlugin_UEIntegrated.7z
C++
164
star
30

steamos_mesa

Patched branches of Mesa used in SteamOS
C
157
star
31

Moondust

C#
155
star
32

portal2

Issues for the Linux port of Portal 2
136
star
33

steamworks-vr-api

Source for the Steamworks VR API
136
star
34

steam-devices

List of devices Steam and SteamVR will want read/write permissions on, to help downstream distributions create udev rules/etc
128
star
35

vkd3d

C
120
star
36

steamos-compositor

SteamOS session compositing window manager
C
109
star
37

driver_hydra

OpenVR Driver for Razer Hydra using Sixense SDK
C++
99
star
38

Dota-2-Vulkan

Tracker for issues specific to the Vulkan version of Dota 2 on Windows, Linux, and macOS
93
star
39

virtual_display

An example OpenVR driver for demonstrating the IVRVirtualDisplay interface.
C++
80
star
40

openxr_engine_plugins

Contains Valve-provided plugins for using OpenXR extensions with various game engines
Mathematica
46
star
41

linux

SteamOS fork of the Debian kernel packaging repository at https://anonscm.debian.org/git/kernel/linux.git/
45
star
42

eigen

Fork of Eigen release version 3.4. Adds ability to use alternate threading systems from Open MP.
C++
22
star
43

Dota-Underlords

Tracker for issues specific to the Linux and macOS client of Dota Underlords
22
star
44

OpenXR-Canonical-Pose-Tool

A tool to help OpenXR runtime developers match their poses to other runtimes' poses.
C
10
star
45

VR-Community-Bugs

Repository for VR Bugs reported through tickets and community outreach
9
star