RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.game.action.impl.TutorialActivity Class Reference

Handles the tutorial activity. More...

Inheritance diagram for com.runehive.game.action.impl.TutorialActivity:
Collaboration diagram for com.runehive.game.action.impl.TutorialActivity:

Public Member Functions

void cleanup ()
 Cleans up the activity when finished.
void cooldown (int cooldown)
 Applies a cooldown.
void finish ()
 Finishes the activity.
ActivityType getType ()
void onLogout (Player player)
 Called when the player logs out.
void onRegionChange (Player player)
 Called when the player changes region.
Public Member Functions inherited from com.runehive.content.activity.Activity
 Activity (int cooldown, int instance)
 Constructs a new SequencedMinigame object.
void add (Mob mob)
 Adds a mob to the activity.
boolean canDrinkPotions (Player player)
boolean canEat (Player player, FoodData foodType)
boolean canEquipItem (Player player, Item item, EquipmentType type)
boolean canLogout (Player player)
boolean canSpellCast (Player player)
boolean canTeleport (Player player)
 Called when the player attempts to teleport.
boolean canUsePrayer (Player player)
boolean canUseSpecial (Player player)
ActivityDeathType deathType ()
int getInstance ()
 Gets this activity's instance level.
Optional< Activity_PanelgetPanel ()
 Gets an optional of the activity panel.
int getTicks ()
 Gets the current ticks.
void onDeath (Mob mob)
 Called when the player die.
boolean onEvent (Player player, InteractionEvent interactionEvent)
boolean onStep (Mob mob)
void remove (Mob mob)
 Removes a mob from the activity.
void removeAll (Mob... mobs)
 Removes all mobs from the activity.
void sequence ()
 Sequences the activity.
void setInstance (int instance)
void setPanel (Activity_Panel panel)
 Sets the activity panel.
void setPause (boolean pause)
 Sets the pause state of the activity.
void update ()
 The update method.

Static Public Member Functions

static TutorialActivity create (Player player)
 Creates the tutorial activity for the player.
Static Public Member Functions inherited from com.runehive.content.activity.Activity
static boolean evaluate (Mob mob, Predicate< Activity > predicate)
static void forActivity (Mob mob, Consumer< Activity > consumer)
static< T extends Activity > Optional< T > search (Player player, Class< T > clazz)

Protected Member Functions

boolean clickButton (Player player, ClickButtonInteractionEvent event)
void start ()
 Starts the next activity stage.
Protected Member Functions inherited from com.runehive.content.activity.Activity
boolean clickItem (Player player, ItemInteractionEvent event)
boolean clickNpc (Player player, NpcInteractionEvent event)
boolean clickObject (Player player, ObjectInteractionEvent event)
final void finishCooldown ()
 Sets the cooldown flag to FINISH.
Optional<? extends ActivityListener<? extends Activity > > getListener ()
 Gets an Optional of the ActivityListener for this activity.
final boolean isPaused ()
 Checks if the cooldown is paused.
boolean itemContainerAction (Player player, ItemContainerInteractionEvent event)
final void pause ()
 Sets the cooldown flag to PAUSE.
boolean pickupItem (Player player, PickupItemInteractionEvent event)
final void resetCooldown ()
 Resets the remaining ticks to the cached cooldown ticks.
void restart (int delay, Runnable runnable)
boolean useItem (Player player, ItemOnItemInteractionEvent event)
boolean useItem (Player player, ItemOnObjectInteractionEvent event)

Private Member Functions

void next ()
 TutorialActivity (Player player)
 Constructs a new TutorialActivity.
void update (String... strings)
 Updates the activity panel.

Private Attributes

boolean completed = false
final DialogueFactory factory
 The dialogue factory for this activity.
Npc guide
 The guide npc for the activity.
final Player player
 The player doing the tutorial activity.
int stage
 The current activity stage.

Additional Inherited Members

Static Protected Attributes inherited from com.runehive.content.activity.Activity
static final int FINISH = -1
 The 'finish' cooldown id.
static final int PAUSE = -2
 The 'pause' cooldown id.
static final int START = 0
 The 'start' cooldown id.

Detailed Description

Handles the tutorial activity.

Author
Daniel

Definition at line 36 of file TutorialActivity.java.

Constructor & Destructor Documentation

◆ TutorialActivity()

