Skip to content

Commit 45520a9

Browse files
feat(): fixed various problems
1 parent cedb1e8 commit 45520a9

4 files changed

Lines changed: 78 additions & 22 deletions

File tree

type.goldmine/src/main/java/net/swofty/type/goldmine/entity/EntityLostPickaxe.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@
77
import net.minestom.server.entity.metadata.display.ItemDisplayMeta;
88
import net.minestom.server.item.ItemStack;
99
import net.minestom.server.item.Material;
10+
import net.swofty.commons.item.ItemType;
1011
import net.swofty.type.generic.data.datapoints.DatapointToggles;
1112
import net.swofty.type.generic.entity.InteractionEntity;
13+
import net.swofty.type.skyblockgeneric.enchantment.EnchantmentType;
14+
import net.swofty.type.skyblockgeneric.enchantment.SkyBlockEnchantment;
15+
import net.swofty.type.skyblockgeneric.item.SkyBlockItem;
16+
import net.swofty.type.skyblockgeneric.mission.MissionData;
17+
import net.swofty.type.skyblockgeneric.mission.missions.lazyminer.MissionFindLazyMinerPickaxe;
1218
import net.swofty.type.skyblockgeneric.user.SkyBlockPlayer;
1319
import org.joml.Quaternionf;
1420

@@ -44,9 +50,26 @@ public void spawn() {
4450
player.sendMessage("§cYou have already picked that up!");
4551
return;
4652
}
53+
54+
// Set the toggle for backwards compatibility and special case handling
4755
player.getToggles().set(DatapointToggles.Toggles.ToggleType.HAS_FOUND_LAZY_MINER_PICKAXE, true);
4856
player.sendMessage("§aYou have found the Lazy Miner's Pickaxe!");
49-
});
57+
58+
// End mission if active (this will start MissionTalkToLazyMiner)
59+
MissionData data = player.getMissionData();
60+
if (data.isCurrentlyActive(MissionFindLazyMinerPickaxe.class)) {
61+
data.endMission(MissionFindLazyMinerPickaxe.class);
62+
}
63+
64+
SkyBlockItem pickaxe = new SkyBlockItem(ItemType.IRON_PICKAXE);
65+
pickaxe.getAttributeHandler().addEnchantment(
66+
new SkyBlockEnchantment(
67+
EnchantmentType.SMELTING_TOUCH,
68+
1
69+
)
70+
);
71+
player.addAndUpdateItem(pickaxe);
72+
});
5073
interactionEntity.setInstance(getInstance(), getPosition().add(0, -0.4, 0));
5174
}
5275
}

type.goldmine/src/main/java/net/swofty/type/goldmine/npcs/NPCLazyMiner.java

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package net.swofty.type.goldmine.npcs;
22

33
import net.minestom.server.coordinate.Pos;
4-
import net.swofty.commons.item.ItemType;
54
import net.swofty.type.generic.data.datapoints.DatapointToggles;
65
import net.swofty.type.generic.entity.npc.NPCDialogue;
76
import net.swofty.type.generic.entity.npc.NPCParameters;
87
import net.swofty.type.generic.user.HypixelPlayer;
98
import net.swofty.type.skyblockgeneric.calendar.SkyBlockCalendar;
9+
import net.swofty.type.skyblockgeneric.mission.MissionData;
10+
import net.swofty.type.skyblockgeneric.mission.missions.lazyminer.MissionFindLazyMinerPickaxe;
11+
import net.swofty.type.skyblockgeneric.mission.missions.lazyminer.MissionTalkToLazyMiner;
1012
import net.swofty.type.skyblockgeneric.skill.SkillCategories;
1113
import net.swofty.type.skyblockgeneric.user.SkyBlockPlayer;
1214

