Search in sources :

Example 6 with TFModifier

use of com.lilithsthrone.game.inventory.enchanting.TFModifier in project liliths-throne-public by Innoxia.

the class EnchantmentDialogue method inventoryView.

private static String inventoryView() {
    inventorySB.setLength(0);
    ItemEffect effect = new ItemEffect(ingredient.getEnchantmentEffect(), primaryMod, secondaryMod, potency, limit);
    // Primary mods:
    inventorySB.append("<div class='container-half-width' style='padding-bottom:0;'>");
    for (TFModifier tfMod : ingredient.getEnchantmentEffect().getPrimaryModifiers()) {
        inventorySB.append("<div class='modifier-icon " + tfMod.getRarity().getName() + "' style='width:11.5%;'>" + "<div class='modifier-icon-content'>" + tfMod.getSVGString() + "</div>" + "<div class='overlay' id='MOD_PRIMARY_" + tfMod.hashCode() + "'></div>" + "</div>");
    }
    for (int i = 32; i > ingredient.getEnchantmentEffect().getPrimaryModifiers().size(); i--) {
        inventorySB.append("<div class='modifier-icon empty' style='width:11.5%;'></div>");
    }
    inventorySB.append("<div class='container-full-width'>" + "<div class='container-half-width' style='width:78%; margin:0 1%; text-align:center; line-height:100vh;'>" + "<h5 style='margin:0; padding:0;'>Primary Modifier</h5>" + "</div>" + "<div class='container-half-width' style='width:18%; margin:0 1%;'>");
    if (primaryMod != null) {
        inventorySB.append("<div class='modifier-icon " + primaryMod.getRarity().getName() + "' style='width:100%; margin:0;'>" + "<div class='modifier-icon-content'>" + primaryMod.getSVGString() + "</div>" + "<div class='overlay' id='MOD_PRIMARY_ENCHANTING'></div>" + "</div>");
    } else {
        inventorySB.append("<div class='modifier-icon empty' style='width:30%; margin:0 1%;'>" + "<div class='overlay' style='cursor:default;' id='MOD_PRIMARY_ENCHANTING'></div>" + "</div>");
    }
    inventorySB.append("</div></div>");
    inventorySB.append("</div>");
    // Secondary mods:
    inventorySB.append("<div class='container-half-width' style='padding-bottom:0;'>");
    for (TFModifier tfMod : ingredient.getEnchantmentEffect().getSecondaryModifiers(primaryMod)) {
        inventorySB.append("<div class='modifier-icon " + tfMod.getRarity().getName() + "' style='width:11.5%;'>" + "<div class='modifier-icon-content'>" + tfMod.getSVGString() + "</div>" + "<div class='overlay' id='MOD_SECONDARY_" + tfMod.hashCode() + "'></div>" + "</div>");
    }
    for (int i = 32; i > ingredient.getEnchantmentEffect().getSecondaryModifiers(primaryMod).size(); i--) {
        inventorySB.append("<div class='modifier-icon empty' style='width:11.5%;'></div>");
    }
    inventorySB.append("<div class='container-full-width'>" + "<div class='container-half-width' style='width:18%; margin:0 1%;'>");
    if (secondaryMod != null) {
        inventorySB.append("<div class='modifier-icon " + secondaryMod.getRarity().getName() + "' style='width:100%; margin:0;'>" + "<div class='modifier-icon-content'>" + secondaryMod.getSVGString() + "</div>" + "<div class='overlay' id='MOD_SECONDARY_ENCHANTING'></div>" + "</div>");
    } else {
        inventorySB.append("<div class='modifier-icon empty' style='width:30%; margin:0 1%;'>" + "<div class='overlay' style='cursor:default;' id='MOD_SECONDARY_ENCHANTING'></div>" + "</div>");
    }
    inventorySB.append("</div>" + "<div class='container-half-width' style='width:78%; margin:0 1%; text-align:center; line-height:100vh;'>" + "<h5 style='margin:0; padding:0;'>Secondary Modifier</h5>" + "</div>" + "</div>");
    inventorySB.append("</div>");
    // Potency:
    inventorySB.append("<div class='container-full-width' style='text-align:center; padding:8px 0; margin-top:0;'>");
    for (TFPotency potency : TFPotency.values()) {
        inventorySB.append("<div class='normal-button" + (ingredient.getEnchantmentEffect().getPotencyModifiers(primaryMod, secondaryMod).contains(potency) ? "" : " disabled") + (EnchantmentDialogue.potency == potency ? " selected" : "") + "' id='POTENCY_" + potency + "'" + " style='" + (EnchantmentDialogue.potency == potency ? "color:" + potency.getColour().toWebHexString() + ";" : "") + " margin:0 1%; width:14%;'>" + potency.getName() + "</div>");
    }
    inventorySB.append("</div>");
    // Limits:
    int ingredientLimit = ingredient.getEnchantmentEffect().getLimits(primaryMod, secondaryMod);
    if (ingredientLimit != 0) {
        inventorySB.append("<div class='container-full-width' style='text-align:center; padding:8px 0; margin-top:0;'>" + "<div style='float:left; width:14.6%; margin:0 1%; padding:0;'>" + "<div class='normal-button" + (limit == 0 ? " disabled" : "") + "' id='LIMIT_MINIMUM' style='width:100%;'>Limit Min.</div>" + "</div>" + "<div style='float:left; width:14.6%; margin:0 1%; padding:0;'>" + "<div class='normal-button" + (limit == 0 ? " disabled" : "") + "' id='LIMIT_DECREASE_LARGE' style='width:100%;'>Limit--</div>" + "</div>" + "<div style='float:left; width:14.6%; margin:0 1%; padding:0;'>" + "<div class='normal-button" + (limit == 0 ? " disabled" : "") + "' id='LIMIT_DECREASE' style='width:100%;'>Limit-</div>" + "</div>" + "<div style='float:left; width:14.6%; margin:0 1%; padding:0;'>" + "<div class='normal-button" + (limit == ingredientLimit ? " disabled" : "") + "' id='LIMIT_INCREASE' style='width:100%;'>Limit+</div>" + "</div>" + "<div style='float:left; width:14.6%; margin:0 1%; padding:0;'>" + "<div class='normal-button" + (limit == ingredientLimit ? " disabled" : "") + "' id='LIMIT_INCREASE_LARGE' style='width:100%;'>Limit++</div>" + "</div>" + "<div style='float:left; width:14.6%; margin:0 1%; padding:0;'>" + "<div class='normal-button" + (limit == ingredientLimit ? " disabled" : "") + "' id='LIMIT_MAXIMUM' style='width:100%;'>Limit Max.</div>" + "</div>" + "</div>");
    }
    // Effect:
    inventorySB.append("<div class='container-full-width' style='text-align:center; padding:8px 0; margin-top:0;'>");
    inventorySB.append("<div class='container-half-width' style='width:28%; margin:0 1%;'>" + "<b style='color:" + ingredient.getRelatedEssence().getColour().toWebHexString() + ";'>Effect to be added:</b>" + "</div>");
    inventorySB.append("<div class='container-half-width' style='width:48%; margin:0 1%;'>");
    int i = 0;
    if (effect.getEffectsDescription(Main.game.getPlayer(), Main.game.getPlayer()) != null) {
        if (i > 0) {
            inventorySB.append("</br>");
        }
        for (String s : effect.getEffectsDescription(Main.game.getPlayer(), Main.game.getPlayer())) {
            inventorySB.append("<b>" + Util.capitaliseSentence(s) + "</b>");
        }
        i++;
    } else {
        inventorySB.append("<b>-</b>");
    }
    inventorySB.append("</div>");
    inventorySB.append("<div class='container-half-width' style='width:18%; margin:0 1%;'>");
    if (effects.size() >= ingredient.getEnchantmentLimit() || ingredient.getEnchantmentEffect().getEffectsDescription(primaryMod, secondaryMod, potency, limit, Main.game.getPlayer(), Main.game.getPlayer()) == null || ingredient.getEnchantmentEffect().getEffectsDescription(primaryMod, secondaryMod, potency, limit, Main.game.getPlayer(), Main.game.getPlayer()).isEmpty()) {
        inventorySB.append("<div class='normal-button disabled' style='width:100%; margin:auto 0;'>" + "<b>Add</b> | " + UtilText.formatAsEssencesUncoloured(effect.getCost(), "b", false) + "<div class='overlay no-pointer' id='ENCHANT_ADD_BUTTON_DISABLED'></div>" + "</div>");
    } else {
        inventorySB.append("<div class='normal-button' style='width:100%; margin:auto 0;'>" + "<b style='color:" + Colour.GENERIC_GOOD.toWebHexString() + ";'>Add</b> | " + UtilText.formatAsEssences(effect.getCost(), "b", false) + "<div class='overlay' id='ENCHANT_ADD_BUTTON'></div>" + "</div>");
    }
    inventorySB.append("</div>");
    inventorySB.append("</div>");
    // Item crafting:
    inventorySB.append("<div class='container-full-width' style='text-align:center; padding:8px 0; margin-top:0;'>");
    int count = 1;
    if (ingredient instanceof AbstractItem) {
        count = Main.game.getPlayer().getItemCount((AbstractItem) ingredient);
    } else if (ingredient instanceof AbstractClothing) {
        count = Main.game.getPlayer().getClothingCount((AbstractClothing) ingredient);
    } else if (ingredient instanceof AbstractWeapon) {
        count = Main.game.getPlayer().getWeaponCount((AbstractWeapon) ingredient);
    }
    inventorySB.append("<div class='container-half-width' style='width:18%; margin:0 1%; text-align:center;'>");
    inventorySB.append("<b>Input</b>" + "<div class='enchanting-ingredient " + ingredient.getRarity().getName() + "'>" + "<div class='enchanting-ingredient-content'>" + ingredient.getSVGString() + "</div>" + "<div class='overlay' id='INGREDIENT_ENCHANTING'></div>" + "<div class='enchanting-ingredient-count'><b>x" + count + "</b></div>" + "</div>");
    inventorySB.append("</div>");
    // Effects:
    inventorySB.append("<div class='container-half-width' style='width:58%; margin:0 1%;'>");
    inventorySB.append("<b>Effects (</b>" + (effects.size() >= ingredient.getEnchantmentLimit() ? "<b style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>" : "<b>") + "" + effects.size() + "/" + ingredient.getEnchantmentLimit() + "</b><b>)</b></br>" + "<b>" + Util.capitaliseSentence(EnchantingUtils.getPotionName(ingredient, effects)) + "</b> | Cost: " + UtilText.formatAsEssences(EnchantingUtils.getCost(ingredient, effects), "b", false));
    if (effects.isEmpty()) {
        inventorySB.append("</br><span style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>No effects added</span>");
    } else {
        i = 0;
        for (ItemEffect ie : effects) {
            for (String s : ie.getEffectsDescription(Main.game.getPlayer(), Main.game.getPlayer())) {
                inventorySB.append("<div class='container-full-width' style='background:" + RenderingEngine.getEntryBackgroundColour(i % 2 == 0) + "; width:98%; margin:0 1%; padding:2px;'>" + Util.capitaliseSentence(s) + (ingredient.getEffects().size() > i && ingredient.getEffects().get(i).equals(ie) ? "<div class='normal-button' style='width:64px; height:22px; line-height:22px; font-size:16px; margin:0; padding:0 0 0 4px; float:right; text-align:left;'>" + "<b style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>X</b> " + UtilText.formatAsEssences(ie.getCost(), "b", false) + "<div class='overlay' id='DELETE_EFFECT_" + i + "'></div></div>" : "<div class='normal-button' id='DELETE_EFFECT_" + i + "'" + " style='width:22px; height:22px; line-height:22px; font-size:16px; margin:0; padding:0; float:right; color:" + Colour.GENERIC_BAD.toWebHexString() + ";'><b>X</b></div>") + "</div>");
                i++;
            }
        }
    }
    inventorySB.append("</div>");
    inventorySB.append("<div class='container-half-width' style='width:18%; margin:0 1%; text-align:center;'>");
    inventorySB.append("<b>Output</b>" + "<div class='enchanting-ingredient " + ingredient.getEnchantmentItemType(effects).getRarity().getName() + "'>" + "<div class='enchanting-ingredient-content'>" + EnchantingUtils.getSVGString(ingredient, effects) + "</div>" + "<div class='overlay' id='OUTPUT_ENCHANTING'></div>" + "</div>");
    inventorySB.append("</div>");
    inventorySB.append("</div>");
    return inventorySB.toString();
}
Also used : TFModifier(com.lilithsthrone.game.inventory.enchanting.TFModifier) TFPotency(com.lilithsthrone.game.inventory.enchanting.TFPotency) AbstractClothing(com.lilithsthrone.game.inventory.clothing.AbstractClothing) ItemEffect(com.lilithsthrone.game.inventory.item.ItemEffect) AbstractItem(com.lilithsthrone.game.inventory.item.AbstractItem) AbstractWeapon(com.lilithsthrone.game.inventory.weapon.AbstractWeapon)

