Elin Decompiled Documentation EA 23.102 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 }
39
40 public override bool IsFailByCurse(Thing t)
41 {
42 if (t != null && t.blessedState <= BlessedState.Cursed)
43 {
44 Msg.Say("unequipCursed", t);
45 SE.Play("curse3");
46 return true;
47 }
48 return false;
49 }
50
51 public override void OnWriteNote(ButtonGrid button, UINote n)
52 {
53 if (button.card == null)
54 {
55 n.Clear();
57 n.AddText("noEQ".lang());
58 if (slot.elementId == 35)
59 {
60 Thing.AddAttackEvaluation(n, base.Chara);
61 }
62 }
63 else
64 {
65 base.OnWriteNote(button, n);
66 }
67 }
68}
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:34
BlessedState blessedState
Definition: Card.cs:262
Definition: EClass.cs:5
static Chara pc
Definition: EClass.cs:14
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:479
Card owner
Definition: InvOwner.cs:538
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:1373
Definition: Trait.cs:7
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