Skip to content

Commit 0f6e46d

Browse files
committed
feat: add Juliette, Viking and Romero dialogue
1 parent 7dd1793 commit 0f6e46d

5 files changed

Lines changed: 606 additions & 6 deletions

File tree

type.generic/src/main/java/net/swofty/type/generic/entity/npc/DialogueController.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ public void cancelDialogue(HypixelPlayer player) {
6464
}
6565

6666
private void handleLineSendingLoop(HypixelPlayer player, HypixelNPC.DialogueSet dialogueSet) {
67-
npc.sendNPCMessage(player, dialogueSet.lines()[0]);
67+
if (dialogueSet.sound() != null) {
68+
npc.sendNPCMessage(player, dialogueSet.lines()[0], dialogueSet.sound());
69+
} else {
70+
npc.sendNPCMessage(player, dialogueSet.lines()[0]);
71+
}
6872

6973
String[] newLines = new String[dialogueSet.lines().length - 1];
7074
System.arraycopy(dialogueSet.lines(), 1, newLines, 0, dialogueSet.lines().length - 1);
@@ -85,6 +89,7 @@ private void handleLineSendingLoop(HypixelPlayer player, HypixelNPC.DialogueSet
8589
handleLineSendingLoop(player, HypixelNPC.DialogueSet.builder()
8690
.key(dialogueSet.key())
8791
.lines(newLines)
92+
.sound(dialogueSet.sound())
8893
.build());
8994
}
9095
}).delay(TaskSchedule.seconds(2)).schedule();

type.generic/src/main/java/net/swofty/type/generic/entity/npc/HypixelNPC.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,14 @@ public void unregister() {
231231
}
232232

233233
public void sendNPCMessage(HypixelPlayer player, String message) {
234-
player.sendMessage("§e[NPC] " + getName() + "§f: " + message);
235-
player.playSound(Sound.sound().type(Key.key("entity.villager.celebrate")).volume(1.0f).pitch(0.8f + new Random().nextFloat() * 0.4f).build());
234+
sendNPCMessage(player, message, Sound.sound().type(Key.key("entity.villager.celebrate")).volume(1.0f).pitch(0.8f + new Random().nextFloat() * 0.4f).build());
236235
}
237236

237+
public void sendNPCMessage(HypixelPlayer player, String message, Sound sound) {
238+
player.sendMessage("§e[NPC] " + getName() + "§f: " + message);
239+
player.playSound(sound);
240+
}
241+
238242
protected DialogueController dialogue() {
239243
return dialogueController;
240244
}
@@ -299,7 +303,7 @@ public Map.Entry<PlayerHolograms.ExternalPlayerHologram, Entity> get(HypixelNPC
299303
}
300304

301305
@Builder
302-
public record DialogueSet(String key, String[] lines) {
306+
public record DialogueSet(String key, String[] lines, Sound sound) {
303307
public static final DialogueSet[] EMPTY = new DialogueSet[0];
304308
}
305309
}

type.thepark/src/main/java/net/swofty/type/thepark/npcs/NPCJuliette.java

Lines changed: 167 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
import net.swofty.type.generic.entity.npc.configuration.HumanConfiguration;
66
import net.swofty.type.generic.event.custom.NPCInteractEvent;
77
import net.swofty.type.generic.user.HypixelPlayer;
8+
import net.swofty.type.skyblockgeneric.user.SkyBlockPlayer;
9+
10+
import java.util.List;
811

