RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
TutorialActivity.java
1package com.osroyale.game.action.impl;
2
3
4import com.osroyale.Config;
5import com.osroyale.content.StarterKit;
6import com.osroyale.content.achievement.AchievementHandler;
7import com.osroyale.content.achievement.AchievementKey;
8import com.osroyale.content.activity.Activity;
9import com.osroyale.content.activity.ActivityType;
10import com.osroyale.content.activity.panel.ActivityPanel;
11import com.osroyale.content.dialogue.DialogueFactory;
12import com.osroyale.content.event.impl.ClickButtonInteractionEvent;
13import com.osroyale.content.skill.impl.magic.teleport.TeleportType;
14import com.osroyale.content.skill.impl.magic.teleport.Teleportation;
15import com.osroyale.content.teleport.TeleportHandler;
16import com.osroyale.game.Animation;
17import com.osroyale.game.Graphic;
18import com.osroyale.game.world.entity.mob.Direction;
19import com.osroyale.game.world.entity.mob.Mob;
20import com.osroyale.game.world.entity.mob.npc.Npc;
21import com.osroyale.game.world.entity.mob.player.Player;
22import com.osroyale.game.world.position.Position;
23import com.osroyale.net.packet.out.SendConfig;
24import com.osroyale.net.packet.out.SendForceTab;
25import com.osroyale.net.packet.out.SendMessage;
26import com.osroyale.net.packet.out.SendSpecialAmount;
27import com.osroyale.util.Utility;
28
29import static com.osroyale.content.skill.impl.magic.teleport.TeleportationData.MODERN;
30
70
71public class TutorialActivity extends Activity {
72
74 private final Player player;
75
77 private Npc guide;
78
80 private int stage;
81
83 private final DialogueFactory factory;
84
85 private boolean completed = false;
86
88 private TutorialActivity(Player player) {
89 super(2, player.playerAssistant.instance());
90 this.stage = 0;
91 this.player = player;
92 this.factory = player.dialogueFactory;
93 }
94
96 public static TutorialActivity create(Player player) {
97 TutorialActivity activity = new TutorialActivity(player);
98 player.runEnergy = 100;
99 player.send(new SendSpecialAmount());
100 player.movement.setRunningToggled(false);
101 player.playerAssistant.setSidebar(true);
102 player.setVisible(false);
103 player.move(Config.DEFAULT_POSITION);
104 activity.cooldown(3);
105 activity.add(player);
106 player.locking.lock();
107 return activity;
108 }
109
111 private void update(String... strings) {
112 ActivityPanel.update(player, (int) Utility.getPercentageAmount(stage, 27), "Tutorial", "Progress", strings);
113 }
114
115 @Override
116 public void cooldown(int cooldown) {
117 super.cooldown(cooldown);
118 factory.clear();
119 }
120
121 private void next() {
122 update();
123 cooldown(1);
124 }
125
126 @Override
127 protected void start() {
128// System.out.println(stage);
129 switch (stage) {
130 case 0:
131 guide = new Npc(306, new Position(3222, 3223));
132 add(guide);
133 guide.graphic(new Graphic(86, true));
134 cooldown(2);
135 break;
136 case 1:
137 guide.face(player.getPosition());
138 guide.animate(new Animation(863));
139 guide.speak("Hello, " + player.getName() + "!");
140 cooldown(2);
141 break;
142 case 2:
143 guide.walk(new Position(3222, 3218));
144 cooldown(1);
145 break;
146 case 3:
147 player.face(guide.getPosition());
148 factory.sendNpcChat(306, "Welcome to <col=D63E3E>Augury</col>, " + player.getName(),
149 "Would you like a tutorial of our lands?");
150 factory.sendOption("Yes", () -> cooldown(1), "No", this::finish);
151 factory.execute();
152 pause();
153 break;
154 case 4:
155 update("This is the activity panel.", "The activity panel replaces a lot", "of interfaces so be sure",
156 "to get acquainted to it.");
157 factory.sendNpcChat(306, "Wise choice my friend! Let's get started.",
158 "The first thing you need to know about is the", "activity panel. When you are doing an activity,",
159 "like this tutorial for example; a panel will be available to you.");
160 factory.sendNpcChat(306, "You can access this panel by clicking the red tab icon.",
161 "The activity panel is disabled by default but will", "automatically enable when in a activity.");
162 factory.onAction(() -> cooldown(1));
163 factory.execute();
164 pause();
165 break;
166 case 5:
167 factory.sendNpcChat(306, "Before I show you around I want to show you",
168 "useful content for your adventures.");
169 factory.onAction(() -> {
170 player.interfaceManager.setSidebar(Config.QUEST_TAB, 29400);
171 player.send(new SendForceTab(Config.QUEST_TAB));
172 next();
173 });
174 factory.execute();
175 pause();
176 break;
177 case 6:
178 factory.sendNpcChat(306, "This is your quest tab. Inside contains information about",
179 "the world and yourself. On the top right corner of the",
180 "tab you will see a bunch of different buttons.");
181 factory.sendNpcChat(306, "The blue button will show you the quest tab",
182 "The green button will provide you with various options.");
183 factory.sendNpcChat(306, "Some of these options include - npc drop viwer,",
184 "log drop simulator, log kill logs, title manager and more!");
185 factory.sendNpcChat(306, "Lastly, the scroll button will open a menu where you can",
186 "change game related options. For example: welcome screen,",
187 " triviabot, drop notification, and more! These options",
188 "are not to be confused with the client options.");
189 factory.onAction(() -> {
190 player.interfaceManager.setSidebar(Config.QUEST_TAB, -1);
191 player.interfaceManager.setSidebar(Config.WRENCH_TAB, 50020);
192 next();
193 });
194 factory.execute();
195 pause();
196 break;
197 case 7:
198 player.send(new SendForceTab(Config.WRENCH_TAB));
199 factory.sendNpcChat(306, "This is your settings tab. Here you can change all options",
200 "that are for your client. The interface has different tabs.",
201 "You are currently in the display tab. You can change all", " display settings here.");
202 factory.onAction(this::next);
203 factory.execute();
204 pause();
205 break;
206 case 8:
207 setInstance(Mob.DEFAULT_INSTANCE);
208 player.instance = Mob.DEFAULT_INSTANCE;
209 player.loadRegion();
210 factory.sendNpcChat(306, "Let's move on.");
211 factory.sendNpcChat(306, "Edgeville will be your primary home, however you",
212 "can change it later on as you progress", "in the game.").onAction(this::next);
213 factory.execute();
214 pause();
215 break;
216 case 9:
217 Teleportation.teleport(player, new Position(3089, 3492), MODERN, () -> {
218 player.face(Direction.EAST);
219 next();
220 player.locking.lock();
221 });
222 pause();
223 break;
224 case 10:
225 factory.sendNpcChat(306, "Throughout your adventures you will find key halves.",
226 "When using the right halves together you will be able",
227 "to form a Crystal key. With that key you can unlock this chest.",
228 "This chest contains various high valued items.").onAction(this::next).execute();
229 pause();
230 break;
231 case 11:
232 Teleportation.teleport(player, new Position(3091, 3494), MODERN, () -> {
233 player.face(Direction.WEST);
234 next();
235 player.locking.lock();
236 });
237 pause();
238 break;
239 case 12:
240 factory.sendNpcChat(306, "This is our market place. You can put any items you",
241 "would like to sell in your store. You can also", "purchase items from other players.")
242 .onAction(this::next);
243 factory.execute();
244 pause();
245 break;
246 case 13:
247 Teleportation.teleport(player, new Position(3093, 3500), MODERN, () -> {
248 player.face(Direction.EAST);
249 next();
250 player.locking.lock();
251 });
252 pause();
253 break;
254 case 14:
255 factory.sendNpcChat(306, "These thieving stalls are a very good for making", "quick money.")
256 .onAction(this::next).execute();
257 pause();
258 break;
259 case 15:
260 Teleportation.teleport(player, new Position(3080, 3491), MODERN, () -> {
261 player.face(Direction.WEST);
262 next();
263 player.locking.lock();
264 });
265 pause();
266 break;
267 case 16:
268 factory.sendNpcChat(306, "Here are shops that will sell you all the supplies you may need,",
269 " aswell as gear/food/potions/misc items and more.").onAction(this::next).execute();
270 pause();
271 break;
272 case 17:
273 Teleportation.teleport(player, new Position(3080, 3491), MODERN, () -> {
274 player.face(Direction.WEST);
275 next();
276 player.locking.lock();
277 });
278 pause();
279 break;
280 case 18:
281 factory.sendNpcChat(306, "These npcs can really help you out, anywhere from",
282 "mass decanting potions, changing appearances,", "buying skillcapes and more!").onAction(this::next)
283 .execute();
284 pause();
285 break;
286 case 19:
287 Teleportation.teleport(player, new Position(3086, 3500), MODERN, () -> {
288 player.face(Direction.WEST);
289 next();
290 player.locking.lock();
291 });
292 pause();
293 break;
294 case 20:
295 factory.sendNpcChat(306, "This is the Well of goodwill,",
296 "you will be able to contribute gold for a server wide",
297 "experience bonus that will last 30 Minutes.").onAction(this::next).execute();
298 pause();
299 break;
300 case 21:
301 Teleportation.teleport(player, new Position(3078, 3509), MODERN, () -> {
302 player.face(Direction.SOUTH);
303 next();
304 player.locking.lock();
305 });
306 pause();
307 break;
308 case 22:
309 factory.sendNpcChat(306, "This is the fun pk arena.",
310 "Here you can fight players in multi-combat and lose nothing", "on death!").onAction(this::next)
311 .execute();
312 pause();
313 break;
314 case 23:
315 Teleportation.teleport(player, new Position(3090, 3474), MODERN, () -> {
316 player.face(Direction.SOUTH);
317 next();
318 player.onStep();
319 player.locking.lock();
320 });
321 pause();
322 break;
323 case 24:
324 factory.sendNpcChat(306, "This is the skilling area for members with",
325 "Extreme Donator status.");
326 factory.onAction(() -> {
327 player.face(Direction.SOUTH);
328 next();
329 player.locking.lock();
330 });
331 factory.execute();
332 pause();
333 break;
334 case 25:
335 Teleportation.teleport(player, new Position(3097, 3498), MODERN, () -> {
336 player.face(Direction.NORTH);
337 next();
338 player.locking.lock();
339 });
340 pause();
341 break;
342 case 26:
343 factory.sendNpcChat(1143, "Hello #name.", "I am the clan master.");
344 factory.sendNpcChat(1143, "Clans are going to be extremely useful for your adventures.",
345 "Joining a clan can give you extra experience rewards,",
346 "experience and drop modifiers, and much more!", "It is also a great way to make new friends!");
347 factory.sendNpcChat(1143, "There are heavily enforced rules for being in a clan.",
348 "Check out the rules on our forums ::clanrules");
349 factory.onAction(this::next).execute();
350 pause();
351 break;
352 case 27:
353 Teleportation.teleport(player, Config.DEFAULT_POSITION, MODERN, () -> {
354 player.face(Direction.SOUTH);
355 next();
356 player.locking.lock();
357 });
358 pause();
359 break;
360 case 28:
361 factory.sendNpcChat(306, "That's the end of the tutorial! If you have any more questions",
362 "Check out our forums for detail guides or ask a moderator.", "Good luck #name!")
363 .onAction(this::next).execute();
364 pause();
365 break;
366 case 29:
367 completed = true;
368 finish();
369 break;
370 }
371 stage++;
372 }
373
374 @Override
375 public void cleanup() {
376 remove(guide);
377 }
378
379 @Override
380 public void finish() {
381 player.setVisible(true);
382 player.playerAssistant.setSidebar(false);
383 cleanup();
384 remove(player);
385 factory.clear();
386 player.locking.unlock();
387 ActivityPanel.clear(player);
388 if (completed) {
390 }
391 if (player.needsStarter) {
392 StarterKit.open(player);
393 }
394
395 }
396
397 @Override
398 protected boolean clickButton(Player player, ClickButtonInteractionEvent event) {
399 int button = event.getButton();
400 switch (stage) {
401 case 8:
402 if (button == -15496) {
403 factory.lock(false);
404 player.send(new SendMessage(":settingupdate:"));
405 player.interfaceManager.open(28_500);
406 start();
407 }
408 return true;
409 case 9:
410 if (button == 28502) {
411 factory.lock(false);
412 player.interfaceManager.close();
413 start();
414 }
415 return true;
416 case 10:
417 if (button == -15531) {
418 factory.lock(false);
419 player.interfaceManager.setSidebar(Config.WRENCH_TAB, 50300);
420 player.send(new SendConfig(980, 3));
421 next();
422 }
423 return true;
424 case 12:
425 if (button == 850) {
426 factory.lock(false);
427 TeleportHandler.open(player, TeleportType.FAVORITES);
428 start();
429 }
430 return true;
431 case 13:
432 if (button == -7534) {
433 factory.lock(false);
434 player.interfaceManager.close();
435 start();
436 }
437 return true;
438 }
439 return false;
440 }
441
442 @Override
443 public void onRegionChange(Player player) {
444 }
445
446 @Override
447 public void onLogout(Player player) {
448 cleanup();
449 remove(player);
450 player.move(Config.DEFAULT_POSITION);
451
452 if (player.needsStarter) {
453 player.newPlayer = true;
454 }
455 }
456
457 @Override
458 public ActivityType getType() {
459 return ActivityType.TUTORIAL;
460 }
461}
static final Position DEFAULT_POSITION
Definition Config.java:235
static void open(Player player)
static void activate(Player player, AchievementKey achievement)
Activity(int cooldown, int instance)
Definition Activity.java:92
static void update(Player player, int amount, String title, String footer, String... strings)
static TutorialActivity create(Player player)
static double getPercentageAmount(int progress, int total)
Definition Utility.java:73