58 lines
1.3 KiB
C#
58 lines
1.3 KiB
C#
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 string encounter_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();
|
|
encounter_code = Get(element, "encounter_code");
|
|
}
|
|
|
|
private string Get(JsonElement element, string v)
|
|
{
|
|
if (element.TryGetProperty(v, out var p))
|
|
{
|
|
return p.GetString();
|
|
}
|
|
return "";
|
|
}
|
|
|
|
public bool IsPlayerCard
|
|
{
|
|
get
|
|
{
|
|
return encounter_code == "" &&
|
|
(type_code == "asset" || type_code == "event" || type_code == "skill");
|
|
}
|
|
}
|
|
}
|
|
}
|