diff --git a/card.gd b/card.gd index df3e7ab..d423f15 100644 --- a/card.gd +++ b/card.gd @@ -17,7 +17,7 @@ func _card_error(error_type: String) -> String: return "ERROR::CARD::%s::%s::%s::\n" % [card_id, card_name, error_type] -func init(id) -> void: +func _init(id) -> void: card_id = id diff --git a/deck_input.gd b/deck_input.gd new file mode 100644 index 0000000..48a770d --- /dev/null +++ b/deck_input.gd @@ -0,0 +1,17 @@ +extends Node + + +func convert_mtgo_to_http(decklist: String) -> Dictionary: + var links = {} + var lines = decklist.split("\n") + for line in lines: + var words = line.split(" ", false, 1) + if words.size() != 2: + continue + + words[1] = words[1].replace(" ", "+") + links["https://api.scryfall.com/cards/named?exact=" + words[1]] = words[0] + return links + +func _ready() -> void: + pass diff --git a/deck_input.gd.uid b/deck_input.gd.uid new file mode 100644 index 0000000..faadb79 --- /dev/null +++ b/deck_input.gd.uid @@ -0,0 +1 @@ +uid://c0vxigp5y302o diff --git a/tabletop.gd b/tabletop.gd index cb9dde7..c19b0c0 100644 --- a/tabletop.gd +++ b/tabletop.gd @@ -1,6 +1,7 @@ extends Node2D var player_class = preload("res://player.gd") +var deck_input = preload("res://deck_input.gd") # Called when the node enters the scene tree for the first time. @@ -10,6 +11,10 @@ func _ready() -> void: var player = player_class.new() add_child(player) move_child(player, 0) + + var deck = deck_input.new() + add_child(deck) + pass # Replace with function body.