use of pcgen.core.character.EquipSet in project pcgen by PCGen.
the class EquipSetFacet method getEquippedQuantity.
/**
* Search the equipment sets rooted at {@code set}, and return the number
* of items of {@code set} in the set.
* @param id The ID of the PC
* @param set The root of an Equipment Set
* @param eq The equipment to search for.
* @return The number of items equipped.
*/
public Float getEquippedQuantity(CharID id, EquipSet set, Equipment eq) {
final String rPath = set.getIdPath();
for (EquipSet es : getSet(id)) {
String esIdPath = es.getIdPath() + Constants.EQUIP_SET_PATH_SEPARATOR;
String rIdPath = rPath + Constants.EQUIP_SET_PATH_SEPARATOR;
if (!esIdPath.startsWith(rIdPath)) {
continue;
}
if (eq.getName().equals(es.getValue())) {
return es.getQty();
}
}
return (float) 0;
}
use of pcgen.core.character.EquipSet in project pcgen by PCGen.
the class EncounterPlugin method createDefaultEquipset.
private static EquipSet createDefaultEquipset(PlayerCharacter aPC) {
EquipSet eSet;
if (aPC.getDisplay().hasEquipSet()) {
eSet = aPC.getDisplay().getEquipSetByIdPath(EquipSet.DEFAULT_SET_PATH);
} else {
String id = getNewIdPath(aPC, null);
String defaultEquipSet = "Default Set";
eSet = new EquipSet(id, defaultEquipSet);
aPC.addEquipSet(eSet);
Logging.debugPrint("Adding EquipSet: " + defaultEquipSet);
}
return eSet;
}
use of pcgen.core.character.EquipSet in project pcgen by PCGen.
the class EncounterPlugin method getNewIdPath.
private static String getNewIdPath(PlayerCharacter aPC, EquipSet eSet) {
String pid = "0";
int newID = 0;
if (eSet != null) {
pid = eSet.getIdPath();
}
for (EquipSet es : aPC.getDisplay().getEquipSet()) {
if (es.getParentIdPath().equals(pid) && (es.getId() > newID)) {
newID = es.getId();
}
}
++newID;
return pid + '.' + newID;
}
use of pcgen.core.character.EquipSet in project pcgen by PCGen.
the class EncounterPlugin method handleEquipment.
private void handleEquipment(PlayerCharacter aPC) {
EquipSet eqSet = createDefaultEquipset(aPC);
addAllToEquipSet(aPC, eqSet);
aPC.setCalcEquipSetId(eqSet.getIdPath());
aPC.setCalcEquipmentList();
}
Aggregations