Add an equipment modifier and its associated information eg: Bane|Vermin|Fey eg: Keen Adds a feature to the EqModifier attribute of the Equipment object @param aString The feature to be added to the EqModifier attribute @param bPrimary The feature to be added to the EqModifier
(final String aString, final boolean bPrimary, final boolean isLoading)
| 2193 | * @param isLoading Is the equipment item being loaded currently. |
| 2194 | */ |
| 2195 | private void addEqModifier(final String aString, final boolean bPrimary, final boolean isLoading) |
| 2196 | { |
| 2197 | final StringTokenizer aTok = new StringTokenizer(aString, "|"); |
| 2198 | |
| 2199 | // The type of EqMod, eg: ABILITYPLUS |
| 2200 | final String eqModKey = aTok.nextToken(); |
| 2201 | |
| 2202 | EquipmentModifier eqMod = getEqModifierKeyed(eqModKey, bPrimary); |
| 2203 | |
| 2204 | // If not already attached, then add a new one |
| 2205 | if (eqMod == null) |
| 2206 | { |
| 2207 | if (eqModKey.equals(EQMOD_WEIGHT)) |
| 2208 | { |
| 2209 | if (aTok.hasMoreTokens()) |
| 2210 | { |
| 2211 | put(ObjectKey.WEIGHT_MOD, new BigDecimal(aTok.nextToken().replace(',', '.'))); |
| 2212 | } |
| 2213 | return; |
| 2214 | } |
| 2215 | |
| 2216 | if (eqModKey.equals(EQMOD_DAMAGE)) |
| 2217 | { |
| 2218 | if (aTok.hasMoreTokens()) |
| 2219 | { |
| 2220 | put(StringKey.DAMAGE_OVERRIDE, aTok.nextToken()); |
| 2221 | } |
| 2222 | return; |
| 2223 | } |
| 2224 | |
| 2225 | eqMod = Globals.getContext().getReferenceContext().silentlyGetConstructedCDOMObject(EquipmentModifier.class, |
| 2226 | eqModKey); |
| 2227 | |
| 2228 | if (eqMod == null) |
| 2229 | { |
| 2230 | Logging.errorPrint("Could not find EquipmentModifier: " + eqModKey); |
| 2231 | |
| 2232 | return; |
| 2233 | } |
| 2234 | |
| 2235 | // only make a copy if we need to |
| 2236 | // add qualifiers to modifier |
| 2237 | if (!eqMod.getSafe(StringKey.CHOICE_STRING).isEmpty()) |
| 2238 | { |
| 2239 | eqMod = eqMod.clone(); |
| 2240 | } |
| 2241 | |
| 2242 | addToEqModifierList(eqMod, bPrimary); |
| 2243 | } |
| 2244 | |
| 2245 | // Add the associated choices |
| 2246 | if (!eqMod.getSafe(StringKey.CHOICE_STRING).isEmpty()) |
| 2247 | { |
| 2248 | while (aTok.hasMoreTokens()) |
| 2249 | { |
| 2250 | final String x = aTok.nextToken(); |
| 2251 | Integer min = eqMod.get(IntegerKey.MIN_CHARGES); |
| 2252 | if (min != null && min > 0 |