Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public enum ItemType {
NEW_YEAR_CAKE(Material.CAKE, Rarity.SPECIAL),
NEW_YEAR_CAKE_BAG(Material.PLAYER_HEAD, Rarity.UNCOMMON),

RAW_SOULFLOW(Material.PLAYER_HEAD, Rarity.UNCOMMON),
SOULFLOW(Material.PLAYER_HEAD, Rarity.RARE),

/**
* Accessories
*/
Expand Down Expand Up @@ -621,6 +624,8 @@ public enum ItemType {
ASPECT_OF_THE_END(Material.DIAMOND_SWORD, Rarity.RARE),
SQUIRE_SWORD(Material.IRON_SWORD, Rarity.UNCOMMON),
MERCENARY_AXE(Material.IRON_AXE, Rarity.RARE),
ASPECT_OF_THE_DRAGON(Material.DIAMOND_SWORD, Rarity.LEGENDARY),
ASPECT_OF_THE_VOID(Material.DIAMOND_SHOVEL, Rarity.EPIC),

/**
* Shovels
Expand Down
17 changes: 17 additions & 0 deletions configuration/skyblock/items/miscellaneous/soulflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
items:
- id: RAW_SOULFLOW
material: PLAYER_HEAD
rarity: UNCOMMON
components:
- id: SOULFLOW
amount: 1
- id: SKULL_HEAD
texture: 84f0214329bb2575b8f4d7623376255d7ec4a439296e140ae9a2c6138a4270c1
- id: SOULFLOW
material: PLAYER_HEAD
rarity: RARE
components:
- id: SOULFLOW
amount: 160
- id: SKULL_HEAD
texture: bc85e2fdf9b1b020ac2827d11ae00d90f81c5c6bd361cbd1c8b8e9087757e4b0
38 changes: 38 additions & 0 deletions configuration/skyblock/items/weapons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,25 @@ items:
type: ASPECT_OF_THE_JERRY
amount: 1

- id: ASPECT_OF_THE_DRAGON
material: DIAMOND_SWORD
rarity: LEGENDARY
abilities:
- DRAGON_RAGE
default_statistics:
damage: 225
strength: 100
components:
- id: ABILITY
abilities:
- DRAGON_RAGE
- id: SELLABLE
value: 100000
- id: STANDARD_ITEM
standard_item_type: SWORD
- id: CUSTOM_DISPLAY_NAME
display_name: "Aspect of the Dragons"

- id: END_SWORD
material: IRON_SWORD
rarity: UNCOMMON
Expand All @@ -58,6 +77,25 @@ items:
- id: STANDARD_ITEM
standard_item_type: SWORD

- id: ASPECT_OF_THE_VOID
material: DIAMOND_SHOVEL
rarity: EPIC
default_statistics:
damage: 120
strength: 100
abilities:
- INSTANT_TRANSMISSION
- ETHER_TRANSMISSION
components:
- id: ABILITY
abilities:
- INSTANT_TRANSMISSION
- ETHER_TRANSMISSION
- id: STANDARD_ITEM
standard_item_type: SWORD
- id: CUSTOM_DISPLAY_NAME
display_name: "Aspect of the Void"

- id: FANCY_SWORD
material: GOLDEN_SWORD
rarity: UNCOMMON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,9 @@ DatapointInteger.class, new DatapointInteger("latest_new_year_cake_year", 0)),
LATEST_YEAR_PRESENT_PICKUP("latest_year_pickup_present", false, false, false,
DatapointPresentYear.class, new DatapointPresentYear("latest_year_pickup_present")),

SOULFLOW("soulflow", false, false, false,
DatapointInteger.class, new DatapointInteger("soulflow", 0)),

KAT("kat", false, false, false,
DatapointKat.class, new DatapointKat("kat")),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ public void run(PlayerHandAnimationEvent event) {

if (item.hasComponent(AbilityComponent.class)) {
AbilityComponent abilityComponent = item.getComponent(AbilityComponent.class);
RegisteredAbility ability = abilityComponent.getAbility(RegisteredAbility.AbilityActivation.LEFT_CLICK);

RegisteredAbility ability = null;
if(player.isSneaking()) {
ability = abilityComponent.getAbility(RegisteredAbility.AbilityActivation.SNEAK_LEFT_CLICK);
}
if (ability == null) {
abilityComponent.getAbility(RegisteredAbility.AbilityActivation.LEFT_CLICK);
}

if (ability != null) {
if (!ability.getCost().canUse(player)) {
ability.getCost().onFail(player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ public void run(PlayerUseItemEvent event) {

if (item.hasComponent(AbilityComponent.class)) {
AbilityComponent abilityComponent = item.getComponent(AbilityComponent.class);
RegisteredAbility ability = abilityComponent.getAbility(RegisteredAbility.AbilityActivation.RIGHT_CLICK);

RegisteredAbility ability = null;
if(player.isSneaking()) {
ability = abilityComponent.getAbility(RegisteredAbility.AbilityActivation.SNEAK_RIGHT_CLICK);
}
if (ability == null) {
abilityComponent.getAbility(RegisteredAbility.AbilityActivation.RIGHT_CLICK);
}

if (ability != null) {
if (!ability.getCost().canUse(player)) {
ability.getCost().onFail(player);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package net.swofty.type.skyblockgeneric.gui.inventories;

import net.minestom.server.event.inventory.InventoryPreClickEvent;
import net.minestom.server.inventory.InventoryType;
import net.minestom.server.item.ItemStack;
import net.swofty.type.generic.data.datapoints.DatapointInteger;
import net.swofty.type.generic.gui.inventory.HypixelInventoryGUI;
import net.swofty.type.generic.gui.inventory.ItemStackCreator;
import net.swofty.type.generic.gui.inventory.item.GUIClickableItem;
import net.swofty.type.generic.user.HypixelPlayer;
import net.swofty.type.skyblockgeneric.data.SkyBlockDataHandler;
import net.swofty.type.skyblockgeneric.item.SkyBlockItem;
import net.swofty.type.skyblockgeneric.item.components.SoulflowComponent;
import net.swofty.type.skyblockgeneric.user.SkyBlockPlayer;

public class GUIConsumeSoulflow extends HypixelInventoryGUI {

private final SkyBlockItem item;

public GUIConsumeSoulflow(SkyBlockItem item) {
super("Consume Soulflow?", InventoryType.CHEST_4_ROW);
this.item = item;

if (!item.hasComponent(SoulflowComponent.class)) {
throw new IllegalArgumentException("Item does not have SoulflowComponent");
}
}

@Override
public void onOpen(InventoryGUIOpenEvent e) {
fill(FILLER_ITEM);
set(new GUIClickableItem(13) {
@Override
public void run(InventoryPreClickEvent e, HypixelPlayer p) {
SkyBlockPlayer player = (SkyBlockPlayer) p;
SkyBlockDataHandler data = player.getSkyblockDataHandler();
int soulflow = data.get(SkyBlockDataHandler.Data.SOULFLOW, DatapointInteger.class).getValue();
int itemSoulflow = item.getComponent(SoulflowComponent.class).getAmount();
int addition = item.getAmount() * itemSoulflow;

data.get(SkyBlockDataHandler.Data.SOULFLOW, DatapointInteger.class).setValue(soulflow + addition);
player.sendMessage("§bYou internalized §3+" + addition + "⸎ Soulflow §band have a total of §3" + (soulflow + addition) + "⸎§b!");

player.getInventory().setItemStack(player.getHeldSlot(), ItemStack.AIR);
player.closeInventory();
}

@Override
public ItemStack.Builder getItem(HypixelPlayer p) {
SkyBlockPlayer player = (SkyBlockPlayer) p;
SkyBlockDataHandler data = player.getSkyblockDataHandler();
int soulflow = data.get(SkyBlockDataHandler.Data.SOULFLOW, DatapointInteger.class).getValue();

int itemSoulflow = item.getComponent(SoulflowComponent.class).getAmount();
int addition = item.getAmount() * itemSoulflow;

return ItemStackCreator.getStackHead(
"§aConsume Soulflow?",
"94f0c693b85658b0bae792c9f9b717eb024ab8c4b349455648ea08358b50ddc4",
1,
"§7Takes all the §3⸎ Soulflow §7items in",
"§7your inventory and internalizes them",
"§7to be ready for use.",
"",
"§7Internalized: §3" + soulflow + "⸎",
"",
"§7Adding from inventory: §3+" + addition + "⸎ Soulflow",
"",
"§eClick to consume!"
);
}
});
set(GUIClickableItem.getCloseItem(31));
updateItemStacks(getInventory(), getPlayer());
}

@Override
public boolean allowHotkeying() {
return false;
}

@Override
public void onBottomClick(InventoryPreClickEvent e) {
e.setCancelled(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ public static ConfigurableSkyBlockItem parseItem(Map<String, Object> config) {
List<ItemAnimation> animations = (List<ItemAnimation>) config.get("disabled_animations");
yield new DisableAnimationComponent(animations);
}
case "SOULFLOW" -> {
int amount = (int) config.get("amount");
yield new SoulflowComponent(amount);
}
case "DRILL" -> new DrillComponent();
case "ABIPHONE" -> {
List<String> features = (List<String>) config.get("features");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package net.swofty.type.skyblockgeneric.item.components;

import lombok.Getter;
import net.swofty.type.skyblockgeneric.gui.inventories.GUIConsumeSoulflow;
import net.swofty.type.skyblockgeneric.item.SkyBlockItemComponent;

import java.util.List;

public class SoulflowComponent extends SkyBlockItemComponent {

@Getter
private final int amount;

public SoulflowComponent(int amount) {
addInheritedComponent(new LoreUpdateComponent(
List.of(
"§7Hold and right-click to consume,",
"§7gaining §3+" + amount + "⸎ Soulflow§7."
), false
));
addInheritedComponent(
new InteractableComponent((player, item) -> {
new GUIConsumeSoulflow(item).open(player);
}, null, null)
);
this.amount = amount;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package net.swofty.type.skyblockgeneric.item.handlers.ability;

import net.minestom.server.coordinate.BlockVec;
import net.minestom.server.coordinate.Point;
import net.minestom.server.coordinate.Pos;
import net.swofty.type.skyblockgeneric.item.handlers.ability.abilities.BuildersWandAbility;

import java.util.HashMap;
Expand All @@ -24,13 +27,29 @@ public class AbilityRegistry {
register(new RegisteredAbility(
"INSTANT_TRANSMISSION",
"Instant Transmission",
"§7Teleports §a8 Blocks §7ahead of you and gain §a+50 §fSpeed for §a3 seconds§f.",
"§7Teleports §a8 Blocks §7ahead of you and gain §a+50 §fSpeed for §a3 seconds§7.",
RegisteredAbility.AbilityActivation.RIGHT_CLICK,
5,
new RegisteredAbility.AbilityManaCost(50),
(player, item, ignored, ignored2) -> {
player.teleport(player.getPosition().add(player.getPosition().direction().mul(8)));
// add speed too
// TODO: add speed too
}
));

register(new RegisteredAbility(
"ETHER_TRANSMISSION",
"Ether Transmission",
"§7Teleport to your targeted block up to §a57 §7blocks away.",
RegisteredAbility.AbilityActivation.SNEAK_RIGHT_CLICK,
5,
new RegisteredAbility.AbilityManaSoulflowCost(180, 1),
(player, item, ignored, ignored2) -> {
Point targetedBlock = player.getTargetBlockPosition(57);
if (targetedBlock == null) return;
BlockVec tpPos = targetedBlock.asBlockVec();
if (!player.getInstance().getBlock(tpPos.add(0, 1, 0)).isAir() || !player.getInstance().getBlock(tpPos.add(0, 2, 0)).isAir()) return; // TODO: don't consume mana/soulflow if teleport fails
player.teleport(new Pos(tpPos.add(0, 1, 0), player.getPosition().yaw(), player.getPosition().pitch()));
}
));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import lombok.NonNull;
import net.minestom.server.coordinate.Point;
import net.minestom.server.instance.block.BlockFace;
import net.swofty.type.generic.data.datapoints.DatapointInteger;
import net.swofty.type.skyblockgeneric.data.SkyBlockDataHandler;
import net.swofty.type.skyblockgeneric.item.SkyBlockItem;
import net.swofty.type.skyblockgeneric.user.SkyBlockActionBar;
import net.swofty.type.skyblockgeneric.user.SkyBlockPlayer;
Expand Down Expand Up @@ -57,6 +59,8 @@ public enum AbilityActivation {
LEFT_CLICK("LEFT CLICK"),
LEFT_CLICK_BLOCK("LEFT CLICK"),
RIGHT_CLICK_BLOCK("RIGHT CLICK"),
SNEAK_RIGHT_CLICK("SNEAK RIGHT CLICK"),
SNEAK_LEFT_CLICK("SNEAK LEFT CLICK")
;

private final @NonNull String display;
Expand Down Expand Up @@ -116,6 +120,65 @@ public String getLoreDisplay() {
}
}

public static class AbilityManaSoulflowCost extends AbilityCost {
private final int cost;
private final int soulflow;

public AbilityManaSoulflowCost(int cost, int soulflow) {
this.cost = cost;
this.soulflow = soulflow;
}

@Override
public boolean canUse(@NotNull SkyBlockPlayer player) {
return (player.getMana() >= cost) && (player.getSkyblockDataHandler().get(SkyBlockDataHandler.Data.SOULFLOW, DatapointInteger.class).getValue() >= soulflow);
}

@Override
public void onUse(@NonNull SkyBlockPlayer player, @NonNull RegisteredAbility ability) {
SkyBlockActionBar.getFor(player).addReplacement(
SkyBlockActionBar.BarSection.MANA,
new SkyBlockActionBar.DisplayReplacement(
"§b-" + cost + " (§6" + ability.getName() + "§b)",
20,
2
)
);
player.setMana(player.getMana() - cost);
player.getSkyblockDataHandler().get(SkyBlockDataHandler.Data.SOULFLOW, DatapointInteger.class).setValue(
player.getSkyblockDataHandler().get(SkyBlockDataHandler.Data.SOULFLOW, DatapointInteger.class).getValue() - soulflow
);
}

@Override
public void onFail(@NonNull SkyBlockPlayer player) {
if (player.getSkyblockDataHandler().get(SkyBlockDataHandler.Data.SOULFLOW, DatapointInteger.class).getValue() < soulflow) {
SkyBlockActionBar.getFor(player).addReplacement(
SkyBlockActionBar.BarSection.MANA,
new SkyBlockActionBar.DisplayReplacement(
"§c§lNOT ENOUGH SOULFLOW",
20 * 2,
2
)
);
return;
}
SkyBlockActionBar.getFor(player).addReplacement(
SkyBlockActionBar.BarSection.MANA,
new SkyBlockActionBar.DisplayReplacement(
"§c§lNOT ENOUGH MANA",
20 * 2,
2
)
);
}

@Override
public String getLoreDisplay() {
return "§8Soulflow Cost: §3" + soulflow + "\n§8Mana Cost: §3" + cost;
}
}

public static class NoAbilityCost extends AbilityCost {
@Override
public boolean canUse(@NotNull SkyBlockPlayer player) {
Expand Down