Example 7 with TFModifier

use of com.lilithsthrone.game.inventory.enchanting.TFModifier in project liliths-throne-public by Innoxia.

the class Vicky method dailyReset.

@Override
public void dailyReset() {
    clearNonEquippedInventory();
    for (int i = 0; i < 2; i++) {
        this.addWeapon(AbstractWeaponType.generateWeapon(WeaponType.OFFHAND_CHAOS_RARE), false);
        this.addWeapon(AbstractWeaponType.generateWeapon(WeaponType.MELEE_CHAOS_RARE), false);
    }
    this.addWeapon(AbstractWeaponType.generateWeapon(WeaponType.OFFHAND_CHAOS_EPIC), false);
    this.addWeapon(AbstractWeaponType.generateWeapon(WeaponType.MELEE_CHAOS_EPIC), false);
    AbstractItem ingredient = AbstractItemType.generateItem(availableIngredients[Util.random.nextInt(availableIngredients.length)]);
    TFModifier primaryMod = TFModifier.getTFRacialBodyPartsList().get(Util.random.nextInt(TFModifier.getTFRacialBodyPartsList().size()));
    for (int i = 0; i < 6; i++) {
        if (ingredient.getEnchantmentEffect().getEffectsDescription(primaryMod, TFModifier.NONE, TFPotency.MINOR_BOOST, 0, Main.game.getPlayer(), Main.game.getPlayer()) != null) {
            this.addItem(EnchantingUtils.craftItem(ingredient, Util.newArrayListOfValues(new ListValue<>(new ItemEffect(ingredient.getEnchantmentEffect(), primaryMod, TFModifier.NONE, TFPotency.MINOR_BOOST, 0)))), false);
        }
        ingredient = AbstractItemType.generateItem(availableIngredients[Util.random.nextInt(availableIngredients.length)]);
        primaryMod = TFModifier.getTFRacialBodyPartsList().get(Util.random.nextInt(TFModifier.getTFRacialBodyPartsList().size()));
    }
    if (Main.game.getPlayer().hasQuest(QuestLine.SIDE_ENCHANTMENT_DISCOVERY)) {
        for (AbstractItemType itemType : ItemType.essences) {
            for (int i = 0; i < 20 + Util.random.nextInt(11); i++) {
                this.addItem(AbstractItemType.generateItem(itemType), false);
            }
        }
    }
}
Also used : TFModifier(com.lilithsthrone.game.inventory.enchanting.TFModifier) AbstractItemType(com.lilithsthrone.game.inventory.item.AbstractItemType) ItemEffect(com.lilithsthrone.game.inventory.item.ItemEffect) AbstractItem(com.lilithsthrone.game.inventory.item.AbstractItem)

