use of io.github.spugn.Sargo.XMLParsers.UserParser in project S-argo by Expugn.
the class Profile method purgeDeletedCharacters.
/**
* Deletes any gold/platinum character that no longer exists in the
* Banners.xml file that the user has in their character box.
*
* @param gold List of all gold characters in the banners file
* @param plat List of all platinum characters in the banners file
*/
private void purgeDeletedCharacters(List<String> gold, List<String> plat) {
boolean unsavedChanges = false;
List<Character> newUserCharacterBox = new ArrayList<>();
for (Character c : user.getCharacterBox()) {
if (c.getRarity() == 4) {
if (gold.contains(c.getPrefix() + c.getName()))
newUserCharacterBox.add(c);
else if (!unsavedChanges)
unsavedChanges = true;
} else if (c.getRarity() == 5) {
if (plat.contains(c.getPrefix() + c.getName()))
newUserCharacterBox.add(c);
else if (!unsavedChanges)
unsavedChanges = true;
} else {
newUserCharacterBox.add(c);
}
}
if (unsavedChanges) {
user.setCharacterBox(newUserCharacterBox);
user.saveData();
user = new UserParser(DISCORD_ID);
}
}
use of io.github.spugn.Sargo.XMLParsers.UserParser in project S-argo by Expugn.
the class Profile method init.
/**
* Initializes the EmbedMessage and variables.
*/
private void init() {
builder = new EmbedBuilder();
iUser = CHANNEL.getGuild().getUserByID(Long.parseLong(DISCORD_ID));
user = new UserParser(DISCORD_ID);
userName = iUser.getName() + "#" + iUser.getDiscriminator();
goldCount = 0;
platinumCount = 0;
bannerType = new TreeMap<>();
builder.withAuthorName(userName + "'s Profile");
builder.withAuthorIcon(iUser.getAvatarURL());
builder.withColor(255, 86, 91);
builder.withThumbnail(new GitHubImage("images/System/Profile_Icon.png").getURL());
}
use of io.github.spugn.Sargo.XMLParsers.UserParser 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.XMLParsers.UserParser in project S-argo by Expugn.
the class TicketScout method init.
/**
* Initializes all the variables needed for scouts.
*/
private void init() {
/* FILES */
// SettingsParser SETTINGS = new SettingsParser();
USER = new UserParser(DISCORD_ID);
/* SETTINGS */
// IMAGE_DISABLED = SETTINGS.isDisableImages();
// SIMPLE_MESSAGE = SETTINGS.isSimpleMessage();
// IS_RARITY_STARS = SETTINGS.isRarityStars();
IMAGE_DISABLED = SettingsParser.isDisableImages();
SIMPLE_MESSAGE = SettingsParser.isSimpleMessage();
IS_RARITY_STARS = SettingsParser.isRarityStars();
/* USER */
userColBalance = USER.getColBalance();
userTotalScouts = USER.getTotalTicketScout();
/* VARIABLES */
RNG = new Random(System.currentTimeMillis());
scoutMenu = new EmbedBuilder();
simpleMessage = "";
imageStrings = new String[11];
items = new ArrayList<>();
itemString = "";
tempUserDirectory = new File("images/temp_" + DISCORD_ID);
attributeItemsList = new ArrayList<>();
medallionsAndKeyList = new ArrayList<>();
/* ITEMS */
initItems();
}
use of io.github.spugn.Sargo.XMLParsers.UserParser in project S-argo by Expugn.
the class WeaponScout method init.
/**
* Initializes all the variables needed for scouts.
*/
private void init() {
/* FILES */
// SettingsParser SETTINGS = new SettingsParser();
// List<Banner> BANNERS = new BannerParser().getBanners();
List<Banner> BANNERS = BannerParser.getBanners();
USER = new UserParser(DISCORD_ID);
/* SETTINGS */
// IS_RARITY_STARS = SETTINGS.isRarityStars();
// COPPER = (int) ((SETTINGS.getCopperRates() * 100) + (SETTINGS.getPlatinumRates() * 100));
// SILVER = (int) (SETTINGS.getSilverRates() * 100);
// GOLD = (int) (SETTINGS.getGoldRates() * 100);
// IMAGE_DISABLED = SETTINGS.isDisableImages();
// SIMPLE_MESSAGE = SETTINGS.isSimpleMessage();
IS_RARITY_STARS = SettingsParser.isRarityStars();
COPPER = (int) ((SettingsParser.getCopperRates() * 100) + (SettingsParser.getPlatinumRates() * 100));
SILVER = (int) (SettingsParser.getSilverRates() * 100);
GOLD = (int) (SettingsParser.getGoldRates() * 100);
IMAGE_DISABLED = SettingsParser.isDisableImages();
SIMPLE_MESSAGE = SettingsParser.isSimpleMessage();
/* USER */
userMemoryDiamonds = USER.getMemoryDiamonds();
userColBalance = USER.getColBalance();
/* VARIABLES */
RNG = new Random(System.currentTimeMillis());
imageStrings = new String[11];
weapons = new ArrayList<>();
weaponString = "";
tempUserDirectory = new File("images/temp_" + DISCORD_ID);
scoutMenu = new EmbedBuilder();
simpleMessage = "";
guaranteeAutomaticRifle = false;
guaranteeOneGold = false;
/* MEMORY DIAMOND PRICES */
singleScoutPrice = 15;
multiScoutPrice = 150;
/* BANNER */
if (BANNER_ID < BANNERS.size() && BANNER_ID >= 0) {
SELECTED_BANNER = BANNERS.get(BANNER_ID);
BANNER_WEAPONS = SELECTED_BANNER.getWeapons();
bannerTypeData = USER.getBannerData(SELECTED_BANNER.getBannerName() + " Weapons");
if (USER.isBannerInfoExists(SELECTED_BANNER.getBannerName() + " Weapons") == -1) {
initBannerInfo();
}
modifyScoutData();
LOGGER.debug("\n- Scout Data -\n" + "Single Price " + singleScoutPrice + "\n" + "Multi Price: " + multiScoutPrice + "\n" + "COPPER: " + COPPER + "%\n" + "SILVER: " + SILVER + "%\n" + "GOLD: " + GOLD + "%");
}
}
Aggregations