com.runehive.game.action.impl.TutorialActivity.TutorialActivity ( Player player)
private

Constructs a new TutorialActivity.

Definition at line 53 of file TutorialActivity.java.

53 {
54 super(2, player.playerAssistant.instance());
55 this.stage = 0;
56 this.player = player;
57 this.factory = player.dialogueFactory;
58 }

References player.

Referenced by create().

Here is the caller graph for this function:

Member Function Documentation

◆ cleanup()

void com.runehive.game.action.impl.TutorialActivity.cleanup ( )

Cleans up the activity when finished.

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 340 of file TutorialActivity.java.

340 {
341 remove(guide);
342 }

References guide.

Referenced by finish(), and onLogout().

Here is the caller graph for this function:

◆ clickButton()

boolean com.runehive.game.action.impl.TutorialActivity.clickButton ( Player player,
ClickButtonInteractionEvent event )
protected

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 363 of file TutorialActivity.java.

363 {
364 int button = event.getButton();
365 switch (stage) {
366 case 8:
367 if (button == -15496) {
368 factory.lock(false);
369 player.send(new SendMessage(":settingupdate:"));
370 player.interfaceManager.open(28_500);
371 start();
372 }
373 return true;
374 case 9:
375 if (button == 28502) {
376 factory.lock(false);
377 player.interfaceManager.close();
378 start();
379 }
380 return true;
381 case 10:
382 if (button == -15531) {
383 factory.lock(false);
384 player.interfaceManager.setSidebar(Config.WRENCH_TAB, 50300);
385 player.send(new SendConfig(980, 3));
386 next();
387 }
388 return true;
389 case 12:
390 if (button == 850) {
391 factory.lock(false);
392 TeleportHandler.open(player, TeleportType.FAVORITES);
393 start();
394 }
395 return true;
396 case 13:
397 if (button == -7534) {
398 factory.lock(false);
399 player.interfaceManager.close();
400 start();
401 }
402 return true;
403 }
404 return false;
405 }

References factory, com.runehive.content.skill.impl.magic.teleport.TeleportType.FAVORITES, next(), com.runehive.content.teleport.TeleportHandler.open(), player, stage, start(), and com.runehive.Config.WRENCH_TAB.

Here is the call graph for this function:

◆ cooldown()

void com.runehive.game.action.impl.TutorialActivity.cooldown ( int cooldown)

Applies a cooldown.

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 81 of file TutorialActivity.java.

81 {
82 super.cooldown(cooldown);
83 factory.clear();
84 }

References cooldown(), and factory.

Referenced by cooldown(), and create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create()

TutorialActivity com.runehive.game.action.impl.TutorialActivity.create ( Player player)
static

Creates the tutorial activity for the player.

Definition at line 61 of file TutorialActivity.java.

61 {
62 TutorialActivity activity = new TutorialActivity(player);
63 player.runEnergy = 100;
64 player.send(new SendSpecialAmount());
65 player.movement.setRunningToggled(false);
66 player.playerAssistant.setSidebar(true);
67 player.setVisible(false);
68 player.move(Config.DEFAULT_POSITION);
69 activity.cooldown(3);
70 activity.add(player);
71 player.locking.lock();
72 return activity;
73 }

References com.runehive.content.activity.Activity.add(), cooldown(), com.runehive.Config.DEFAULT_POSITION, player, and TutorialActivity().

Here is the call graph for this function:

◆ finish()

void com.runehive.game.action.impl.TutorialActivity.finish ( )

Finishes the activity.

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 345 of file TutorialActivity.java.

345 {
346 player.setVisible(true);
347 player.playerAssistant.setSidebar(false);
348 cleanup();
349 remove(player);
350 factory.clear();
351 player.locking.unlock();
352 ActivityPanel.clear(player);
353 if (completed) {
354 AchievementHandler.activate(player, AchievementKey.COMPLETE_TUTORIAL);
355 }
356 if (player.needsStarter) {
357 StarterKit.open(player);
358 }
359
360 }

References com.runehive.content.achievement.AchievementHandler.activate(), cleanup(), com.runehive.content.activity.panel.ActivityPanel.clear(), com.runehive.content.achievement.AchievementKey.COMPLETE_TUTORIAL, completed, factory, com.runehive.content.StarterKit.open(), and player.

