Elin Modding Docs Doc
Loading...
Searching...
No Matches
BaseCard.cs
1using System;
2using System.Collections.Generic;
3using Newtonsoft.Json;
4
5// Token: 0x02000288 RID: 648
6public class BaseCard : EClass
7{
8 // Token: 0x06001159 RID: 4441 RVA: 0x00077DE4 File Offset: 0x00075FE4
9 public bool GetBool(int id)
10 {
11 return this.GetInt(id, null) != 0;
12 }
13
14 // Token: 0x0600115A RID: 4442 RVA: 0x00077E04 File Offset: 0x00076004
15 public void SetBool(int id, bool enable)
16 {
17 this.SetInt(id, enable ? 1 : 0);
18 }
19
20 // Token: 0x0600115B RID: 4443 RVA: 0x00077E14 File Offset: 0x00076014
21 public int GetInt(int id, int? defaultInt = null)
22 {
23 int result;
24 if (this.mapInt.TryGetValue(id, out result))
25 {
26 return result;
27 }
28 return defaultInt.GetValueOrDefault();
29 }
30
31 // Token: 0x0600115C RID: 4444 RVA: 0x00077E3C File Offset: 0x0007603C
32 public void AddInt(int id, int value)
33 {
34 this.SetInt(id, this.GetInt(id, null) + value);
35 }
36
37 // Token: 0x0600115D RID: 4445 RVA: 0x00077E62 File Offset: 0x00076062
38 public void SetInt(int id, int value = 0)
39 {
40 if (value == 0)
41 {
42 if (this.mapInt.ContainsKey(id))
43 {
44 this.mapInt.Remove(id);
45 }
46 return;
47 }
48 this.mapInt[id] = value;
49 }
50
51 // Token: 0x0600115E RID: 4446 RVA: 0x00077E90 File Offset: 0x00076090
52 public string GetStr(int id, string defaultStr = null)
53 {
54 string result;
55 if (this.mapStr.TryGetValue(id, out result))
56 {
57 return result;
58 }
59 return defaultStr;
60 }
61
62 // Token: 0x0600115F RID: 4447 RVA: 0x00077EB0 File Offset: 0x000760B0
63 public void SetStr(int id, string value = null)
64 {
65 if (value.IsEmpty())
66 {
67 if (this.mapStr.ContainsKey(id))
68 {
69 this.mapStr.Remove(id);
70 }
71 return;
72 }
73 this.mapStr[id] = value;
74 }
75
76 // Token: 0x06001160 RID: 4448 RVA: 0x00077EE4 File Offset: 0x000760E4
77 public T GetObj<T>(int id)
78 {
79 if (this.mapObj == null)
80 {
81 return default(T);
82 }
83 object obj;
84 if (this.mapObj.TryGetValue(id, out obj) && obj is T)
85 {
86 return (T)((object)obj);
87 }
88 return default(T);
89 }
90
91 // Token: 0x06001161 RID: 4449 RVA: 0x00077F2C File Offset: 0x0007612C
92 public void SetObj(int id, object o)
93 {
94 if (this.mapObj == null)
95 {
96 this.mapObj = new Dictionary<int, object>();
97 }
98 if (o == null)
99 {
100 if (this.mapObj.ContainsKey(id))
101 {
102 this.mapObj.Remove(id);
103 }
104 return;
105 }
106 this.mapObj[id] = o;
107 }
108
109 // Token: 0x06001162 RID: 4450 RVA: 0x00077F78 File Offset: 0x00076178
110 public T SetObj<T>(int id, object o)
111 {
112 if (this.mapObj == null)
113 {
114 this.mapObj = new Dictionary<int, object>();
115 }
116 if (o == null)
117 {
118 if (this.mapStr.ContainsKey(id))
119 {
120 this.mapObj.Remove(id);
121 }
122 return default(T);
123 }
124 this.mapObj[id] = o;
125 return (T)((object)o);
126 }
127
128 // Token: 0x04000F48 RID: 3912
129 [JsonProperty(PropertyName = "X")]
130 public Dictionary<int, object> mapObj = new Dictionary<int, object>();
131
132 // Token: 0x04000F49 RID: 3913
133 [JsonProperty(PropertyName = "Y")]
134 public Dictionary<int, int> mapInt = new Dictionary<int, int>();
135
136 // Token: 0x04000F4A RID: 3914
137 [JsonProperty(PropertyName = "Z")]
138 public Dictionary<int, string> mapStr = new Dictionary<int, string>();
139}