use of com.lilithsthrone.game.inventory.InventorySlot in project liliths-throne-public by Innoxia.
the class CharacterUtils method equipClothing.
public static void equipClothing(GameCharacter character, boolean replaceUnsuitableClothing, boolean onlyAddCoreClothing) {
Colour primaryColour = Colour.allClothingColours.get(Util.random.nextInt(Colour.allClothingColours.size())), secondaryColour = Colour.allClothingColours.get(Util.random.nextInt(Colour.allClothingColours.size())), lingerieColour = Colour.lingerieColours.get(Util.random.nextInt(Colour.lingerieColours.size()));
List<InventorySlot> inventorySlotsInPriorityOrder = new ArrayList<>();
// Torso needs to be randomly decided first, to give girls a chance to wear a dress.
inventorySlotsInPriorityOrder.add(InventorySlot.TORSO_UNDER);
for (InventorySlot slot : InventorySlot.values()) {
if (slot != InventorySlot.TORSO_UNDER) {
inventorySlotsInPriorityOrder.add(slot);
}
}
if ((character.isFeminine() && !character.hasFetish(Fetish.FETISH_CROSS_DRESSER)) || (!character.isFeminine() && character.hasFetish(Fetish.FETISH_CROSS_DRESSER))) {
for (InventorySlot slot : inventorySlotsInPriorityOrder) {
if (replaceUnsuitableClothing) {
if (character.getClothingInSlot(slot) != null) {
if (character.getClothingInSlot(slot).getClothingType().getFemininityRestriction() == Femininity.MASCULINE) {
character.unequipClothingIntoVoid(character.getClothingInSlot(slot), true, character);
}
}
}
if (!slot.isCoreClothing() && onlyAddCoreClothing) {
// Don't add clothing if not core
} else {
if ((slot.isCoreClothing() || Math.random() > 0.75f || slot.isJewellery()) && !character.isSlotIncompatible(slot) && character.getClothingInSlot(slot) == null) {
if (!ClothingType.getCommonClothingMapFemaleIncludingAndrogynous().get(slot).isEmpty() && (slot.slotBlockedByRace(character) != character.getRace())) {
List<AbstractClothingType> clothingToUse = ClothingType.getCommonClothingMapFemaleIncludingAndrogynous().get(slot);
if (character.getHistory() == History.PROSTITUTE) {
clothingToUse = suitableFeminineClothing.get(History.PROSTITUTE);
}
AbstractClothingType ct = getClothingTypeForSlot(character, slot, clothingToUse);
clothingToUse.remove(ClothingType.PENIS_CONDOM);
if (ct != null) {
character.equipClothingFromNowhere(AbstractClothingType.generateClothing(ct, (slot == InventorySlot.GROIN || slot == InventorySlot.CHEST || slot == InventorySlot.SOCK ? ct.getAvailablePrimaryColours().contains(lingerieColour) ? lingerieColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())) : (slot.isCoreClothing() ? ct.getAvailablePrimaryColours().contains(primaryColour) ? primaryColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())) : ct.getAvailablePrimaryColours().contains(secondaryColour) ? secondaryColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())))), false), true, character);
}
}
}
}
}
} else {
for (InventorySlot slot : inventorySlotsInPriorityOrder) {
if (replaceUnsuitableClothing) {
if (character.getClothingInSlot(slot) != null) {
if (character.getClothingInSlot(slot).getClothingType().getFemininityRestriction() == Femininity.FEMININE) {
character.unequipClothingIntoVoid(character.getClothingInSlot(slot), true, character);
}
}
}
if (!slot.isCoreClothing() && onlyAddCoreClothing) {
// Don't add clothing if not core
} else {
if ((slot.isCoreClothing() || Math.random() > 0.75f || slot.isJewellery()) && !character.isSlotIncompatible(slot) && character.getClothingInSlot(slot) == null) {
if (!ClothingType.getCommonClothingMapMaleIncludingAndrogynous().get(slot).isEmpty() && (slot.slotBlockedByRace(character) != character.getRace())) {
List<AbstractClothingType> clothingToUse = ClothingType.getCommonClothingMapMaleIncludingAndrogynous().get(slot);
clothingToUse.remove(ClothingType.PENIS_CONDOM);
AbstractClothingType ct = getClothingTypeForSlot(character, slot, clothingToUse);
if (ct != null) {
character.equipClothingFromNowhere(AbstractClothingType.generateClothing(ct, (slot == InventorySlot.GROIN || slot == InventorySlot.CHEST || slot == InventorySlot.SOCK ? ct.getAvailablePrimaryColours().contains(lingerieColour) ? lingerieColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())) : (slot.isCoreClothing() ? ct.getAvailablePrimaryColours().contains(primaryColour) ? primaryColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())) : ct.getAvailablePrimaryColours().contains(secondaryColour) ? secondaryColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())))), false), true, character);
}
}
}
}
}
}
}
use of com.lilithsthrone.game.inventory.InventorySlot in project liliths-throne-public by Innoxia.
the class CharacterUtils method getClothingTypeForSlot.
private static AbstractClothingType getClothingTypeForSlot(GameCharacter character, InventorySlot slot, List<AbstractClothingType> clothingOptions) {
List<AbstractClothingType> availableClothing = new ArrayList<>();
boolean canEquip = true;
for (AbstractClothingType ct : clothingOptions) {
if (ct.getSlot() != slot) {
continue;
}
canEquip = true;
if (slot == InventorySlot.CHEST && !character.hasBreasts()) {
canEquip = false;
} else if (character.hasFetish(Fetish.FETISH_EXHIBITIONIST)) {
for (BlockedParts bp : ct.getBlockedPartsList()) {
boolean leavesAnusExposed = character.isCoverableAreaExposed(CoverableArea.ANUS) && !bp.blockedBodyParts.contains(CoverableArea.ANUS);
boolean leavesNipplesExposed = character.isCoverableAreaExposed(CoverableArea.NIPPLES) && !bp.blockedBodyParts.contains(CoverableArea.NIPPLES);
boolean leavesPenisExposed = !character.hasPenis() || (character.isCoverableAreaExposed(CoverableArea.PENIS) && !bp.blockedBodyParts.contains(CoverableArea.PENIS));
boolean leavesVaginaExposed = !character.hasVagina() || (character.isCoverableAreaExposed(CoverableArea.VAGINA) && !bp.blockedBodyParts.contains(CoverableArea.VAGINA));
// TODO
if (!leavesNipplesExposed || (!leavesAnusExposed || !leavesPenisExposed && !leavesVaginaExposed)) {
canEquip = false;
}
}
} else {
for (InventorySlot is : ct.getIncompatibleSlots()) {
if (character.getClothingInSlot(is) != null) {
canEquip = false;
}
}
}
if (canEquip) {
availableClothing.add(ct);
}
}
if (availableClothing.isEmpty()) {
return null;
} else {
return availableClothing.get(Util.random.nextInt(availableClothing.size()));
}
}
Aggregations