Elin Decompiled Documentation EA 23.102 Nightly
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Pages
BaseCard Class Reference
Inheritance diagram for BaseCard:
EClass Card Chara Thing

Public Member Functions

bool GetBool (int id)
 
void SetBool (int id, bool enable)
 
int GetInt (int id, int? defaultInt=null)
 
void AddInt (int id, int value)
 
void SetInt (int id, int value=0)
 
string GetStr (int id, string defaultStr=null)
 
void SetStr (int id, string value=null)
 
GetObj< T > (int id)
 
void SetObj (int id, object o)
 
SetObj< T > (int id, object o)
 

Public Attributes

Dictionary< int, object > mapObj = new Dictionary<int, object>()
 
Dictionary< int, int > mapInt = new Dictionary<int, int>()
 
Dictionary< int, string > mapStr = new Dictionary<int, string>()
 

Additional Inherited Members

- Static Public Member Functions inherited from EClass
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 
- Static Public Attributes inherited from EClass
static Core core
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Detailed Description

Definition at line 4 of file BaseCard.cs.

Member Function Documentation

◆ AddInt()

void BaseCard.AddInt ( int  id,
int  value 
)
inline

Definition at line 34 of file BaseCard.cs.

35 {
36 SetInt(id, GetInt(id) + value);
37 }
int GetInt(int id, int? defaultInt=null)
Definition: BaseCard.cs:25
void SetInt(int id, int value=0)
Definition: BaseCard.cs:39

References GetInt(), and SetInt().

◆ GetBool()

bool BaseCard.GetBool ( int  id)
inline

Definition at line 15 of file BaseCard.cs.

16 {
17 return GetInt(id) != 0;
18 }

References GetInt().

Referenced by TraitAltar._OnOffer(), ZoneEventHarvest.OnLeaveZone(), and ConSleep.Tick().

◆ GetInt()

◆ GetObj< T >()

T BaseCard.GetObj< T > ( int  id)
inline

Definition at line 78 of file BaseCard.cs.

79 {
80 if (mapObj == null)
81 {
82 return default(T);
83 }
84 if (mapObj.TryGetValue(id, out var value) && value is T)
85 {
86 return (T)value;
87 }
88 return default(T);
89 }
Dictionary< int, object > mapObj
Definition: BaseCard.cs:7

References mapObj.

◆ GetStr()

string BaseCard.GetStr ( int  id,
string  defaultStr = null 
)
inline

Definition at line 54 of file BaseCard.cs.

55 {
56 if (mapStr.TryGetValue(id, out var value))
57 {
58 return value;
59 }
60 return defaultStr;
61 }
Dictionary< int, string > mapStr
Definition: BaseCard.cs:13

References mapStr.

Referenced by SerializedCards.Add(), TraitBlueprint.CanStackTo(), TraitBook.CanStackTo(), TraitRecipe.CanStackTo(), TraitNewZone.CreateZone(), Thing.GetName(), WindowChara.RefreshStatic(), WindowChara.SetPortraitBG(), WindowChara.SetPortraitFrame(), and AI_Shopping.TryRestock().

◆ SetBool()

void BaseCard.SetBool ( int  id,
bool  enable 
)
inline

Definition at line 20 of file BaseCard.cs.

21 {
22 SetInt(id, enable ? 1 : 0);
23 }

References SetInt().

Referenced by Party.AddMemeber(), DramaOutcome.chara_hired(), and DramaOutcome.chara_hired_ticket().

◆ SetInt()

◆ SetObj()

void BaseCard.SetObj ( int  id,
object  o 
)
inline

Definition at line 91 of file BaseCard.cs.

92 {
93 if (mapObj == null)
94 {
95 mapObj = new Dictionary<int, object>();
96 }
97 if (o == null)
98 {
99 if (mapObj.ContainsKey(id))
100 {
101 mapObj.Remove(id);
102 }
103 }
104 else
105 {
106 mapObj[id] = o;
107 }
108 }

References mapObj.

Referenced by ListPeopleBuySlave.OnCreate(), and SerializedCards.Restore().

◆ SetObj< T >()

T BaseCard.SetObj< T > ( int  id,
object  o 
)
inline

Definition at line 110 of file BaseCard.cs.

111 {
112 if (mapObj == null)
113 {
114 mapObj = new Dictionary<int, object>();
115 }
116 if (o == null)
117 {
118 if (mapStr.ContainsKey(id))
119 {
120 mapObj.Remove(id);
121 }
122 return default(T);
123 }
124 mapObj[id] = o;
125 return (T)o;
126 }

References mapObj, and mapStr.

◆ SetStr()

void BaseCard.SetStr ( int  id,
string  value = null 
)
inline

Definition at line 63 of file BaseCard.cs.

64 {
65 if (value.IsEmpty())
66 {
67 if (mapStr.ContainsKey(id))
68 {
69 mapStr.Remove(id);
70 }
71 }
72 else
73 {
74 mapStr[id] = value;
75 }
76 }

References mapStr.

Referenced by GameDate.AdvanceDay(), AI_Shopping.Buy(), ThingGen.CreateLetter(), ThingGen.CreateRecipe(), Chara.MutateRandom(), TraitBook.OnCreate(), TraitRecipe.OnCreate(), TraitBook.OnImportMap(), TraitRadio.OnUse(), SerializedCards.Restore(), WindowChara.SetPortraitBG(), WindowChara.SetPortraitFrame(), and GameDate.ShipLetter().

Member Data Documentation

◆ mapInt

Dictionary<int, int> BaseCard.mapInt = new Dictionary<int, int>()

Definition at line 10 of file BaseCard.cs.

Referenced by Card.Duplicate(), GetInt(), and SetInt().

◆ mapObj

Dictionary<int, object> BaseCard.mapObj = new Dictionary<int, object>()

◆ mapStr

Dictionary<int, string> BaseCard.mapStr = new Dictionary<int, string>()

Definition at line 13 of file BaseCard.cs.

Referenced by Card.Duplicate(), GetStr(), SetObj< T >(), and SetStr().


The documentation for this class was generated from the following file: