Elin Decompiled Documentation EA 23.343.5 Nightly
Loading...
Searching...
No Matches
InvOwnerEquip.cs
Go to the documentation of this file.
1public class InvOwnerEquip : InvOwner
2{
3 public BodySlot slot;
4
5 public override bool AlwaysShowTooltip => true;
6
7 public override bool ShowNew => true;
8
9 public override bool AllowDrop(Thing t)
10 {
11 return t.blessedState >= BlessedState.Normal;
12 }
13
14 public InvOwnerEquip(Card owner, BodySlot slot, Card container = null, CurrencyType _currency = CurrencyType.None)
15 : base(owner, container, _currency)
16 {
17 this.slot = slot;
18 }
19
20 public override void ListInteractions(ListInteraction list, Thing t, Trait trait, ButtonGrid b, bool context)
21 {
22 list.Add("actUnequip", 0, delegate
23 {
24 if (!IsFailByCurse(t))
25 {
26 if (EClass.pc.things.IsFull())
27 {
28 Msg.Say("backpack_full");
29 SE.BeepSmall();
30 }
31 else
32 {
33 EClass.pc.body.Unequip(t);
34 EClass.Sound.Play("equip");
35 }
36 }
37 });
38 trait.OnListInteraction(list, b, context);
39 }
40
41 public override bool IsFailByCurse(Thing t)
42 {
43 if (t != null)
44 {
45 if (t.blessedState <= BlessedState.Cursed)
46 {
47 Msg.Say("unequipCursed", t);
48 SE.Play("curse3");
49 return true;
50 }
51 if (t.c_DNA != null && t.GetBool(135))
52 {
53 Msg.Say("isSleepLock", t);
54 SE.Play("curse3");
55 return true;
56 }
57 }
58 return false;
59 }
60
61 public override void OnWriteNote(ButtonGrid button, UINote n)
62 {
63 if (button.card == null)
64 {
65 n.Clear();
67 n.AddText("noEQ".lang());
68 if (slot.elementId == 35)
69 {
70 Thing.AddAttackEvaluation(n, base.Chara);
71 }
72 }
73 else
74 {
75 base.OnWriteNote(button, n);
76 }
77 }
78}
BlessedState
Definition: BlessedState.cs:2
CurrencyType
Definition: CurrencyType.cs:2
string name
Definition: BodySlot.cs:14
int elementId
Definition: BodySlot.cs:6
Card card
Definition: ButtonGrid.cs:24
Definition: Card.cs:11
ThingContainer things
Definition: Card.cs:39
bool GetBool(string id)
Definition: Card.cs:2557
BlessedState blessedState
Definition: Card.cs:281
DNA c_DNA
Definition: Card.cs:1933
Definition: EClass.cs:6
static Chara pc
Definition: EClass.cs:15
override void ListInteractions(ListInteraction list, Thing t, Trait trait, ButtonGrid b, bool context)
BodySlot slot
Definition: InvOwnerEquip.cs:3
override bool IsFailByCurse(Thing t)
override void OnWriteNote(ButtonGrid button, UINote n)
override bool AlwaysShowTooltip
Definition: InvOwnerEquip.cs:5
override bool AllowDrop(Thing t)
Definition: InvOwnerEquip.cs:9
override bool ShowNew
Definition: InvOwnerEquip.cs:7
InvOwnerEquip(Card owner, BodySlot slot, Card container=null, CurrencyType _currency=CurrencyType.None)
Interaction Add(string s, int priority, Action action, string idPriority=null)
Definition: InvOwner.cs:474
Card owner
Definition: InvOwner.cs:533
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
bool IsFull(int y=0)
Definition: Thing.cs:8
static void AddAttackEvaluation(UINote n, Chara chara, Thing current=null)
Definition: Thing.cs:1525
Definition: Trait.cs:7
virtual void OnListInteraction(InvOwner.ListInteraction list, ButtonGrid b, bool context)
Definition: Trait.cs:754
Definition: UINote.cs:6
void Clear()
Definition: UINote.cs:35
UIItem AddHeader(string text, Sprite sprite=null)
Definition: UINote.cs:79
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Definition: UINote.cs:113