get_decklist_from_code: Generate deck list from shareable deck code

View source: R/highlevel_functions.R

get_decklist_from_codeR Documentation

Generate deck list from shareable deck code

Description

Deck lists are stored and shared in an RFC 4648 base-32 code. This top-level function takes such an code and extracts the cards and their count according to the rules (laid out here)

Usage

get_decklist_from_code(code, format = "df")

Arguments

code

character deck code in base 32 (RFC 4648)

format

output format of deck list, can be either "df" or "simple"

Value

dataframe with cardcode, count, faction, set and card number (for format "df") or a character vector with format '{count}:{cardcode}' (for format "simple")

Examples

get_decklist_from_code(
"CEDACAIFDUAQEBAIAECAIBICAECDGNACAMCQIBQDAMCAKDISAIAQCBBWAIAQKEZPAIAQGBIMAMAQKAIZEE"
)

# returns (format: "df")
#    cardcode count faction set card_number
# 1   01SI029     3      SI   1         029
# 2   02PZ008     3      PZ   2         008
# 3   04PZ005     3      PZ   4         005
# 4   01PZ051     3      PZ   1         051
# 5   01PZ052     3      PZ   1         052
# 6   03SI004     3      SI   3         004
# 7   03SI006     3      SI   3         006
# 8   03PZ005     3      PZ   3         005
# 9   03PZ013     3      PZ   3         013
# 10  03PZ018     3      PZ   3         018
# 11  01PZ054     2      PZ   1         054
# 12  01SI019     2      SI   1         019
# 13  01SI047     2      SI   1         047
# 14  03SI012     1      SI   3         012
# 15  01SI001     1      SI   1         001
# 16  01SI025     1      SI   1         025
# 17  01SI033     1      SI   1         033
#
# returns(format: simple)
# c("3:01SI029", "3:02PZ008", "3:04PZ005", "3:01PZ051", "3:01PZ052",
#   "3:03SI004", "3:03SI006", "3:03PZ005", "3:03PZ013", "3:03PZ018",
#   "2:01PZ054", "2:01SI019", "2:01SI047", "1:03SI012", "1:01SI001",
#   "1:01SI025", "1:01SI033")



pholzmgit/lordecks documentation built on May 23, 2022, 11:03 a.m.