68public class TutorialActivity
extends Activity {
71 private final Player player;
83 private final DialogueFactory factory;
85 private boolean completed =
false;
89 private TutorialActivity(Player player) {
90 super(2, player.playerAssistant.instance());
93 this.factory = player.dialogueFactory;
97 public static TutorialActivity create(Player player) {
98 TutorialActivity activity =
new TutorialActivity(player);
99 player.runEnergy = 100;
100 CombatSpecial.restore(player, 100);
101 player.send(
new SendSpecialAmount());
102 player.movement.setRunningToggled(
false);
103 player.playerAssistant.setSidebar(
true);
104 player.setVisible(
false);
105 player.move(Config.DEFAULT_POSITION);
106 activity.cooldown(3);
107 activity.add(player);
108 player.locking.lock();
114 private void update(String... strings) {
115 ActivityPanel.update(player, (
int) Utility.getPercentageAmount(stage, 27),
"Tutorial",
"Progress", strings);
119 public void cooldown(
int cooldown) {
120 super.cooldown(cooldown);
124 private void next() {
130 protected void start() {
133 guide =
new Npc(306,
new Position(3086, 3492));
135 guide.graphic(
new Graphic(86,
true));
139 guide.face(player.getPosition());
140 guide.animate(
new Animation(863));
141 guide.speak(
"Hello, " + player.getName() +
"!");
145 guide.walkExactlyTo(
new Position(3086, 3490));
149 player.face(guide.getPosition());
150 factory.sendNpcChat(306,
"Welcome to <col=D63E3E>Tarnish</col>, " + player.getName(),
"Would you like a tutorial of our lands?");
151 factory.sendOption(
"Yes", () -> cooldown(1),
"No", this::finish);
156 update(
"This is the activity panel.",
"The activity panel replaces a lot",
"of interfaces so be sure",
"to get acquainted to it.");
157 factory.sendNpcChat(306,
"Wise choice my friend! Let's get started.",
"The first thing you need to know about is the",
"activity panel. When you are doing an activity,",
"like this tutorial for example; a panel will be available to you.");
158 factory.sendNpcChat(306,
"You can access this panel by clicking the red tab icon.",
"The activity panel is disabled by default but will",
"automatically enable when in a activity.");
159 factory.onAction(() -> cooldown(1));
164 factory.sendNpcChat(306,
"Before I show you around I want to show you",
"useful content for your adventures.");
165 factory.onAction(() -> {
166 player.interfaceManager.setSidebar(Config.QUEST_TAB, 29400);
167 player.send(
new SendForceTab(Config.QUEST_TAB));
174 factory.sendNpcChat(306,
"This is your quest tab. Inside contains information about",
"the world and yourself. On the top right corner of the",
"tab you will see a bunch of different buttons.");
175 factory.sendNpcChat(306,
"The blue button will show you the quest tab",
"and the green button will show you the achievement tab.");
176 factory.sendNpcChat(306,
"The red button will provide you with various options.",
"Some of these options include - npc drop viwer,",
"log drop simulator, log kill logs, title manager and more!");
177 factory.sendNpcChat(306,
"Lastly, the scroll button will open a menu where you can",
"change game related options. For example: welcome screen,",
" triviabot, drop notification, and more! These options",
"are not to be confused with the client options.");
178 factory.onAction(() -> {
179 player.interfaceManager.setSidebar(Config.QUEST_TAB, -1);
180 player.interfaceManager.setSidebar(Config.WRENCH_TAB, 50020);
187 player.send(
new SendForceTab(Config.WRENCH_TAB));
188 factory.sendNpcChat(306,
"This is your wrench tab. Here you can change all options",
"that are for your client. The interface has different tabs.",
"You are currently in the display tab. You can change all",
" display settings here.");
189 factory.onAction(this::next);
194 setInstance(Mob.DEFAULT_INSTANCE);
195 player.instance = Mob.DEFAULT_INSTANCE;
197 factory.sendNpcChat(306,
"Let's move on.");
198 factory.sendNpcChat(306,
"Edgeville will be your primary home, however you",
"can change it later on as you progress",
"in the game.").onAction(this::next);
203 Teleportation.teleport(player,
new Position(3091, 3494), MODERN, () -> {
204 player.face(Direction.WEST);
206 player.locking.lock();
207 factory.sendNpcChat(306,
"This is our market place. You can put any items you",
"would like to sell in your store. You can also",
"purchase items from other players.").onAction(this::next);
213 Teleportation.teleport(player,
new Position(3086, 3485), MODERN, () -> {
214 player.face(Direction.EAST);
216 player.locking.lock();
217 factory.sendNpcChat(306,
"These thieving stalls are a very good for making",
"quick money.").onAction(this::next).execute();
222 Teleportation.teleport(player,
new Position(3079, 3494), MODERN, () -> {
223 player.face(Direction.NORTH);
225 player.locking.lock();
226 factory.sendNpcChat(306,
"Here are shops that will sell you all the",
"general items you will need in your adventure.",
"The bounty hunter npc has a wide variety of",
"high end items which he will sell for pvp points.").onAction(this::next).execute();
231 Teleportation.teleport(player,
new Position(3085, 3501), MODERN, () -> {
232 player.face(Direction.SOUTH);
234 player.locking.lock();
235 factory.sendNpcChat(306,
"This is the Well of goodwill,",
"you will be able to contribute gold for a server wide",
"experience bonus that will last 1 hour.").onAction(this::next).execute();
240 Teleportation.teleport(player,
new Position(3089, 3499), MODERN, () -> {
241 player.face(Direction.EAST);
243 player.locking.lock();
248 factory.sendNpcChat(1143,
"Hello #name.",
"I am the clan master.");
249 factory.sendNpcChat(1143,
"Clans are going to be extremely useful for your adventures.",
"Joining a clan can give you extra experience rewards,",
"experience and drop modifiers, and much more!",
"It is also a great way to make new friends!");
250 factory.onAction(this::next).execute();
254 Teleportation.teleport(player, Config.DEFAULT_POSITION, MODERN, () -> {
255 player.face(Direction.SOUTH);
257 player.locking.lock();
262 factory.sendNpcChat(306,
"That's the end of the tutorial! If you have any more questions",
"Check out our forums for detail guides or ask a moderator.",
"Good luck #name!").onAction(this::next).execute();
274 public void cleanup() {
279 public void finish() {
280 player.setVisible(
true);
281 player.playerAssistant.setSidebar(
false);
285 player.locking.unlock();
286 ActivityPanel.clear(player);
288 AchievementHandler.activate(player, AchievementKey.COMPLETE_TUTORIAL);
290 if (player.needsStarter) {
291 StarterKit.open(player);
296 protected boolean clickButton(Player player, ClickButtonInteractionEvent event) {
297 int button =
event.getButton();
300 if (button == -15496) {
302 player.send(
new SendMessage(
":settingupdate:"));
303 player.interfaceManager.open(28_500);
308 if (button == 28502) {
310 player.interfaceManager.close();
315 if (button == -15531) {
317 player.interfaceManager.setSidebar(Config.WRENCH_TAB, 50300);
318 player.send(
new SendConfig(980, 3));
325 TeleportHandler.open(player, TeleportType.FAVORITES);
330 if (button == -7534) {
332 player.interfaceManager.close();
341 public void onRegionChange(Player player) {
345 public void onLogout(Player player) {
348 player.move(Config.DEFAULT_POSITION);
350 if (player.needsStarter) {
351 player.newPlayer =
true;
356 public ActivityType getType() {
357 return ActivityType.TUTORIAL;