(LoadContext context, CDOMObject obj)
| 81 | } |
| 82 | |
| 83 | @Override |
| 84 | public String[] unparse(LoadContext context, CDOMObject obj) |
| 85 | { |
| 86 | if (obj instanceof EquipmentModifier) |
| 87 | { |
| 88 | // EquipmentModifier bonuses are handled by plugin.lsttokens.equipmentmodifier.BonusToken |
| 89 | return null; |
| 90 | } |
| 91 | |
| 92 | Changes<BonusObj> changes = context.getObjectContext().getListChanges(obj, ListKey.BONUS); |
| 93 | if (changes == null || changes.isEmpty()) |
| 94 | { |
| 95 | // Empty indicates no token present |
| 96 | return null; |
| 97 | } |
| 98 | // CONSIDER need to deal with removed... |
| 99 | Collection<BonusObj> added = changes.getAdded(); |
| 100 | String tokenName = getTokenName(); |
| 101 | Set<String> bonusSet = new TreeSet<>(); |
| 102 | for (BonusObj bonus : added) |
| 103 | { |
| 104 | if (tokenName.equals(bonus.getTokenSource())) |
| 105 | { |
| 106 | String bonusString = bonus.getLSTformat(); |
| 107 | bonusSet.add(bonusString); |
| 108 | } |
| 109 | } |
| 110 | if (bonusSet.isEmpty()) |
| 111 | { |
| 112 | // This is okay - just no BONUSes from this token |
| 113 | return null; |
| 114 | } |
| 115 | return bonusSet.toArray(new String[0]); |
| 116 | } |
| 117 | |
| 118 | @Override |
| 119 | public Class<CDOMObject> getTokenClass() |
nothing calls this directly
no test coverage detected