Get SPROP token @param pc @param eq @param content @param ammo @return SPROP token
(PlayerCharacter pc, Equipment eq, int content, int ammo)
| 981 | * @return SPROP token |
| 982 | */ |
| 983 | private static String getSpropToken(PlayerCharacter pc, Equipment eq, int content, int ammo) |
| 984 | { |
| 985 | String sprop = eq.getSpecialProperties(pc); |
| 986 | |
| 987 | //Ammunition & Contents Modifier |
| 988 | if (content > -1) |
| 989 | { |
| 990 | sprop = Constants.EMPTY_STRING; |
| 991 | |
| 992 | if ((content < eq.getContainedEquipmentCount()) |
| 993 | && !Constants.EMPTY_STRING.equals(eq.getContainedEquipment(content).getSpecialProperties(pc))) |
| 994 | { |
| 995 | sprop = eq.getContainedEquipment(content).getSpecialProperties(pc); |
| 996 | } |
| 997 | } |
| 998 | |
| 999 | int ammoCount = 0; |
| 1000 | Equipment anEquip = null; |
| 1001 | if (ammo > -1) |
| 1002 | { |
| 1003 | final String containerCapacity = eq.getContainerCapacityString(); |
| 1004 | |
| 1005 | for (Equipment equip : pc.getEquipmentListInOutputOrder()) |
| 1006 | { |
| 1007 | sprop = Constants.EMPTY_STRING; |
| 1008 | |
| 1009 | for (String type : equip.typeList()) |
| 1010 | { |
| 1011 | if (containerCapacity.contains(type)) |
| 1012 | { |
| 1013 | ++ammoCount; |
| 1014 | anEquip = equip; |
| 1015 | |
| 1016 | break; |
| 1017 | } |
| 1018 | } |
| 1019 | |
| 1020 | if (ammoCount == (ammo + 1)) |
| 1021 | { |
| 1022 | break; |
| 1023 | } |
| 1024 | } |
| 1025 | } |
| 1026 | |
| 1027 | if ((anEquip != null) && (ammoCount > 0) && !Constants.EMPTY_STRING.equals(anEquip.getSpecialProperties(pc))) |
| 1028 | { |
| 1029 | sprop = anEquip.getSpecialProperties(pc); |
| 1030 | } |
| 1031 | |
| 1032 | if (sprop.startsWith(", ")) |
| 1033 | { |
| 1034 | sprop = sprop.substring(2); |
| 1035 | } |
| 1036 | |
| 1037 | return sprop; |
| 1038 | } |
| 1039 | |
| 1040 | /** |
no test coverage detected