Search in sources :

Example 61 with EmbedBuilder

use of sx.blah.discord.util.EmbedBuilder 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 + "%");
    }
}
Also used : EmbedBuilder(sx.blah.discord.util.EmbedBuilder) Random(java.util.Random) UserParser(io.github.spugn.Sargo.XMLParsers.UserParser) File(java.io.File)

Example 62 with EmbedBuilder

use of sx.blah.discord.util.EmbedBuilder in project KaellyBot by Kaysoro.

the class MapCommand method request.

@Override
public boolean request(IMessage message) {
    if (super.request(message)) {
        Language lg = Translator.getLanguageFrom(message.getChannel());
        List<String> classicMaps = new ArrayList<>();
        for (int i = 1; i < 18; i++) classicMaps.add(String.valueOf(i));
        List<String> maps = new ArrayList<>();
        Matcher m = getMatcher(message);
        m.find();
        if (m.group(1) == null && m.group(2) == null)
            maps.addAll(classicMaps);
        else if (m.group(2) != null) {
            String[] text = m.group(2).trim().toUpperCase().split("\\s+");
            for (String value : text) {
                value = getNumberValue(value);
                if (value != null)
                    maps.add(value);
            }
        } else {
            new BadUseCommandDiscordException().throwException(message, this, lg);
            return false;
        }
        if (m.group(1) == null && maps.isEmpty()) {
            new BadUseCommandDiscordException().throwException(message, this, lg);
            return false;
        } else if (m.group(1) != null) {
            classicMaps.removeAll(maps);
            maps = classicMaps;
        }
        String number = maps.get(new Random().nextInt(maps.size()));
        String url = Constants.turnamentMapImg.replace("{number}", number);
        String[] punchlines = Translator.getLabel(lg, "map.punchline").split(";");
        String punchline = punchlines[new Random().nextInt(punchlines.length)];
        EmbedBuilder builder = new EmbedBuilder();
        builder.withTitle(Translator.getLabel(lg, "map.embed.title") + " " + numberToRoman(number));
        builder.withDescription(punchline);
        builder.withImage(url);
        builder.withColor(new Random().nextInt(16777216));
        builder.withImage(url);
        Message.sendEmbed(message.getChannel(), builder.build());
    }
    return false;
}
Also used : EmbedBuilder(sx.blah.discord.util.EmbedBuilder) Language(enums.Language) Matcher(java.util.regex.Matcher) BadUseCommandDiscordException(exceptions.BadUseCommandDiscordException)

Example 63 with EmbedBuilder

use of sx.blah.discord.util.EmbedBuilder in project KaellyBot by Kaysoro.

the class Item method getEmbedObject.

@Override
public EmbedObject getEmbedObject(Language lg) {
    EmbedBuilder builder = new EmbedBuilder();
    builder.withTitle(name);
    builder.withUrl(url);
    builder.withColor(new Random().nextInt(16777216));
    builder.withThumbnail(skinURL);
    if (level != null && !level.isEmpty())
        builder.appendField(Translator.getLabel(lg, "item.niveau"), level, true);
    builder.appendField(Translator.getLabel(lg, "item.type"), type, true);
    if (effects != null && !effects.isEmpty())
        builder.appendField(Translator.getLabel(lg, "item.effets"), effects, true);
    if (caracteristics != null && !caracteristics.isEmpty())
        builder.appendField(Translator.getLabel(lg, "item.caracteristiques"), caracteristics, true);
    if (conditions != null && !conditions.isEmpty())
        builder.appendField(Translator.getLabel(lg, "item.conditions"), conditions, true);
    if (panoplie != null && panoplieURL != null)
        builder.appendField(Translator.getLabel(lg, "item.panoplie"), "[" + panoplie + "](" + panoplieURL + ")", true);
    return builder.build();
}
Also used : EmbedBuilder(sx.blah.discord.util.EmbedBuilder) Random(java.util.Random)

Example 64 with EmbedBuilder

use of sx.blah.discord.util.EmbedBuilder in project KaellyBot by Kaysoro.

the class Monster method getEmbedObject.

@Override
public EmbedObject getEmbedObject(Language lg) {
    EmbedBuilder builder = new EmbedBuilder();
    builder.withTitle(name);
    builder.withUrl(url);
    builder.withColor(new Random().nextInt(16777216));
    builder.withThumbnail(skinURL);
    if (level != null && !level.isEmpty())
        builder.appendField(Translator.getLabel(lg, "monster.level"), level, true);
    builder.appendField(Translator.getLabel(lg, "monster.race"), family, true);
    if (caracteristics != null && !caracteristics.isEmpty())
        builder.appendField(Translator.getLabel(lg, "monster.caracteristic"), caracteristics, true);
    if (resistances != null && !resistances.isEmpty())
        builder.appendField(Translator.getLabel(lg, "monster.resistance"), resistances, true);
    return builder.build();
}
Also used : EmbedBuilder(sx.blah.discord.util.EmbedBuilder) Random(java.util.Random)

Example 65 with EmbedBuilder

use of sx.blah.discord.util.EmbedBuilder in project KaellyBot by Kaysoro.

the class Resource method getMoreEmbedObject.

@Override
public EmbedObject getMoreEmbedObject(Language lg) {
    EmbedBuilder builder = new EmbedBuilder();
    builder.withTitle(name);
    builder.withUrl(url);
    if (description != null && !description.isEmpty())
        builder.withDescription(description);
    builder.withColor(new Random().nextInt(16777216));
    builder.withImage(skinURL);
    if (level != null && !level.isEmpty())
        builder.appendField(Translator.getLabel(lg, "resource.niveau"), level, true);
    builder.appendField(Translator.getLabel(lg, "resource.type"), type, true);
    if (effects != null && !effects.isEmpty())
        builder.appendField(Translator.getLabel(lg, "resource.effets"), effects, true);
    if (bonus != null && !bonus.isEmpty())
        builder.appendField(Translator.getLabel(lg, "resource.bonus"), bonus, true);
    if (sorts != null && !sorts.isEmpty())
        builder.appendField(Translator.getLabel(lg, "resource.sorts"), sorts, true);
    if (recipe != null)
        builder.appendField(Translator.getLabel(lg, "resource.recette"), recipe, true);
    return builder.build();
}
Also used : EmbedBuilder(sx.blah.discord.util.EmbedBuilder) Random(java.util.Random)

Aggregations

EmbedBuilder (sx.blah.discord.util.EmbedBuilder)103 IOException (java.io.IOException)19 Random (java.util.Random)17 IUser (sx.blah.discord.handle.obj.IUser)14 MissingArgumentException (me.shadorc.shadbot.exception.MissingArgumentException)13 LoadingMessage (me.shadorc.shadbot.utils.object.LoadingMessage)13 EmbedObject (sx.blah.discord.api.internal.json.objects.EmbedObject)12 JSONObject (org.json.JSONObject)11 IMessage (sx.blah.discord.handle.obj.IMessage)10 List (java.util.List)9 AbstractCommand (me.shadorc.shadbot.core.command.AbstractCommand)9 EmbedUtils (me.shadorc.shadbot.utils.embed.EmbedUtils)9 JSONException (org.json.JSONException)9 EventColor (com.cloudcraftgaming.discal.api.enums.event.EventColor)8 Utils (me.shadorc.shadbot.utils.Utils)8 IChannel (sx.blah.discord.handle.obj.IChannel)8 EventData (com.cloudcraftgaming.discal.api.object.event.EventData)7 FormatUtils (me.shadorc.shadbot.utils.FormatUtils)7 File (java.io.File)6 CommandCategory (me.shadorc.shadbot.core.command.CommandCategory)6