Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
TraitBook.cs
Go to the documentation of this file.
1public class TraitBook : TraitScroll
2{
3 public bool IsParchment => this is TraitParchment;
4
5 public string IdItem => owner.GetStr(53);
6
7 public string IdCat
8 {
9 get
10 {
11 if (!IsParchment)
12 {
13 return "Book";
14 }
15 return "Scroll";
16 }
17 }
18
20
21 public override bool CanStackTo(Thing to)
22 {
23 return to.GetStr(53) == IdItem;
24 }
25
26 public override void OnCreate(int lv)
27 {
28 if (GetParam(1) != null)
29 {
30 owner.SetStr(53, GetParam(1));
31 }
32 else if (IdItem.IsEmpty())
33 {
35 }
36 }
37
38 public override void OnImportMap()
39 {
40 if (GetParam(1) != null)
41 {
42 owner.SetStr(53, GetParam(1));
43 }
44 }
45
46 public override void SetName(ref string s)
47 {
48 s = (IsParchment ? "_parchment" : "_book").lang(s, Item.title);
49 }
50
51 public override void OnRead(Chara c)
52 {
54 EClass.ui.AddLayer<LayerHelp>(IsParchment ? "LayerParchment" : "LayerBook").book.Show((IsParchment ? "Scroll/" : "Book/") + item.id, null, item.title, item);
55 }
56}
void SetStr(int id, string value=null)
Definition: BaseCard.cs:63
string GetStr(int id, string defaultStr=null)
Definition: BaseCard.cs:54
string id
Definition: BookList.cs:13
static Item GetRandomItem(string idCat="Book")
Definition: BookList.cs:51
static Item GetItem(string id, string idCat="Book")
Definition: BookList.cs:57
Definition: Chara.cs:10
Definition: EClass.cs:5
static UI ui
Definition: EClass.cs:16
Layer AddLayer(string id)
Definition: Layer.cs:337
Definition: Thing.cs:8
override void OnCreate(int lv)
Definition: TraitBook.cs:26
string IdCat
Definition: TraitBook.cs:8
BookList.Item Item
Definition: TraitBook.cs:19
override void SetName(ref string s)
Definition: TraitBook.cs:46
override void OnImportMap()
Definition: TraitBook.cs:38
override void OnRead(Chara c)
Definition: TraitBook.cs:51
bool IsParchment
Definition: TraitBook.cs:3
string IdItem
Definition: TraitBook.cs:5
override bool CanStackTo(Thing to)
Definition: TraitBook.cs:21
string GetParam(int i, string def=null)
Definition: Trait.cs:515
Card owner
Definition: Trait.cs:26