load a "line" i.e. a String and use its data to populate the attributes of this Equipment @param aLine The data to parse @param sep The item separator used in the data @param endPart The separator used between a label and its associated data @param aPC
(final String aLine, final String sep, final String endPart, final PlayerCharacter aPC)
| 2946 | * The PC used to size the Equipment (may be null) |
| 2947 | */ |
| 2948 | public void load(final String aLine, final String sep, final String endPart, final PlayerCharacter aPC) |
| 2949 | { |
| 2950 | |
| 2951 | final StringTokenizer aTok = new StringTokenizer(aLine, sep); |
| 2952 | final int endPartLen = endPart.length(); |
| 2953 | CDOMSingleRef<SizeAdjustment> size = getSafe(ObjectKey.SIZE); |
| 2954 | boolean firstSprop = true; |
| 2955 | |
| 2956 | while (aTok.hasMoreTokens()) |
| 2957 | { |
| 2958 | final String aString = aTok.nextToken(); |
| 2959 | |
| 2960 | if (aString.startsWith("NAME" + endPart)) |
| 2961 | { |
| 2962 | setName(aString.substring(4 + endPartLen)); |
| 2963 | put(StringKey.OUTPUT_NAME, getDisplayName()); |
| 2964 | } |
| 2965 | else if (aString.startsWith("KEY" + endPart)) |
| 2966 | { |
| 2967 | put(StringKey.KEY_NAME, aString.substring(3 + endPartLen)); |
| 2968 | } |
| 2969 | else if (aString.startsWith("SIZE" + endPart)) |
| 2970 | { |
| 2971 | size = Globals.getContext().getReferenceContext().getCDOMReference(SizeAdjustment.class, |
| 2972 | aString.substring(4 + endPartLen)); |
| 2973 | } |
| 2974 | else if (aString.startsWith("EQMOD" + endPart)) |
| 2975 | { |
| 2976 | addEqModifiers(aString.substring(5 + endPartLen), true, true); |
| 2977 | } |
| 2978 | else if (aString.startsWith("ALTEQMOD" + endPart)) |
| 2979 | { |
| 2980 | addEqModifiers(aString.substring(8 + endPartLen), false); |
| 2981 | } |
| 2982 | else if (aString.startsWith("SPROP" + endPart)) |
| 2983 | { |
| 2984 | if (firstSprop) |
| 2985 | { |
| 2986 | removeListFor(ListKey.SPECIAL_PROPERTIES); |
| 2987 | firstSprop = false; |
| 2988 | } |
| 2989 | addToListFor(ListKey.SPECIAL_PROPERTIES, |
| 2990 | SpecialProperty.createFromLst(aString.substring(5 + endPartLen))); |
| 2991 | } |
| 2992 | else if (aString.startsWith("COSTMOD" + endPart)) |
| 2993 | { |
| 2994 | setCostMod(aString.substring(7 + endPartLen)); |
| 2995 | } |
| 2996 | else if (aString.startsWith("WEIGHTMOD" + endPart)) |
| 2997 | { |
| 2998 | put(ObjectKey.WEIGHT_MOD, new BigDecimal(aString.substring(9 + endPartLen))); |
| 2999 | } |
| 3000 | } |
| 3001 | put(ObjectKey.CUSTOMSIZE, size); |
| 3002 | } |
| 3003 | |
| 3004 | /** |
| 3005 | * Sets this Equipment to the size defined in ObjectKey.CUSTOMSIZE. This |