(LoadContext context, final String argToken)
| 30 | public final class Save extends BonusObj |
| 31 | { |
| 32 | @Override |
| 33 | protected boolean parseToken(LoadContext context, final String argToken) |
| 34 | { |
| 35 | if (ControlUtilities.hasControlToken(context, CControl.TOTALSAVE)) |
| 36 | { |
| 37 | Logging.errorPrint("BONUS:SAVE is disabled when TOTALSAVE code control is used: " + argToken, context); |
| 38 | return false; |
| 39 | } |
| 40 | boolean isBase = false; |
| 41 | final String token; |
| 42 | |
| 43 | if (argToken.startsWith("BASE.")) |
| 44 | { |
| 45 | token = argToken.substring(Constants.SUBSTRING_LENGTH_FIVE); |
| 46 | isBase = true; |
| 47 | } |
| 48 | else |
| 49 | { |
| 50 | token = argToken; |
| 51 | } |
| 52 | |
| 53 | if ("%LIST".equals(token)) |
| 54 | { |
| 55 | // Special case of: BONUS:SAVE|%LIST|x |
| 56 | addBonusInfo(listCheck); |
| 57 | } |
| 58 | else if ("ALL".equals(token)) |
| 59 | { |
| 60 | // Special case of: BONUS:SAVE|ALL|x |
| 61 | /* |
| 62 | * TODO Prohibit use in Game Mode, or alternately, all areas where |
| 63 | * SAVE are established need to test both SAVE|Blah and |
| 64 | * SAVE|ALL |
| 65 | */ |
| 66 | for (PCCheck check : context.getReferenceContext().getConstructedCDOMObjects(PCCheck.class)) |
| 67 | { |
| 68 | addBonusInfo(new CheckInfo(CDOMDirectSingleRef.getRef(check), isBase)); |
| 69 | } |
| 70 | } |
| 71 | else |
| 72 | { |
| 73 | CDOMReference<PCCheck> aCheck = context.getReferenceContext().getCDOMReference(PCCheck.class, token); |
| 74 | //Invalid name is caught by Unconstructed Reference system |
| 75 | addBonusInfo(new CheckInfo(aCheck, isBase)); |
| 76 | } |
| 77 | |
| 78 | return true; |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Unparse the bonus token. |
nothing calls this directly
no test coverage detected