use of io.github.spugn.Sargo.Objects.Character in project S-argo by Expugn.
the class CharacterScout method init.
/**
* Initializes all the variables needed for scouts.
*/
private void init() {
/* FILES */
// SETTINGS = new SettingsParser();
BANNERS = BannerParser.getBanners();
USER = new UserParser(DISCORD_ID);
/* SETTINGS */
IS_RARITY_STARS = SettingsParser.isRarityStars();
COPPER = (int) (SettingsParser.getCopperRates() * 100);
SILVER = (int) (SettingsParser.getSilverRates() * 100);
GOLD = (int) (SettingsParser.getGoldRates() * 100);
PLATINUM = (int) (SettingsParser.getPlatinumRates() * 100);
RECORD_CRYSTAL_RATES = SettingsParser.getRecordCrystalRates();
CIRCULATING_RECORD_CRYSTAL_RATES = SettingsParser.getCirculatingRecordCrystalRates();
GOLD_BANNERS = SettingsParser.getGoldBanners();
GOLD_BANNERS_V2 = SettingsParser.getGoldBannersv2();
IMAGE_DISABLED = SettingsParser.isDisableImages();
SIMPLE_MESSAGE = SettingsParser.isSimpleMessage();
/* USER */
userMemoryDiamonds = USER.getMemoryDiamonds();
userHackingCrystals = USER.getHackingCrystals();
userRecordCrystals = 0;
/* VARIABLES */
RNG = new Random(System.currentTimeMillis());
imageStrings = new String[11];
characters = new ArrayList<>();
guaranteeOnePlatinum = false;
guaranteedScout = false;
characterString = "";
tempUserDirectory = new File("images/temp_" + DISCORD_ID);
scoutMenu = new EmbedBuilder();
simpleMessage = "";
/* MEMORY DIAMOND PRICES */
singleScoutPrice = 25;
multiScoutPrice = 250;
/* BANNER */
if (BANNER_ID < BANNERS.size() && BANNER_ID >= 0) {
SELECTED_BANNER = BANNERS.get(BANNER_ID);
BANNER_CHARACTERS = SELECTED_BANNER.getCharacters();
bannerType = SELECTED_BANNER.getBannerType();
bannerTypeData = USER.getBannerData(SELECTED_BANNER.getBannerName());
goldCharacters = new ArrayList<>();
platinumCharacters = new ArrayList<>();
if (USER.isBannerInfoExists(SELECTED_BANNER.getBannerName()) == -1) {
initBannerInfo();
}
for (Character character : BANNER_CHARACTERS) {
if (character.getRarity() == 4) {
goldCharacters.add(character);
} else if (character.getRarity() == 5) {
platinumCharacters.add(character);
}
}
if (platinumCharacters.size() <= 0) {
COPPER += PLATINUM;
PLATINUM = 0;
}
modifyScoutData();
LOGGER.debug("\n- Scout Data -\n" + "Single Price " + singleScoutPrice + "\n" + "Multi Price: " + multiScoutPrice + "\n" + "COPPER: " + COPPER + "%\n" + "SILVER: " + SILVER + "%\n" + "GOLD: " + GOLD + "%\n" + "PLATINUM: " + PLATINUM + "%");
}
}
use of io.github.spugn.Sargo.Objects.Character 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.Objects.Character 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.Objects.Character in project S-argo by Expugn.
the class Memorial method randGoldCharacter.
@Override
protected Character randGoldCharacter() {
int randIndex = GOLD_BANNERS_V2.get(RNG.nextInt(GOLD_BANNERS_V2.size()));
Banner randBanner = BANNERS.get(randIndex - 1);
List<Character> randCharacters = randBanner.getCharacters();
return randCharacters.get(RNG.nextInt(randCharacters.size()));
}
use of io.github.spugn.Sargo.Objects.Character in project S-argo by Expugn.
the class Normal method randGoldCharacter.
@Override
protected Character randGoldCharacter() {
int randIndex = GOLD_BANNERS.get(RNG.nextInt(GOLD_BANNERS.size()));
Banner randBanner = BANNERS.get(randIndex - 1);
List<Character> randCharacters = randBanner.getCharacters();
return randCharacters.get(RNG.nextInt(randCharacters.size()));
}
Aggregations