Referenced by start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getType()

ActivityType com.runehive.game.action.impl.TutorialActivity.getType ( )

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 423 of file TutorialActivity.java.

423 {
424 return ActivityType.TUTORIAL;
425 }

References com.runehive.content.activity.ActivityType.TUTORIAL.

◆ next()

void com.runehive.game.action.impl.TutorialActivity.next ( )
private

Definition at line 86 of file TutorialActivity.java.

86 {
87 update();
88 cooldown(1);
89 }

References com.runehive.content.activity.Activity.cooldown, and com.runehive.content.activity.Activity.update().

Referenced by clickButton(), and start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onLogout()

void com.runehive.game.action.impl.TutorialActivity.onLogout ( Player player)

Called when the player logs out.

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 412 of file TutorialActivity.java.

412 {
413 cleanup();
414 remove(player);
415 player.move(Config.DEFAULT_POSITION);
416
417 if (player.needsStarter) {
418 player.newPlayer = true;
419 }
420 }

References cleanup(), com.runehive.Config.DEFAULT_POSITION, and player.

Here is the call graph for this function:

◆ onRegionChange()

void com.runehive.game.action.impl.TutorialActivity.onRegionChange ( Player player)

Called when the player changes region.

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 408 of file TutorialActivity.java.

408 {
409 }

References player.

◆ start()

void com.runehive.game.action.impl.TutorialActivity.start ( )
protected

Starts the next activity stage.

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 92 of file TutorialActivity.java.

