Search in sources :

Example 76 with EquipSet

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;
}
Also used : EquipSet(pcgen.core.character.EquipSet)

Example 77 with EquipSet

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;
}
Also used : EquipSet(pcgen.core.character.EquipSet)

Example 78 with EquipSet

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;
}
Also used : EquipSet(pcgen.core.character.EquipSet)

Example 79 with EquipSet

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();
}
Also used : EquipSet(pcgen.core.character.EquipSet)

Aggregations

EquipSet (pcgen.core.character.EquipSet)79 PlayerCharacter (pcgen.core.PlayerCharacter)32 Equipment (pcgen.core.Equipment)22 ArrayList (java.util.ArrayList)12 BonusObj (pcgen.core.bonus.BonusObj)11 HashMap (java.util.HashMap)9 LoadContext (pcgen.rules.context.LoadContext)8 EquipNode (pcgen.facade.core.EquipmentSetFacade.EquipNode)7 DecimalFormat (java.text.DecimalFormat)4 NumberFormat (java.text.NumberFormat)4 List (java.util.List)4 Map (java.util.Map)4 EquipmentList (pcgen.core.EquipmentList)4 PCTemplate (pcgen.core.PCTemplate)4 EquipSlot (pcgen.core.character.EquipSlot)4 LinkedHashMap (java.util.LinkedHashMap)3 Ability (pcgen.core.Ability)3 EquipmentModifier (pcgen.core.EquipmentModifier)3 StringTokenizer (java.util.StringTokenizer)2 CNAbility (pcgen.cdom.content.CNAbility)2