912
public class NPCJuliette extends HypixelNPC {
1013

1114
public NPCJuliette() {
1215
super(new HumanConfiguration() {
1316
@Override
1417
public String[] holograms(HypixelPlayer player) {
15-
return new String[]{"Juliette"};
18+
return new String[]{"Juliette", "§e§lCLICK"};
1619
}
1720

1821
@Override
@@ -39,6 +42,169 @@ public boolean looking(HypixelPlayer player) {
3942

4043
@Override
4144
public void onClick(NPCInteractEvent event) {
45+
SkyBlockPlayer player = (SkyBlockPlayer) event.getPlayer();
46+
if (isInDialogue(player)) return;
4247

48+
setDialogue(player, "q1-start");
4349
}
50+
51+
@Override
52+
protected DialogueSet[] dialogues(HypixelPlayer player) {
53+
return List.of(
54+
55+
DialogueSet.builder().key("completing-step-not-holding").lines(
56+
new String[]{
57+
"You found §eRomero§f?",
58+
"Did he have anything for me?"
59+
}
60+
).build(),
61+
62+
// Quest Step 1 – Savanna Woodland
63+
DialogueSet.builder().key("q1-start").lines(new String[]{
64+
"Nice to meet you!",
65+
"Could you find my dear §eRomero§f?",
66+
"He's in a cave somewhere under the §aSavanna Woodland§f.",
67+
"...",
68+
"Oh!",
69+
"He wears glasses and blends well in a crowd!"
70+
}).build(),
71+
72+
DialogueSet.builder().key("q1-complete").lines(new String[]{
73+
"You found Romero? That's weird, I just saw him!",
74+
"He wanted me to have this? So sweet!",
75+
"...",
76+
"A yellow rock? What's the point of that?",
77+
"Here, you keep it!"
78+
}).build(),
79+
80+
// Quest Step 2 – Flower House
81+
DialogueSet.builder().key("q2-start").lines(new String[]{
82+
"Since you're here, can you find Romero again?",
83+
"He said he was getting groceries at the downtown markets."
84+
}).build(),
85+
86+
DialogueSet.builder().key("q2-complete").lines(new String[]{
87+
"Romero? He just came over with the groceries.",
88+
"These flowers are for me?",
89+
"That's so kind of you!",
90+
"You know I'm with Romero, right?"
91+
}).build(),
92+
93+
// Quest Step 3 – Graveyard
94+
DialogueSet.builder().key("q3-start").lines(new String[]{
95+
"Dear, sorry for the inconvenience...",
96+
"Can you please find Romero again?",
97+
"He's at some sort of emerald altar..."
98+
}).build(),
99+
100+
DialogueSet.builder().key("q3-complete").lines(new String[]{
101+
"Oof! Why did you bring this all the way here?",
102+
"How is that a gift?",
103+
"Just keep it! I don't want this!"
104+
}).build(),
105+
106+
// Quest Step 4 – Crimson Isle
107+
DialogueSet.builder().key("q4-start").lines(new String[]{
108+
"What I want is Romero!",
109+
"For some reason, he's now looking for...",
110+
"The largest, most evil patch of fungus ever!"
111+
}).build(),
112+
113+
DialogueSet.builder().key("q4-complete").lines(new String[]{
114+
"Stew? I love stew!",
115+
"...",
116+
"!!!",
117+
"Yuck!!!",
118+
"Yuck!!!",
119+
"Yuck!!!",
120+
"Yuck!!!",
121+
"Yuck!!!",
122+
"DISGUSTING!",
123+
"Is that a stew from hell?",
124+
"Maybe Romero should give you cooking lessons!"
125+
}).build(),
126+
127+
// Quest Step 5 – Mountain
128+
DialogueSet.builder().key("q5-start").lines(new String[]{
129+
"Oh! I love Romero! He has so many skills.",
130+
"Did you know he likes photography?",
131+
"Just now, he went to take pictures of the old castle.",
132+
"Go find him!"
133+
}).build(),
134+
135+
DialogueSet.builder().key("q5-complete").lines(new String[]{
136+
"You really believe that this is from the Moon?",
137+
"How? Someone flew up there?",
138+
"Thanks, I guess.",
139+
"Actually, I heard Romero flew close to the Sun.",
140+
"Sounds more like a metaphor, like..."
141+
}).build(),
142+
143+
// Quest Step 6 – Gold Mine
144+
DialogueSet.builder().key("q6-start").lines(new String[]{
145+
"He went to where gold is smelted.",
146+
"Please find him, wherever that is!"
147+
}).build(),
148+
149+
DialogueSet.builder().key("q6-complete").lines(new String[]{
150+
"This is a wonderful gift!",
151+
"I will keep this one for myself.",
152+
"Sometimes, some things have to remain a mystery."
153+
}).build(),
154+
155+
// Quest Step 7 – Wilderness
156+
DialogueSet.builder().key("q7-start").lines(new String[]{
157+
"About something not so secret, can you get in touch with Romero?",
158+
"He told me he's in his home."
159+
}).build(),
160+
161+
DialogueSet.builder().key("q7-complete").lines(new String[]{
162+
"Uh? Romero solved his cube?",
163+
"That's unbelievable.",
164+
"No, really, I don't believe it at all."
165+
}).build(),
166+
167+
// Quest Step 8 – Colosseum
168+
DialogueSet.builder().key("q8-start").lines(new String[]{
169+
"I don't know why Romero is trying to be so unlike himself lately.",
170+
"I like him just the way he is!",
171+
"He says he's getting equipment for a duel.",
172+
"Can you find Romero before he hurts himself?"
173+
}).build(),
174+
175+
DialogueSet.builder().key("q8-complete").lines(new String[]{
176+
"This is a wonderful poem.",
177+
"But, does he really think there's someone else?",
178+
"I can't possibly imagine why he'd think that."
179+
}).build(),
180+
181+
// Quest Step 9 – Mushroom Desert
182+
DialogueSet.builder().key("q9-start").lines(new String[]{
183+
"Romero went to meditate at his retreat.",
184+
"It's the smallest house in SkyBlock.",
185+
"Please find him, I'm worried!"
186+
}).build(),
187+
188+
DialogueSet.builder().key("q9-complete").lines(new String[]{
189+
"Another gift from Romero?",
190+
"Thank you for delivering it.",
191+
"I don't know how Romero has such hard a time understanding that I LOVE HIM.",
192+
"I like him just the way he is!",
193+
"I don't need tons of gifts to know that."
194+
}).build(),
195+
196+
// Quest Step 10 – Jungle Island
197+
DialogueSet.builder().key("q10-before-suit").lines(new String[]{
198+
"It's decided, this is the day!",
199+
"We're making it official!"
200+
}).build(),
201+
202+
DialogueSet.builder().key("q10-after-suit").lines(new String[]{
203+
"We can't thank you enough for bringing us together!",
204+
"You're the best, <player>!"
205+
}).build()
206+
207+
).toArray(DialogueSet[]::new);
208+
}
209+
44210
}

type.thepark/src/main/java/net/swofty/type/thepark/npcs/NPCMelancholicViking.java

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
package net.swofty.type.thepark.npcs;
22

3+
import net.kyori.adventure.key.Key;
4+
import net.kyori.adventure.sound.Sound;
35
import net.minestom.server.coordinate.Pos;
6+
import net.minestom.server.item.ItemStack;
7+
import net.minestom.server.item.Material;
48
import net.swofty.type.generic.entity.npc.HypixelNPC;
59
import net.swofty.type.generic.entity.npc.configuration.HumanConfiguration;
610
import net.swofty.type.generic.event.custom.NPCInteractEvent;
711
import net.swofty.type.generic.user.HypixelPlayer;
12+
import net.swofty.type.skyblockgeneric.user.SkyBlockPlayer;
13+
import org.jspecify.annotations.NonNull;
14+
15+
import java.time.LocalDate;
16+
import java.time.Period;
17+
import java.util.List;
818

919
public class NPCMelancholicViking extends HypixelNPC {
1020

1121
public NPCMelancholicViking() {
1222
super(new HumanConfiguration() {
1323
@Override
1424
public String[] holograms(HypixelPlayer player) {
15-
return new String[]{aMelancholic Viking", "§e§lCLICK"};
25+
return new String[]{bMelancholic Viking", "§e§lCLICK"};
1626
}
1727

1828
@Override
@@ -34,11 +44,86 @@ public Pos position(HypixelPlayer player) {
3444
public boolean looking(HypixelPlayer player) {
3545
return true;
3646
}
47+
48+
@Override
49+
public @NonNull String chatName() {
50+
return "§bViking";
51+
}
3752
});
3853
}
3954

4055
@Override
4156
public void onClick(NPCInteractEvent event) {
57+
SkyBlockPlayer player = (SkyBlockPlayer) event.getPlayer();
58+
if (isInDialogue(player)) return;
59+
60+
ItemStack heldItemStack = player.getItemInMainHand();
61+
Material heldItem = heldItemStack.material();
62+
if (heldItem.name().endsWith("_boat")) {
63+
setDialogue(player, "holding-boat");
64+
return;
65+
}
66+
if (heldItem == Material.ICE || heldItem == Material.PACKED_ICE) {
67+
setDialogue(player, "holding-ice");
68+
return;
69+
}
70+
if (heldItem == Material.COD || heldItem == Material.SALMON) {
71+
setDialogue(player, "holding-raw-fish");
72+
return;
73+
}
74+
if (heldItem == Material.FISHING_ROD) {
75+
setDialogue(player, "holding-fishing-rod");
76+
return;
77+
}
78+
// TODO: finish this monstrosity
79+
}
80+
81+
@Override
82+
protected DialogueSet[] dialogues(HypixelPlayer player) {
83+
LocalDate pastDate = LocalDate.of(2009, 9, 1);
84+
LocalDate now = LocalDate.now();
85+
Period period = Period.between(pastDate, now);
86+
int years = period.getYears();
87+
int months = period.getMonths();
4288

89+
return List.of(
90+
DialogueSet.builder().key("intro").lines(new String[]{
91+
"I last saw the sea §b" + years + " years, " + months + " months §fago.",
92+
"I wish I could remember what it felt like!",
93+
"Sadly, my memory is now my worst enemy.",
94+
"Please, help me remember the §bsea§f."
95+
}).sound(Sound.sound().type(Key.key("entity.villager.hurt")).pitch(0.5f).volume(0.9f).build()).build(),
96+
DialogueSet.builder().key("holding-boat").lines(new String[]{
97+
"Wow!",
98+
"A boat!",
99+
"Throw them at people you hate"
100+
}).build(),
101+
DialogueSet.builder().key("starting-to-splash").lines(new String[]{
102+
"§aYES! §fThis totally reminds me of the sea!",
103+
"Although... there were §amore §ffishes back then."
104+
}).build(),
105+
DialogueSet.builder().key("enough-splashes").lines(new String[]{
106+
"§a§lWOW! §fThis §bfeels §fjust like on my Drakkar!",
107+
"I suddenly feel so great!",
108+
"Thanks for bringing §ejoy §ejoy §fto an old viking!",
109+
"Take a look at my wares!"
110+
}).build(),
111+
DialogueSet.builder().key("splashing-no-requirements").lines(new String[]{
112+
"§eWow! Nice move! §fThere just isn't the ambience to fully appreciate it."
113+
}).build(),
114+
DialogueSet.builder().key("holding-ice").lines(new String[]{
115+
"Don't you have some liquid water?"
116+
}).build(),
117+
DialogueSet.builder().key("holding-raw-fish").lines(new String[]{
118+
"I prefer when the fishes are lively and go splish-splash in the water!"
119+
}).build(),
120+
DialogueSet.builder().key("holding-fishing-rod").lines(new String[]{
121+
"It's a nice thought, but I don't feel like fishing right now."
122+
}).build(),
123+
DialogueSet.builder().key("holding-magical-water-bucket").lines(new String[]{
124+
"There's as much water here as an ocean.",
125+
"If only you could pour it somewhere!"
126+
}).build()
127+
).toArray(DialogueSet[]::new);
43128
}
44129
}

0 commit comments

Comments
 (0)