92 {
93// System.out.println(stage);
94 switch (stage) {
95 case 0:
96 guide = new Npc(306, new Position(3222, 3223));
97 add(guide);
98 guide.graphic(new Graphic(86, true));
99 cooldown(2);
100 break;
101 case 1:
102 guide.face(player.getPosition());
103 guide.animate(new Animation(863));
104 guide.speak("Hello, " + player.getName() + "!");
105 cooldown(2);
106 break;
107 case 2:
108 guide.walk(new Position(3222, 3218));
109 cooldown(1);
110 break;
111 case 3:
112 player.face(guide.getPosition());
113 factory.sendNpcChat(306, "Welcome to <col=D63E3E>Augury</col>, " + player.getName(),
114 "Would you like a tutorial of our lands?");
115 factory.sendOption("Yes", () -> cooldown(1), "No", this::finish);
116 factory.execute();
117 pause();
118 break;
119 case 4:
120 update("This is the activity panel.", "The activity panel replaces a lot", "of interfaces so be sure",
121 "to get acquainted to it.");
122 factory.sendNpcChat(306, "Wise choice my friend! Let's get started.",
123 "The first thing you need to know about is the", "activity panel. When you are doing an activity,",
124 "like this tutorial for example; a panel will be available to you.");
125 factory.sendNpcChat(306, "You can access this panel by clicking the red tab icon.",
126 "The activity panel is disabled by default but will", "automatically enable when in a activity.");
127 factory.onAction(() -> cooldown(1));
128 factory.execute();
129 pause();
130 break;
131 case 5:
132 factory.sendNpcChat(306, "Before I show you around I want to show you",
133 "useful content for your adventures.");
134 factory.onAction(() -> {
135 player.interfaceManager.setSidebar(Config.QUEST_TAB, 29400);
136 player.send(new SendForceTab(Config.QUEST_TAB));
137 next();
138 });
139 factory.execute();
140 pause();
141 break;
142 case 6:
143 factory.sendNpcChat(306, "This is your quest tab. Inside contains information about",
144 "the world and yourself. On the top right corner of the",
145 "tab you will see a bunch of different buttons.");
146 factory.sendNpcChat(306, "The blue button will show you the quest tab",
147 "The green button will provide you with various options.");
148 factory.sendNpcChat(306, "Some of these options include - npc drop viwer,",
149 "log drop simulator, log kill logs, title manager and more!");
150 factory.sendNpcChat(306, "Lastly, the scroll button will open a menu where you can",
151 "change game related options. For example: welcome screen,",
152 " triviabot, drop notification, and more! These options",
153 "are not to be confused with the client options.");
154 factory.onAction(() -> {
155 player.interfaceManager.setSidebar(Config.QUEST_TAB, -1);
156 player.interfaceManager.setSidebar(Config.WRENCH_TAB, 50020);
157 next();
158 });
159 factory.execute();
160 pause();
161 break;
162 case 7:
163 player.send(new SendForceTab(Config.WRENCH_TAB));
164 factory.sendNpcChat(306, "This is your settings tab. Here you can change all options",
165 "that are for your client. The interface has different tabs.",
166 "You are currently in the display tab. You can change all", " display settings here.");
167 factory.onAction(this::next);
168 factory.execute();
169 pause();
170 break;
171 case 8:
172 setInstance(Mob.DEFAULT_INSTANCE);
173 player.instance = Mob.DEFAULT_INSTANCE;
174 player.loadRegion();
175 factory.sendNpcChat(306, "Let's move on.");
176 factory.sendNpcChat(306, "Edgeville will be your primary home, however you",
177 "can change it later on as you progress", "in the game.").onAction(this::next);
178 factory.execute();
179 pause();
180 break;
181 case 9:
182 Teleportation.teleport(player, new Position(3089, 3492), MODERN, () -> {
183 player.face(Direction.EAST);
184 next();
185 player.locking.lock();
186 });
187 pause();
188 break;
189 case 10:
190 factory.sendNpcChat(306, "Throughout your adventures you will find key halves.",
191 "When using the right halves together you will be able",
192 "to form a Crystal key. With that key you can unlock this chest.",
193 "This chest contains various high valued items.").onAction(this::next).execute();
194 pause();
195 break;
196 case 11:
197 Teleportation.teleport(player, new Position(3091, 3494), MODERN, () -> {
198 player.face(Direction.WEST);
199 next();
200 player.locking.lock();
201 });
202 pause();
203 break;
204 case 12:
205 factory.sendNpcChat(306, "This is our market place. You can put any items you",
206 "would like to sell in your store. You can also", "purchase items from other players.")
207 .onAction(this::next);
208 factory.execute();
209 pause();
210 break;
211 case 13:
212 Teleportation.teleport(player, new Position(3093, 3500), MODERN, () -> {
213 player.face(Direction.EAST);
214 next();
215 player.locking.lock();
216 });
217 pause();
218 break;
219 case 14:
220 factory.sendNpcChat(306, "These thieving stalls are a very good for making", "quick money.")
221 .onAction(this::next).execute();
222 pause();
223 break;
224 case 15:
225 Teleportation.teleport(player, new Position(3080, 3491), MODERN, () -> {
226 player.face(Direction.WEST);
227 next();
228 player.locking.lock();
229 });
230 pause();
231 break;
232 case 16:
233 factory.sendNpcChat(306, "Here are shops that will sell you all the supplies you may need,",
234 " aswell as gear/food/potions/misc items and more.").onAction(this::next).execute();
235 pause();
236 break;
237 case 17:
238 Teleportation.teleport(player, new Position(3080, 3491), MODERN, () -> {
239 player.face(Direction.WEST);
240 next();
241 player.locking.lock();
242 });
243 pause();
244 break;
245 case 18:
246 factory.sendNpcChat(306, "These npcs can really help you out, anywhere from",
247 "mass decanting potions, changing appearances,", "buying skillcapes and more!").onAction(this::next)
248 .execute();
249 pause();
250 break;
251 case 19:
252 Teleportation.teleport(player, new Position(3086, 3500), MODERN, () -> {
253 player.face(Direction.WEST);
254 next();
255 player.locking.lock();
256 });
257 pause();
258 break;
259 case 20:
260 factory.sendNpcChat(306, "This is the Well of goodwill,",
261 "you will be able to contribute gold for a server wide",
262 "experience bonus that will last 30 Minutes.").onAction(this::next).execute();
263 pause();
264 break;
265 case 21:
266 Teleportation.teleport(player, new Position(3078, 3509), MODERN, () -> {
267 player.face(Direction.SOUTH);
268 next();
269 player.locking.lock();
270 });
271 pause();
272 break;
273 case 22:
274 factory.sendNpcChat(306, "This is the fun pk arena.",
275 "Here you can fight players in multi-combat and lose nothing", "on death!").onAction(this::next)
276 .execute();
277 pause();
278 break;
279 case 23:
280 Teleportation.teleport(player, new Position(3090, 3474), MODERN, () -> {
281 player.face(Direction.SOUTH);
282 next();
283 player.onStep();
284 player.locking.lock();
285 });
286 pause();
287 break;
288 case 24:
289 factory.sendNpcChat(306, "This is the skilling area for members with",
290 "Extreme Donator status.");
291 factory.onAction(() -> {
292 player.face(Direction.SOUTH);
293 next();
294 player.locking.lock();
295 });
296 factory.execute();
297 pause();
298 break;
299 case 25:
300 Teleportation.teleport(player, new Position(3097, 3498), MODERN, () -> {
301 player.face(Direction.NORTH);
302 next();
303 player.locking.lock();
304 });
305 pause();
306 break;
307 case 26:
308 factory.sendNpcChat(1143, "Hello #name.", "I am the clan master.");
309 factory.sendNpcChat(1143, "Clans are going to be extremely useful for your adventures.",
310 "Joining a clan can give you extra experience rewards,",
311 "experience and drop modifiers, and much more!", "It is also a great way to make new friends!");
312 factory.sendNpcChat(1143, "There are heavily enforced rules for being in a clan.",
313 "Check out the rules on our forums ::clanrules");
314 factory.onAction(this::next).execute();
315 pause();
316 break;
317 case 27:
318 Teleportation.teleport(player, Config.DEFAULT_POSITION, MODERN, () -> {
319 player.face(Direction.SOUTH);
320 next();
321 player.locking.lock();
322 });
323 pause();
324 break;
325 case 28:
326 factory.sendNpcChat(306, "That's the end of the tutorial! If you have any more questions",
327 "Check out our forums for detail guides or ask a moderator.", "Good luck #name!")
328 .onAction(this::next).execute();
329 pause();
330 break;
331 case 29:
332 completed = true;
333 finish();
334 break;
335 }
336 stage++;
337 }

