Elin Modding Docs Doc
Loading...
Searching...
No Matches
HotItemEQSet.cs
1using System;
2using System.Collections.Generic;
3using Newtonsoft.Json;
4
5// Token: 0x02000614 RID: 1556
6public class HotItemEQSet : HotAction
7{
8 // Token: 0x17000C6E RID: 3182
9 // (get) Token: 0x06002B49 RID: 11081 RVA: 0x000F3695 File Offset: 0x000F1895
10 public override string Id
11 {
12 get
13 {
14 return "EQSet";
15 }
16 }
17
18 // Token: 0x17000C6F RID: 3183
19 // (get) Token: 0x06002B4A RID: 11082 RVA: 0x000F369C File Offset: 0x000F189C
20 public override bool CanChangeIconColor
21 {
22 get
23 {
24 return true;
25 }
26 }
27
28 // Token: 0x17000C70 RID: 3184
29 // (get) Token: 0x06002B4B RID: 11083 RVA: 0x000F36A0 File Offset: 0x000F18A0
30 public override string TextTip
31 {
32 get
33 {
34 string text = this.text.IsEmpty("EQSet".lang()) + base.TextHotkey() + Environment.NewLine;
35 using (List<int>.Enumerator enumerator = this.ids.GetEnumerator())
36 {
37 while (enumerator.MoveNext())
38 {
39 int i = enumerator.Current;
40 Thing thing = EClass.pc.things.Find((Thing t) => t.uid == i, true);
41 text += ((thing == null) ? "missingEQ".lang() : thing.Name);
42 text += Environment.NewLine;
43 }
44 }
45 return text.TrimEnd(Environment.NewLine.ToCharArray());
46 }
47 }
48
49 // Token: 0x06002B4C RID: 11084 RVA: 0x000F3774 File Offset: 0x000F1974
50 public HotItemEQSet Register()
51 {
52 this.ids.Clear();
53 foreach (BodySlot bodySlot in EClass.pc.body.slots)
54 {
55 if (bodySlot.elementId != 44 && bodySlot.thing != null)
56 {
57 this.ids.Add(bodySlot.thing.uid);
58 }
59 }
60 SE.Equip();
61 return this;
62 }
63
64 // Token: 0x06002B4D RID: 11085 RVA: 0x000F3804 File Offset: 0x000F1A04
65 public override void Perform()
66 {
67 for (int j = 0; j < 2; j++)
68 {
69 Dictionary<int, Thing> dictionary = new Dictionary<int, Thing>();
70 foreach (BodySlot bodySlot in EClass.pc.body.slots)
71 {
72 if (bodySlot.elementId != 44 && bodySlot.thing != null && bodySlot.thing.blessedState >= BlessedState.Normal)
73 {
74 dictionary.Add(bodySlot.thing.c_equippedSlot - 1, bodySlot.thing);
75 EClass.pc.body.Unequip(bodySlot.thing, true);
76 }
77 }
78 Card card = null;
79 using (List<int>.Enumerator enumerator2 = this.ids.GetEnumerator())
80 {
81 while (enumerator2.MoveNext())
82 {
83 int i = enumerator2.Current;
84 Thing thing = EClass.pc.things.Find((Thing t) => t.uid == i && !t.isEquipped, true);
85 if (thing != null)
86 {
87 BodySlot slot = EClass.pc.body.GetSlot(thing, true, false);
88 if (slot != null && thing != slot.thing)
89 {
90 Card parentCard = thing.parentCard;
91 int invX = thing.invX;
92 int invY = thing.invY;
93 EClass.pc.body.Equip(thing, slot, false);
94 if (dictionary.ContainsKey(slot.index))
95 {
96 Thing thing2 = dictionary[slot.index];
97 if (thing2.uid != thing.uid)
98 {
99 parentCard.AddThing(thing2, true, -1, -1);
100 card = parentCard;
101 thing2.invX = invX;
102 thing2.invY = invY;
103 dictionary.Remove(slot.index);
104 }
105 }
106 }
107 }
108 }
109 }
110 if (card != null)
111 {
112 foreach (Thing thing3 in dictionary.Values)
113 {
114 if (!thing3.isEquipped && !card.things.IsFull(thing3, true, true))
115 {
116 card.AddThing(thing3, true, -1, -1);
117 }
118 }
119 }
120 }
121 SE.Equip();
122 }
123
124 // Token: 0x06002B4E RID: 11086 RVA: 0x000F3A88 File Offset: 0x000F1C88
125 public override void OnShowContextMenu(UIContextMenu m)
126 {
127 base.OnShowContextMenu(m);
128 m.AddButton("updateEQ", delegate()
129 {
130 this.Register();
131 }, true);
132 }
133
134 // Token: 0x04001834 RID: 6196
135 [JsonProperty]
136 public List<int> ids = new List<int>();
137
138 // Token: 0x02000B7D RID: 2941
139 public class Item
140 {
141 // Token: 0x04002E45 RID: 11845
142 public Card container;
143
144 // Token: 0x04002E46 RID: 11846
145 public int invX;
146
147 // Token: 0x04002E47 RID: 11847
148 public int invY;
149 }
150}
Definition Card.cs:13
Definition Thing.cs:10