@@ -25,28 +25,14 @@ public enum IncludeWeaponCount
25
25
/// <summary>
26
26
/// This sed should include two weapons.
27
27
/// </summary>
28
- Two
29
- }
30
-
31
- /// <summary>
32
- ///
33
- /// </summary>
34
- public enum RingDuplicationOption
35
- {
36
- /// <summary>
37
- /// All rings must be distinct.
38
- /// </summary>
39
- No ,
40
- /// <summary>
41
- /// All rings must be the same.
42
- /// </summary>
43
- Yes ,
28
+ Two ,
44
29
/// <summary>
45
- /// Any combination of rings up to RingCount contributes to the set.
30
+ /// This set should include two weapons, any combination contributes to the set.
46
31
/// </summary>
47
- Mixed
32
+ TwoAny
48
33
}
49
-
34
+
35
+ /*
50
36
public enum RingCountOption
51
37
{
52
38
/// <summary>
@@ -66,7 +52,7 @@ public enum RingCountOption
66
52
/// </summary>
67
53
Three
68
54
}
69
-
55
+ //*/
70
56
71
57
/// <summary>
72
58
/// String ID of this ItemSet.
@@ -78,18 +64,92 @@ public enum RingCountOption
78
64
79
65
public IncludeWeaponCount WeaponCount { get ; set ; }
80
66
81
- public RingCountOption RingCount { get ; set ; }
67
+ public int RingCount { get ; set ; }
82
68
83
- public RingDuplicationOption RingOption { get ; set ; }
69
+ public bool RingRequireDistinct { get ; set ; }
84
70
85
- public int BonusCount { get ; set ; }
71
+ // public int BonusCount { get; set; }
86
72
87
73
public Items . ItemBonus [ ] Bonuses { get ; set ; }
88
74
89
75
public ItemSet ( ItemSetTemplate Template )
90
76
{
91
- BonusCount = Template . ItemList . Count ;
77
+ int BonusCount = Template . ItemList . Count ;
92
78
Bonuses = new Items . ItemBonus [ BonusCount ] ;
93
79
}
80
+
81
+ public int GetSetCount ( List < Items . ItemEquip > ItemList )
82
+ {
83
+ int result = 0 ;
84
+ //two lists to keep track of rings and weapons due to special handling
85
+ List < Items . ItemEquip > rings = new List < Items . ItemEquip > ( ) ;
86
+ List < Items . ItemEquip > weps = new List < Items . ItemEquip > ( ) ;
87
+ //go through every item in the list given
88
+ foreach ( Items . ItemEquip item in ItemList )
89
+ {
90
+ //only count items that specify this as their set
91
+ if ( item . Set == this )
92
+ {
93
+ //if it's a ring, add it to the rings list
94
+ if ( Items . ItemEquip . EquipSlot . IsRing ( item . EquipmentSlot ) )
95
+ {
96
+ rings . Add ( item ) ;
97
+ }
98
+ //if it's a weapon, add it to the weapons list
99
+ else if ( Items . ItemEquip . EquipSlot . IsWeapon ( item . EquipmentSlot ) )
100
+ {
101
+ weps . Add ( item ) ;
102
+ }
103
+ //else increase the tally as no other types can have duplicate slots
104
+ else
105
+ {
106
+ result ++ ;
107
+ }
108
+ }
109
+
110
+ }
111
+
112
+ //add either the number of all weapons and rings equipped, or just unique ones as the set requires.
113
+ //items are compared by their IGameID.ID as two distinct copies of the same ring item will count as
114
+ //unique if compared with regular equality as the player will never be able to equip the same
115
+ //instance of an item twice.
116
+ //rings only count up to maximum ring count in the set - for example, if a set includes 1 ring,
117
+ //equipping 2 or 3 of that ring will not "satisfy" additional set slots.
118
+
119
+ //if ring mixing is allowed, or same ring option was set in template, add all rings we found
120
+ if ( RingRequireDistinct )
121
+ {
122
+ result += Math . Max ( rings . Select ( r => r . ID ) . Distinct ( ) . ToList ( ) . Count , this . RingCount ) ;
123
+ }
124
+ //else only add the unique ones.
125
+ else
126
+ {
127
+ result += Math . Min ( rings . Count , this . RingCount ) ;
128
+ }
129
+ //if specifically two different weapons are required, count uniques in the list in case two of the same are eqipped;
130
+ if ( WeaponCount == IncludeWeaponCount . Two )
131
+ {
132
+ result += weps . Select ( r => r . ID ) . Distinct ( ) . ToList ( ) . Count ;
133
+ }
134
+ else
135
+ {
136
+ result += weps . Count ;
137
+ }
138
+
139
+
140
+
141
+ return result ;
142
+ }
143
+
144
+ public List < Items . ItemBonus > GetBonuses ( int ItemCount )
145
+ {
146
+ List < Items . ItemBonus > result = new List < Items . ItemBonus > ( ) ;
147
+ if ( ItemCount > Bonuses . Length )
148
+ ItemCount = Bonuses . Length ;
149
+ for ( int i = 0 ; i < ItemCount ; i ++ )
150
+ if ( Bonuses [ i ] != null )
151
+ result . Add ( Bonuses [ i ] ) ;
152
+ return result ;
153
+ }
94
154
}
95
155
}
0 commit comments