Elin Decompiled Documentation EA 23.336 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 owner.idSkin = Item.skin;
37 }
38
39 public override void OnSetOwner()
40 {
41 owner.idSkin = Item.skin;
42 }
43
44 public override void OnImportMap()
45 {
46 if (GetParam(1) != null)
47 {
48 owner.SetStr(53, GetParam(1));
49 }
50 owner.idSkin = Item.skin;
51 }
52
53 public override void SetName(ref string s)
54 {
55 s = (IsParchment ? "_parchment" : "_book").lang(s, Item.title);
56 }
57
58 public override void OnRead(Chara c)
59 {
60 if (owner.c_lockLv > 0)
61 {
62 owner.c_lockLv = 0;
63 c.Say("unseal", c, owner);
64 c.PlaySound("open_bottle");
65 if (owner.things.Count == 0)
66 {
67 c.Say("empty");
68 }
69 else
70 {
72 }
73 }
75 EClass.ui.AddLayer<LayerHelp>(IsParchment ? "LayerParchment" : "LayerBook").book.Show((IsParchment ? "Scroll/" : "Book/") + item.id, null, item.title, item);
76 }
77}
string id
Definition: BookList.cs:17
static Item GetRandomItem(string idCat="Book")
Definition: BookList.cs:89
static Item GetItem(string id, string idCat="Book")
Definition: BookList.cs:96
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6633
int c_lockLv
Definition: Card.cs:991
string GetStr(string id, string defaultStr=null)
Definition: Card.cs:2595
Point pos
Definition: Card.cs:60
void SetStr(string id, string value=null)
Definition: Card.cs:2600
ThingContainer things
Definition: Card.cs:39
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7311
Definition: Chara.cs:10
void PickOrDrop(Point p, string idThing, int idMat=-1, int num=1, bool msg=true)
Definition: Chara.cs:4545
Definition: EClass.cs:6
static Chara pc
Definition: EClass.cs:15
static UI ui
Definition: EClass.cs:17
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
override void SetName(ref string s)
Definition: TraitBook.cs:53
override void OnImportMap()
Definition: TraitBook.cs:44
override void OnRead(Chara c)
Definition: TraitBook.cs:58
bool IsParchment
Definition: TraitBook.cs:3
string IdItem
Definition: TraitBook.cs:5
virtual BookList.Item Item
Definition: TraitBook.cs:19
override void OnSetOwner()
Definition: TraitBook.cs:39
override bool CanStackTo(Thing to)
Definition: TraitBook.cs:21
string GetParam(int i, string def=null)
Definition: Trait.cs:587
Card owner
Definition: Trait.cs:28