Elin Decompiled Documentation EA 23.329 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 && t.blessedState <= BlessedState.Cursed)
44 {
45 Msg.Say("unequipCursed", t);
46 SE.Play("curse3");
47 return true;
48 }
49 return false;
50 }
51
52 public override void OnWriteNote(ButtonGrid button, UINote n)
53 {
54 if (button.card == null)
55 {
56 n.Clear();
58 n.AddText("noEQ".lang());
59 if (slot.elementId == 35)
60 {
61 Thing.AddAttackEvaluation(n, base.Chara);
62 }
63 }
64 else
65 {
66 base.OnWriteNote(button, n);
67 }
68 }
69}
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
BlessedState blessedState
Definition: Card.cs:281
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:1508
Definition: Trait.cs:7
virtual void OnListInteraction(InvOwner.ListInteraction list, ButtonGrid b, bool context)
Definition: Trait.cs:752
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