(final String line)
| 4685 | } |
| 4686 | |
| 4687 | private void parseEquipmentLine(final String line) |
| 4688 | { |
| 4689 | final PCGTokenizer tokens; |
| 4690 | |
| 4691 | try |
| 4692 | { |
| 4693 | tokens = new PCGTokenizer(line); |
| 4694 | } |
| 4695 | catch (PCGParseException pcgpex) |
| 4696 | { |
| 4697 | final String message = "Illegal Equipment line ignored: " + line + Constants.LINE_SEPARATOR + "Error: " |
| 4698 | + pcgpex.getMessage(); |
| 4699 | warnings.add(message); |
| 4700 | |
| 4701 | return; |
| 4702 | } |
| 4703 | |
| 4704 | String itemKey; |
| 4705 | Equipment aEquip; |
| 4706 | |
| 4707 | PCGElement element; |
| 4708 | |
| 4709 | // the first element defines the item key name |
| 4710 | element = tokens.getElements().get(0); |
| 4711 | itemKey = EntityEncoder.decode(element.getText()); |
| 4712 | // Check for an equipment key that has been updated. |
| 4713 | itemKey = EquipmentMigration.getNewEquipmentKey(itemKey, pcgenVersion, SettingsHandler.getGameAsProperty().get().getName()); |
| 4714 | |
| 4715 | // might be dynamically created container |
| 4716 | aEquip = thePC.getEquipmentNamed(itemKey); |
| 4717 | |
| 4718 | if (aEquip == null) |
| 4719 | { |
| 4720 | // Must load custom equipment from the .pcg file |
| 4721 | // before we check the Global list (which may get |
| 4722 | // loaded from customEquipment.lst) as equipment |
| 4723 | // in the PC's .pcg may contain additional info |
| 4724 | // such as Charges on a wand, etc |
| 4725 | // |
| 4726 | // Make sure that we are not picking up custom items! |
| 4727 | aEquip = Globals.getContext().getReferenceContext().silentlyGetConstructedCDOMObject(Equipment.class, |
| 4728 | itemKey); |
| 4729 | if (aEquip != null) |
| 4730 | { |
| 4731 | if (aEquip.isType(Constants.TYPE_CUSTOM)) |
| 4732 | { |
| 4733 | aEquip = null; |
| 4734 | } |
| 4735 | else |
| 4736 | { |
| 4737 | // standard item |
| 4738 | aEquip = aEquip.clone(); |
| 4739 | } |
| 4740 | } |
| 4741 | if (line.contains(IOConstants.TAG_CUSTOMIZATION)) |
| 4742 | { |
| 4743 | // might be customized item |
| 4744 | for (PCGElement pcgElement : tokens.getElements()) |
no test coverage detected