References com.runehive.content.activity.Activity.add(), completed, com.runehive.content.activity.Activity.cooldown, com.runehive.game.world.entity.Entity.DEFAULT_INSTANCE, com.runehive.Config.DEFAULT_POSITION, com.runehive.game.world.entity.mob.Direction.EAST, factory, finish(), guide, next(), com.runehive.game.world.entity.mob.Direction.NORTH, com.runehive.content.activity.Activity.pause(), player, com.runehive.Config.QUEST_TAB, com.runehive.content.activity.Activity.setInstance(), com.runehive.game.world.entity.mob.Direction.SOUTH, stage, com.runehive.content.skill.impl.magic.teleport.Teleportation.teleport(), com.runehive.content.activity.Activity.update(), com.runehive.game.world.entity.mob.Direction.WEST, and com.runehive.Config.WRENCH_TAB.

Referenced by clickButton().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update()

void com.runehive.game.action.impl.TutorialActivity.update ( String... strings)
private

Updates the activity panel.

Definition at line 76 of file TutorialActivity.java.

76 {
77 ActivityPanel.update(player, (int) Utility.getPercentageAmount(stage, 27), "Tutorial", "Progress", strings);
78 }

References com.runehive.util.Utility.getPercentageAmount(), player, stage, and com.runehive.content.activity.panel.ActivityPanel.update().

Here is the call graph for this function:

Member Data Documentation

◆ completed

boolean com.runehive.game.action.impl.TutorialActivity.completed = false
private

Definition at line 50 of file TutorialActivity.java.

Referenced by finish(), and start().

◆ factory

final DialogueFactory com.runehive.game.action.impl.TutorialActivity.factory
private

The dialogue factory for this activity.

Definition at line 48 of file TutorialActivity.java.

Referenced by clickButton(), cooldown(), finish(), and start().

◆ guide

Npc com.runehive.game.action.impl.TutorialActivity.guide
private

The guide npc for the activity.

Definition at line 42 of file TutorialActivity.java.

Referenced by cleanup(), and start().

◆ player

final Player com.runehive.game.action.impl.TutorialActivity.player
private

The player doing the tutorial activity.

Definition at line 39 of file TutorialActivity.java.

Referenced by clickButton(), create(), finish(), onLogout(), onRegionChange(), start(), TutorialActivity(), and update().

◆ stage

int com.runehive.game.action.impl.TutorialActivity.stage
private

The current activity stage.

Definition at line 45 of file TutorialActivity.java.

Referenced by clickButton(), start(), and update().


The documentation for this class was generated from the following file: