Build a String used to save this items special properties in a .pcg file @param sep used to separate the items in the string @param endPart used as a separatot between the label and the data for each item in the string @return String
(final char sep, final char endPart)
| 2773 | * @return String |
| 2774 | */ |
| 2775 | public String formatSaveLine(final char sep, final char endPart) |
| 2776 | { |
| 2777 | |
| 2778 | final StringBuilder sbuf = new StringBuilder(100); |
| 2779 | |
| 2780 | final Equipment base; |
| 2781 | |
| 2782 | CDOMSingleRef<Equipment> baseItem = get(ObjectKey.BASE_ITEM); |
| 2783 | if (baseItem == null) |
| 2784 | { |
| 2785 | base = this; |
| 2786 | sbuf.append(getBaseItemName()); |
| 2787 | } |
| 2788 | else |
| 2789 | { |
| 2790 | base = baseItem.get(); |
| 2791 | sbuf.append(base.getKeyName()); |
| 2792 | sbuf.append(sep).append("NAME").append(endPart).append(toString(false)); |
| 2793 | } |
| 2794 | |
| 2795 | // When you customise a piece of equipment using the customiser, it sets |
| 2796 | // the keyName equal to the Name. The autoresizer doesn't do that, it |
| 2797 | // makes a new key. This is to cope with the auto resizer. |
| 2798 | |
| 2799 | if (!this.getKeyName().equals(this.getName())) |
| 2800 | { |
| 2801 | sbuf.append(sep).append("KEY").append(endPart).append(this.getKeyName()); |
| 2802 | } |
| 2803 | |
| 2804 | SizeAdjustment thisSize = getSizeAdjustment(); |
| 2805 | if (!thisSize.equals(base.getSizeAdjustment())) |
| 2806 | { |
| 2807 | sbuf.append(sep).append("SIZE").append(endPart).append(thisSize.getKeyName()); |
| 2808 | } |
| 2809 | |
| 2810 | String string1 = getEqModifierString(true); // key1.key2|assoc1|assoc2.key3.key4 |
| 2811 | |
| 2812 | if (!string1.isEmpty()) |
| 2813 | { |
| 2814 | sbuf.append(sep).append("EQMOD").append(endPart).append(string1); |
| 2815 | } |
| 2816 | |
| 2817 | String string2 = getEqModifierString(false); // key1.key2|assoc1|assoc2.key3.key4 |
| 2818 | |
| 2819 | if (!string2.isEmpty()) |
| 2820 | { |
| 2821 | sbuf.append(sep).append("ALTEQMOD").append(endPart).append(string2); |
| 2822 | } |
| 2823 | |
| 2824 | String string3 = getRawSpecialProperties(); |
| 2825 | |
| 2826 | if ((!string3.isEmpty()) && !string3.equals(base.getRawSpecialProperties())) |
| 2827 | { |
| 2828 | sbuf.append(sep).append("SPROP").append(endPart).append(string3); |
| 2829 | } |
| 2830 | |
| 2831 | if (!costMod.equals(BigDecimal.ZERO)) |
| 2832 | { |