Aggregations

TFModifier (com.lilithsthrone.game.inventory.enchanting.TFModifier)7 ItemEffect (com.lilithsthrone.game.inventory.item.ItemEffect)7 TFPotency (com.lilithsthrone.game.inventory.enchanting.TFPotency)4 ArrayList (java.util.ArrayList)4 Attribute (com.lilithsthrone.game.character.attributes.Attribute)2 AbstractItem (com.lilithsthrone.game.inventory.item.AbstractItem)2 AbstractItemType (com.lilithsthrone.game.inventory.item.AbstractItemType)2 Colour (com.lilithsthrone.utils.Colour)2 EnchantmentEventListener (com.lilithsthrone.controller.eventListeners.EnchantmentEventListener)1 InventorySelectedItemEventListener (com.lilithsthrone.controller.eventListeners.InventorySelectedItemEventListener)1 InventoryTooltipEventListener (com.lilithsthrone.controller.eventListeners.InventoryTooltipEventListener)1 SetContentEventListener (com.lilithsthrone.controller.eventListeners.SetContentEventListener)1 TooltipHideEventListener (com.lilithsthrone.controller.eventListeners.TooltipHideEventListener)1 TooltipInformationEventListener (com.lilithsthrone.controller.eventListeners.TooltipInformationEventListener)1 TooltipMoveEventListener (com.lilithsthrone.controller.eventListeners.TooltipMoveEventListener)1 TooltipResponseDescriptionEventListener (com.lilithsthrone.controller.eventListeners.TooltipResponseDescriptionEventListener)1 TooltipResponseMoveEventListener (com.lilithsthrone.controller.eventListeners.TooltipResponseMoveEventListener)1 ButtonCharactersEventListener (com.lilithsthrone.controller.eventListeners.buttons.ButtonCharactersEventListener)1 ButtonCopyDialogueEventListener (com.lilithsthrone.controller.eventListeners.buttons.ButtonCopyDialogueEventListener)1 ButtonInventoryEventHandler (com.lilithsthrone.controller.eventListeners.buttons.ButtonInventoryEventHandler)1