Initial commit. Load list of cards via config (packs or single cards).
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ArkhamPnP.Data
|
||||
{
|
||||
internal class Card
|
||||
{
|
||||
public string id;
|
||||
public string pack_code;
|
||||
public string pack_name;
|
||||
public string text;
|
||||
public string real_text;
|
||||
public string image_src;
|
||||
public string back_image_src;
|
||||
public string type_code;
|
||||
|
||||
public Card()
|
||||
{
|
||||
}
|
||||
|
||||
public Card(JsonElement element)
|
||||
{
|
||||
this.id = element.GetProperty("code").GetString();
|
||||
pack_code = element.GetProperty("pack_code").GetString();
|
||||
pack_name = element.GetProperty("pack_name").GetString();
|
||||
text = Get(element, "text");
|
||||
real_text = Get(element, "real_text");
|
||||
image_src = element.GetProperty("imagesrc").GetString();
|
||||
back_image_src = Get(element, "backimagesrc");
|
||||
type_code = element.GetProperty("type_code").GetString();
|
||||
}
|
||||
|
||||
private string Get(JsonElement element, string v)
|
||||
{
|
||||
if (element.TryGetProperty(v, out var p))
|
||||
{
|
||||
return p.GetString();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public bool IsPlayerCard
|
||||
{
|
||||
get
|
||||
{
|
||||
return type_code == "asset" || type_code == "event" || type_code == "skill";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user