@@ -47,30 +49,48 @@ public boolean looking() {
4749
public void onClick(PlayerClickNPCEvent event) {
4850
SkyBlockPlayer player = (SkyBlockPlayer) event.player();
4951
if (isInDialogue(player)) return;
50-
boolean hasSpokenBefore = player.getToggles().get(DatapointToggles.Toggles.ToggleType.HAS_SPOKEN_TO_LAZY_MINER);
52+
MissionData data = player.getMissionData();
5153

52-
if (!hasSpokenBefore) {
53-
setDialogue(player, "intro").thenRun(() -> {
54-
player.getToggles().set(DatapointToggles.Toggles.ToggleType.HAS_SPOKEN_TO_LAZY_MINER, true);
54+
// Check if mission is completed - show idle dialogue
55+
if (data.hasCompleted(MissionTalkToLazyMiner.class)) {
56+
if (player.getSkills().getCurrentLevel(SkillCategories.MINING) < 5) {
57+
setDialogue(player, "not-reached-deep-caverns");
58+
return;
59+
}
60+
setDialogue(player, "idle");
61+
return;
62+
}
63+
64+
// Check if player needs to return the pickaxe (MissionTalkToLazyMiner is active)
65+
if (data.isCurrentlyActive(MissionTalkToLazyMiner.class)) {
66+
setDialogue(player, "quest-complete").thenRun(() -> {
67+
data.endMission(MissionTalkToLazyMiner.class);
5568
});
5669
return;
5770
}
5871

59-
boolean hasFoundPickaxe = player.getToggles().get(DatapointToggles.Toggles.ToggleType.HAS_FOUND_LAZY_MINER_PICKAXE);
60-
if (!hasFoundPickaxe) {
72+
// Check if player is looking for the pickaxe (MissionFindLazyMinerPickaxe is active)
73+
if (data.isCurrentlyActive(MissionFindLazyMinerPickaxe.class)) {
6174
setDialogue(player, "no-pickaxe-found");
6275
return;
63-
} else if (!player.getCollection().unlocked(ItemType.GOLD_INGOT) || !player.getCollection().unlocked(ItemType.IRON_INGOT)) {
64-
setDialogue(player, "found-pick-no-collection");
65-
return;
6676
}
6777

68-
if (player.getSkills().getCurrentLevel(SkillCategories.MINING) < 5) {
69-
setDialogue(player, "not-reached-deep-caverns");
78+
// First interaction - check special case where player already found pickaxe
79+
boolean hasFoundPickaxe = player.getToggles().get(DatapointToggles.Toggles.ToggleType.HAS_FOUND_LAZY_MINER_PICKAXE);
80+
if (hasFoundPickaxe) {
81+
// Player found the pickaxe before talking to Lazy Miner - skip to talk mission
82+
setDialogue(player, "found-pick-intro").thenRun(() -> {
83+
player.getToggles().set(DatapointToggles.Toggles.ToggleType.HAS_SPOKEN_TO_LAZY_MINER, true);
84+
data.startMission(MissionTalkToLazyMiner.class);
85+
});
7086
return;
7187
}
7288

73-
setDialogue(player, "idle");
89+
// Normal first interaction - start the quest
90+
setDialogue(player, "first-interaction").thenRun(() -> {
91+
player.getToggles().set(DatapointToggles.Toggles.ToggleType.HAS_SPOKEN_TO_LAZY_MINER, true);
92+
data.startMission(MissionFindLazyMinerPickaxe.class);
93+
});
7494
}
7595

7696
@Override
@@ -86,12 +106,16 @@ public DialogueSet[] getDialogueSets(HypixelPlayer player) {
86106
"Find my pickaxe in the Gold Mines! I'm not going back down there..."
87107
}).build(),
88108
DialogueSet.builder()
89-
.key("found-pick-no-collection").lines(new String[]{
90-
"Collect iron and gold ingots with that pickaxe you found!",
91-
"..Or do it the long way and smelt the ore yourself.",
92-
"Smelting Touch is a really useful enchantment. It automatically smelts ores into ingots!"
93-
})
94-
.build(),
109+
.key("found-pick-intro").lines(new String[]{
110+
"Oh! You already found my pickaxe! That's amazing!",
111+
"Keep it, it has a special enchantment. Come talk to me when you're ready!"
112+
}).build(),
113+
DialogueSet.builder()
114+
.key("quest-complete").lines(new String[]{
115+
"You found it! Thank you so much!",
116+
"Keep it as a reward. That pickaxe has Smelting Touch - it automatically smelts ores into ingots!",
117+
"It'll be very useful for collecting iron and gold."
118+
}).build(),
95119
DialogueSet.builder()
96120
.key("not-reached-deep-caverns").lines(new String[]{
97121
"The Deep Caverns are full of strange creatures and expensive treasures.",

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/item/SkyBlockItem.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,15 @@ public static boolean isSkyBlockItem(ItemStack item) {
9292
}
9393

9494
private void loadAsItemType(ItemType type) {
95+
String id = type.name();
96+
config = ConfigurableSkyBlockItem.getFromID(id);
9597
for (ItemAttribute attribute : ItemAttribute.getPossibleAttributes()) {
98+
if (config != null) {
99+
ItemStatistics statistics = config.getDefaultStatistics();
100+
attribute.setValue(attribute.getDefaultValue(statistics));
101+
attributes.add(attribute);
102+
continue;
103+
}
96104
attribute.setValue(attribute.getDefaultValue(null));
97105
attributes.add(attribute);
98106
}
@@ -108,8 +116,6 @@ private void loadAsItemType(ItemType type) {
108116
rarityAttribute.setValue(Rarity.COMMON);
109117
}
110118

111-
String id = type.name();
112-
config = ConfigurableSkyBlockItem.getFromID(id);
113119
if (config == null) {
114120
config = new ConfigurableSkyBlockItem(id,
115121
getMaterial(), List.of(), new HashMap<>());

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/mission/MissionSet.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import net.swofty.type.skyblockgeneric.mission.missions.farmer.MissionCollectWheat;
1313
import net.swofty.type.skyblockgeneric.mission.missions.farmer.MissionTalkToFarmer;
1414
import net.swofty.type.skyblockgeneric.mission.missions.farmer.MissionTalkToFarmerAgain;
15+
import net.swofty.type.skyblockgeneric.mission.missions.lazyminer.MissionFindLazyMinerPickaxe;
16+
import net.swofty.type.skyblockgeneric.mission.missions.lazyminer.MissionTalkToLazyMiner;
1517
import net.swofty.type.skyblockgeneric.mission.missions.lumber.MissionBreakOaklog;
1618
import net.swofty.type.skyblockgeneric.mission.missions.lumber.MissionTalkToLumberjack;
1719
import net.swofty.type.skyblockgeneric.mission.missions.lumber.MissionTalkToLumberjackAgain;
@@ -30,6 +32,7 @@ public enum MissionSet {
3032
FIRST_HARVEST(MissionTalkToFarmer.class, MissionCollectWheat.class, MissionTalkToFarmerAgain.class),
3133
BACK_AT_THE_BARNYARD(MissionTalkToFarmHand.class, MissionCraftWheatMinion.class, MissionTalkToFarmhandAgain.class),
3234
CARPENTRY(MissionGiveWoolToCarpenter.class),
35+
LOST_AND_FOUND(MissionFindLazyMinerPickaxe.class, MissionTalkToLazyMiner.class),
3336
;
3437

3538
private final Class<? extends SkyBlockMission>[] missions;

0 commit comments

Comments
 (0)