use of io.github.spugn.Sargo.Utilities.ImageEditor in project S-argo by Expugn.
the class CharacterScout method doMultiPull.
/**
* Generates eleven characters and the scout result image.
*/
void doMultiPull() {
if (generateImage && !IMAGE_DISABLED) {
tempUserDirectory.mkdir();
}
for (int i = 0; i < 11; i++) {
characters.add(getCharacter(scout()));
}
Character tempCharacter;
for (int a = 0; a < 12; a++) {
for (int b = 1; b < 11; b++) {
if (characters.get(b - 1).getRarity() <= characters.get(b).getRarity()) {
tempCharacter = characters.get(b - 1);
characters.set(b - 1, characters.get(b));
characters.set(b, tempCharacter);
}
}
}
highestRarity = characters.get(0).getRarity();
generateImageStrings();
if (generateImage && !IMAGE_DISABLED)
new ImageEditor().drawMultiScout(imageStrings, true, tempUserDirectory + "/results.png");
}
use of io.github.spugn.Sargo.Utilities.ImageEditor in project S-argo by Expugn.
the class CharacterScout method generateImageString.
/**
* Checks the user's character box for duplicate characters,
* grant Hacking Crystals, and generates the character images.
*/
private void generateImageString() {
if (!USER.getCharacterBox().isEmpty()) {
for (Character userCharacter : USER.getCharacterBox()) {
if (userCharacter.getPrefix().equals(characters.get(0).getPrefix()) && userCharacter.getRarity() == characters.get(0).getRarity() && userCharacter.getName().equals(characters.get(0).getName())) {
giveHackingCrystals(characters.get(0));
characterString += "~~" + characters.get(0).toString() + "~~" + "\n";
if (generateImage && !IMAGE_DISABLED)
new ImageEditor().drawCharacterImage(characters.get(0).getImagePath(), characters.get(0).getRarity(), true, IS_RARITY_STARS, tempUserDirectory + "/temp_" + 0 + ".png");
imageString = tempUserDirectory + "/temp_" + 0 + ".png";
return;
}
}
}
USER.addCharacter(characters.get(0));
characterString += "**" + characters.get(0).toString() + "**\n";
if (generateImage && !IMAGE_DISABLED)
new ImageEditor().drawCharacterImage(characters.get(0).getImagePath(), characters.get(0).getRarity(), false, IS_RARITY_STARS, tempUserDirectory + "/temp_" + 0 + ".png");
imageString = tempUserDirectory + "/temp_" + 0 + ".png";
}
use of io.github.spugn.Sargo.Utilities.ImageEditor in project S-argo by Expugn.
the class CharacterScout method generateImageStrings.
/**
* Same function as {@link #generateImageString()} but for eleven characters.
* @see #generateImageString()
*/
private void generateImageStrings() {
boolean foundDuplicate = false;
for (int i = 0; i < 11; i++) {
if (!USER.getCharacterBox().isEmpty()) {
for (Character userCharacter : USER.getCharacterBox()) {
if (userCharacter.getPrefix().equals(characters.get(i).getPrefix()) && userCharacter.getRarity() == characters.get(i).getRarity() && userCharacter.getName().equals(characters.get(i).getName())) {
foundDuplicate = true;
giveHackingCrystals(characters.get(i));
characterString += "~~" + characters.get(i).toString() + "~~" + "\n";
if (generateImage && !IMAGE_DISABLED)
new ImageEditor().drawCharacterImage(characters.get(i).getImagePath(), characters.get(i).getRarity(), true, IS_RARITY_STARS, tempUserDirectory + "/temp_" + i + ".png");
}
}
if (!foundDuplicate) {
USER.addCharacter(characters.get(i));
characterString += "**" + characters.get(i).toString() + "**\n";
if (generateImage && !IMAGE_DISABLED)
new ImageEditor().drawCharacterImage(characters.get(i).getImagePath(), characters.get(i).getRarity(), false, IS_RARITY_STARS, tempUserDirectory + "/temp_" + i + ".png");
}
foundDuplicate = false;
} else {
USER.addCharacter(characters.get(i));
characterString += "**" + characters.get(i).toString() + "**\n";
if (generateImage && !IMAGE_DISABLED)
new ImageEditor().drawCharacterImage(characters.get(i).getImagePath(), characters.get(i).getRarity(), false, IS_RARITY_STARS, tempUserDirectory + "/temp_" + i + ".png");
}
imageStrings[i] = tempUserDirectory + "/temp_" + i + ".png";
}
}
Aggregations