MCPcopy Create free account
hub / github.com/PCGen/pcgen / tempBonusName

Method tempBonusName

code/src/java/pcgen/io/PCGVer2Creator.java:2579–2637  ·  view source on GitHub ↗

creates a unique tuple based on the creator and target getName() @param creator @param target @return temp bonus name

(final Object creator, Object target)

Source from the content-addressed store, hash-verified

2577 * @return temp bonus name
2578 **/
2579 private String tempBonusName(final Object creator, Object target)
2580 {
2581 final StringBuilder cb = new StringBuilder(100);
2582
2583 cb.append(IOConstants.TAG_TEMPBONUS).append(':');
2584 if (creator instanceof final CDOMObject oCreator)
2585 {
2586
2587 if (oCreator instanceof Ability)
2588 {
2589 cb.append(IOConstants.TAG_FEAT).append('=');
2590 }
2591 else if (oCreator instanceof Spell)
2592 {
2593 cb.append(IOConstants.TAG_SPELL).append('=');
2594 }
2595 else if (oCreator instanceof Equipment)
2596 {
2597 cb.append(IOConstants.TAG_EQUIPMENT).append('=');
2598 }
2599 else if (oCreator instanceof PCClass)
2600 {
2601 cb.append(IOConstants.TAG_CLASS).append('=');
2602 }
2603 else if (oCreator instanceof PCTemplate)
2604 {
2605 cb.append(IOConstants.TAG_TEMPLATE).append('=');
2606 }
2607 else if (oCreator instanceof Skill)
2608 {
2609 cb.append(IOConstants.TAG_SKILL).append('=');
2610 }
2611 else
2612 {
2613 cb.append(IOConstants.TAG_ERROR).append('=');
2614 }
2615
2616 cb.append(EntityEncoder.encode(oCreator.getKeyName()));
2617 // Hmm, need to get the Type of oCreater also?
2618 // Might be required so the PCGVer2Parser can search correct type to re-create
2619 }
2620 else
2621 {
2622 return Constants.EMPTY_STRING;
2623 }
2624 cb.append('|');
2625 cb.append(IOConstants.TAG_TEMPBONUSTARGET).append(':');
2626
2627 if (target instanceof PlayerCharacter)
2628 {
2629 cb.append(IOConstants.TAG_PC);
2630 }
2631 else if (target instanceof Equipment)
2632 {
2633 cb.append(EntityEncoder.encode(((Equipment) target).getName()));
2634 }
2635
2636 return cb.toString();

Callers 2

appendEqSetBonusesMethod · 0.95
appendTempBonusesMethod · 0.95

Calls 5

encodeMethod · 0.95
getKeyNameMethod · 0.65
getNameMethod · 0.65
toStringMethod · 0.65
appendMethod · 0.45

Tested by

no test coverage detected