Elin Decompiled Documentation
EA 23.102 Nightly
Loading...
Searching...
No Matches
HotItemEQSet.cs
Go to the documentation of this file.
1
using
System;
2
using
System.Collections.Generic;
3
using
Newtonsoft.Json;
4
5
public
class
HotItemEQSet
:
HotAction
6
{
7
public
class
Item
8
{
9
public
Card
container
;
10
11
public
int
invX
;
12
13
public
int
invY
;
14
}
15
16
[JsonProperty]
17
public
List<int>
ids
=
new
List<int>();
18
19
public
override
string
Id
=>
"EQSet"
;
20
21
public
override
bool
CanChangeIconColor
=>
true
;
22
23
public
override
string
TextTip
24
{
25
get
26
{
27
string
text
= base.text.IsEmpty(
"EQSet"
.lang()) +
TextHotkey
() + Environment.NewLine;
28
foreach
(
int
i
in
ids
)
29
{
30
Thing
thing =
EClass
.
pc
.
things
.
Find
((
Thing
t) => t.
uid
== i);
31
text
+= ((thing ==
null
) ?
"missingEQ"
.lang() : thing.
Name
);
32
text
+= Environment.NewLine;
33
}
34
return
text
.TrimEnd(Environment.NewLine.ToCharArray());
35
}
36
}
37
38
public
HotItemEQSet
Register
()
39
{
40
ids
.Clear();
41
foreach
(
BodySlot
slot
in
EClass
.
pc
.
body
.
slots
)
42
{
43
if
(slot.
elementId
!= 44 && slot.
thing
!=
null
)
44
{
45
ids
.Add(slot.
thing
.
uid
);
46
}
47
}
48
SE.Equip();
49
return
this
;
50
}
51
52
public
override
void
Perform
()
53
{
54
for
(
int
j = 0; j < 2; j++)
55
{
56
Dictionary<int, Thing> dictionary =
new
Dictionary<int, Thing>();
57
foreach
(
BodySlot
slot2
in
EClass
.
pc
.
body
.
slots
)
58
{
59
if
(slot2.
elementId
!= 44 && slot2.
thing
!=
null
&& slot2.
thing
.
blessedState
>=
BlessedState
.Normal)
60
{
61
dictionary.Add(slot2.
thing
.
c_equippedSlot
- 1, slot2.
thing
);
62
EClass
.
pc
.
body
.
Unequip
(slot2.
thing
, refresh:
false
);
63
}
64
}
65
Card
card
=
null
;
66
foreach
(
int
i
in
ids
)
67
{
68
Thing
thing =
EClass
.
pc
.
things
.
Find
((
Thing
t) => t.
uid
== i && !t.
isEquipped
);
69
if
(thing ==
null
)
70
{
71
continue
;
72
}
73
BodySlot
slot =
EClass
.
pc
.
body
.
GetSlot
(thing, onlyEmpty:
true
);
74
if
(slot ==
null
|| thing == slot.
thing
)
75
{
76
continue
;
77
}
78
Card
parentCard = thing.
parentCard
;
79
int
invX = thing.
invX
;
80
int
invY = thing.
invY
;
81
EClass
.
pc
.
body
.
Equip
(thing, slot, msg:
false
);
82
if
(dictionary.ContainsKey(slot.
index
))
83
{
84
Thing
thing2 = dictionary[slot.
index
];
85
if
(thing2.
uid
!= thing.
uid
)
86
{
87
parentCard.
AddThing
(thing2);
88
card
= parentCard;
89
thing2.invX = invX;
90
thing2.invY = invY;
91
dictionary.Remove(slot.
index
);
92
}
93
}
94
}
95
if
(
card
==
null
)
96
{
97
continue
;
98
}
99
foreach
(
Thing
value
in
dictionary.Values)
100
{
101
if
(!value.
isEquipped
&& !
card
.things.IsFull(value))
102
{
103
card
.AddThing(value);
104
}
105
}
106
}
107
SE.Equip();
108
LayerChara
.
Refresh
();
109
}
110
111
public
override
void
OnShowContextMenu
(
UIContextMenu
m)
112
{
113
base.OnShowContextMenu(m);
114
m.
AddButton
(
"updateEQ"
, delegate
115
{
116
Register
();
117
});
118
}
119
}
BlessedState
BlessedState
Definition:
BlessedState.cs:2
ContainerFlag2.card
@ card
BodySlot
Definition:
BodySlot.cs:4
BodySlot.index
int index
Definition:
BodySlot.cs:10
BodySlot.elementId
int elementId
Definition:
BodySlot.cs:6
BodySlot.thing
Thing thing
Definition:
BodySlot.cs:8
Card
Definition:
Card.cs:11
Card.c_equippedSlot
int c_equippedSlot
Definition:
Card.cs:912
Card.invY
int invY
Definition:
Card.cs:1831
Card.AddThing
Thing AddThing(string id, int lv=-1)
Definition:
Card.cs:2901
Card.Name
string Name
Definition:
Card.cs:2013
Card.uid
int uid
Definition:
Card.cs:118
Card.things
ThingContainer things
Definition:
Card.cs:34
Card.invX
int invX
Definition:
Card.cs:1819
Card.blessedState
BlessedState blessedState
Definition:
Card.cs:262
Card.parentCard
Card parentCard
Definition:
Card.cs:99
CharaBody.Unequip
void Unequip(Thing thing, bool refresh=true)
Definition:
CharaBody.cs:49
CharaBody.slots
List< BodySlot > slots
Definition:
CharaBody.cs:8
CharaBody.Equip
bool Equip(Thing thing, BodySlot slot=null, bool msg=true)
Definition:
CharaBody.cs:182
CharaBody.GetSlot
BodySlot GetSlot(Thing t, bool onlyEmpty=false, bool secondSlot=false)
Definition:
CharaBody.cs:341
Chara.body
CharaBody body
Definition:
Chara.cs:91
EClass
Definition:
EClass.cs:5
EClass.pc
static Chara pc
Definition:
EClass.cs:14
HotAction
Definition:
HotAction.cs:5
HotAction.text
string text
Definition:
HotAction.cs:10
HotItemEQSet.Item
Definition:
HotItemEQSet.cs:8
HotItemEQSet.Item.container
Card container
Definition:
HotItemEQSet.cs:9
HotItemEQSet.Item.invY
int invY
Definition:
HotItemEQSet.cs:13
HotItemEQSet.Item.invX
int invX
Definition:
HotItemEQSet.cs:11
HotItemEQSet
Definition:
HotItemEQSet.cs:6
HotItemEQSet.OnShowContextMenu
override void OnShowContextMenu(UIContextMenu m)
Definition:
HotItemEQSet.cs:111
HotItemEQSet.Perform
override void Perform()
Definition:
HotItemEQSet.cs:52
HotItemEQSet.Register
HotItemEQSet Register()
Definition:
HotItemEQSet.cs:38
HotItemEQSet.CanChangeIconColor
override bool CanChangeIconColor
Definition:
HotItemEQSet.cs:21
HotItemEQSet.Id
override string Id
Definition:
HotItemEQSet.cs:19
HotItemEQSet.ids
List< int > ids
Definition:
HotItemEQSet.cs:17
HotItemEQSet.TextTip
override string TextTip
Definition:
HotItemEQSet.cs:24
HotItem.TextHotkey
string TextHotkey()
Definition:
HotItem.cs:50
LayerChara
Definition:
LayerChara.cs:2
LayerChara.Refresh
static void Refresh()
Definition:
LayerChara.cs:16
ThingContainer.Find
Thing Find(int uid)
Definition:
ThingContainer.cs:581
Thing
Definition:
Thing.cs:8
Thing.isEquipped
bool isEquipped
Definition:
Thing.cs:17
UIContextMenu
Definition:
UIContextMenu.cs:9
UIContextMenu.AddButton
void AddButton(Func< string > funcText, UnityAction action=null)
Definition:
UIContextMenu.cs:273
Elin
HotItemEQSet.cs
Generated by
1.9.6