This repository was archived by the owner on Feb 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathCardInfo.cs
More file actions
112 lines (86 loc) · 2.97 KB
/
CardInfo.cs
File metadata and controls
112 lines (86 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
using System.Linq;
using DevPro_CardManager.Enums;
using System;
using System.Collections.Generic;
using System.IO;
namespace DevPro_CardManager
{
public class CardInfos: ICloneable
{
public int source
{
get;
private set;
}
public CardInfos(IList<string> carddata, int cdbsource)
{
Id = Int32.Parse(carddata[0]);
Ot = Int32.Parse(carddata[1]);
AliasId = Int32.Parse(carddata[2]);
SetCode = Int64.Parse(carddata[3]);
Type = Int32.Parse(carddata[4]);
uint level = UInt32.Parse(carddata[5]);
Level = level & 0xff;
LScale = (level >> 24) & 0xff;
RScale = (level >> 16) & 0xff;
Race = Int32.Parse(carddata[6]);
Attribute = Int32.Parse(carddata[7]);
Atk = Int32.Parse(carddata[8]);
Def = Int32.Parse(carddata[9]);
Category = Int64.Parse(carddata[10]);
source = cdbsource;
}
public void SetCardText(string[] cardtext)
{
Name = cardtext[1];
Description = cardtext[2];
var effects = new List<string>();
for (var i = 3; i < cardtext.Length; i++)
{
if(cardtext[i] != "")
effects.Add(cardtext[i]);
}
EffectStrings = effects.ToArray();
}
public CardType[] GetCardTypes()
{
var typeArray = Enum.GetValues(typeof(CardType));
return typeArray.Cast<CardType>().Where(type => ((Type & (int) type) != 0)).ToArray();
}
public long[] GetCardSets(List<long> setArray)
{
var sets = new List<long> {setArray.IndexOf(SetCode & 0xffff), setArray.IndexOf(SetCode >> 0x10)};
return sets.ToArray();
}
public int GetLevelCode()
{
MemoryStream m_stream = new MemoryStream();
BinaryWriter m_writer = new BinaryWriter(m_stream);
m_writer.Write((byte)Level);
m_writer.Write((byte)0);
m_writer.Write((byte)RScale);
m_writer.Write((byte)LScale);
return BitConverter.ToInt32(m_stream.ToArray(), 0);
}
public object Clone()
{
return MemberwiseClone();
}
public int AliasId { get; set; }
public int Atk { get; set; }
public int Attribute { get; set; }
public int Def { get; set; }
public string Description { get; set; }
public int Id { get; set; }
public uint Level { get; set; }
public uint LScale { get; set; }
public uint RScale { get; set; }
public string Name = "";
public int Race { get; set; }
public int Type { get; set; }
public long Category { get; set; }
public int Ot { get; set; }
public string[] EffectStrings { get; set; }
public long SetCode { get; set; }
}
}