(LoadContext context, KitSpells kitSpell)
| 168 | } |
| 169 | |
| 170 | @Override |
| 171 | public String[] unparse(LoadContext context, KitSpells kitSpell) |
| 172 | { |
| 173 | StringBuilder sb = new StringBuilder(); |
| 174 | String spellBook = kitSpell.getSpellBook(); |
| 175 | String globalSpellbook = Globals.getDefaultSpellBook(); |
| 176 | if (spellBook != null && !globalSpellbook.equals(spellBook)) |
| 177 | { |
| 178 | sb.append("SPELLBOOK=").append(spellBook); |
| 179 | } |
| 180 | CDOMSingleRef<PCClass> castingClass = kitSpell.getCastingClass(); |
| 181 | if (castingClass != null) |
| 182 | { |
| 183 | if (sb.length() != 0) |
| 184 | { |
| 185 | sb.append(Constants.PIPE); |
| 186 | } |
| 187 | sb.append(Constants.LST_CLASS_EQUAL).append(castingClass.getLSTformat(false)); |
| 188 | } |
| 189 | Collection<KnownSpellIdentifier> spells = kitSpell.getSpells(); |
| 190 | if (spells != null) |
| 191 | { |
| 192 | boolean needPipe = sb.length() > 0; |
| 193 | for (KnownSpellIdentifier ksi : spells) |
| 194 | { |
| 195 | if (needPipe) |
| 196 | { |
| 197 | sb.append(Constants.PIPE); |
| 198 | } |
| 199 | needPipe = true; |
| 200 | Collection<List<CDOMSingleRef<Ability>>> abilities = kitSpell.getAbilities(ksi); |
| 201 | for (List<CDOMSingleRef<Ability>> abils : abilities) |
| 202 | { |
| 203 | StringBuilder spell = new StringBuilder(); |
| 204 | spell.append( |
| 205 | StringUtil.replaceAll(ksi.getLSTformat(), Constants.LST_TYPE_EQUAL, Constants.LST_TYPE_DOT)); |
| 206 | if (abils != null && !abils.isEmpty()) |
| 207 | { |
| 208 | spell.append('['); |
| 209 | spell.append(ReferenceUtilities.joinLstFormat(abils, "][")); |
| 210 | spell.append(']'); |
| 211 | } |
| 212 | Integer count = kitSpell.getSpellCount(ksi, abils); |
| 213 | if (count != 1) |
| 214 | { |
| 215 | spell.append('=').append(count); |
| 216 | } |
| 217 | sb.append(spell); |
| 218 | } |
| 219 | } |
| 220 | } |
| 221 | if (sb.length() == 0) |
| 222 | { |
| 223 | return null; |
| 224 | } |
| 225 | return new String[]{sb.toString()}; |
| 226 | } |
| 227 | // TODO DeferredToken |
nothing calls this directly
no test coverage detected