RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.activity.impl.CerberusActivity Class Reference

Created by Daniel on 2018-01-20. More...

Inheritance diagram for com.runehive.content.activity.impl.CerberusActivity:
Collaboration diagram for com.runehive.content.activity.impl.CerberusActivity:

Public Member Functions

boolean canTeleport (Player player)
 Called when the player attempts to teleport.
void cleanup ()
 Cleans up the activity when finished.
void finish ()
 Finishes the activity.
ActivityType getType ()
void onDeath (Mob mob)
 Called when the player die.
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 canUsePrayer (Player player)
boolean canUseSpecial (Player player)
void cooldown (int cooldown)
 Applies a cooldown.
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.
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 CerberusActivity create (Player 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

void start ()
 Starts the next activity stage.
Protected Member Functions inherited from com.runehive.content.activity.Activity
boolean clickButton (Player player, ClickButtonInteractionEvent event)
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

 CerberusActivity (Player player, int instance)

Private Attributes

Npc cerberus = new Npc(5862, new Position(1240, 1252))
List< GameObjectobjectList = new ArrayList<>(4)
final Player player

Static Private Attributes

static final GameObject[] OBJECTS = {new CustomGameObject(23105, new Position(1241, 1242)), new CustomGameObject(23105, new Position(1240, 1242)), new CustomGameObject(23105, new Position(1239, 1242)), new CustomGameObject(23105, new Position(1240, 1236))}

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

Created by Daniel on 2018-01-20.

Definition at line 23 of file CerberusActivity.java.

Constructor & Destructor Documentation

◆ CerberusActivity()

com.runehive.content.activity.impl.CerberusActivity.CerberusActivity ( Player player,
int instance )
private

Definition at line 29 of file CerberusActivity.java.

29 {
30 super(1, instance);
31 this.player = player;
32 }

References com.runehive.content.activity.Activity.instance, and player.

Referenced by create().

Here is the caller graph for this function:

Member Function Documentation

◆ canTeleport()

boolean com.runehive.content.activity.impl.CerberusActivity.canTeleport ( Player player)

Called when the player attempts to teleport.

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

Definition at line 108 of file CerberusActivity.java.

108 {
109 return true;
110 }

References player.

◆ cleanup()

void com.runehive.content.activity.impl.CerberusActivity.cleanup ( )

Cleans up the activity when finished.

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

Definition at line 59 of file CerberusActivity.java.

59 {
60 for (GameObject object : objectList) {
61 System.out.println("unregistering " + object.getId());
62 object.unregister();
63 }
64
65 objectList.clear();
66 remove(cerberus);
67 }

References cerberus, and objectList.

Referenced by finish(), onDeath(), onLogout(), and onRegionChange().

Here is the caller graph for this function:

◆ create()

CerberusActivity com.runehive.content.activity.impl.CerberusActivity.create ( Player player)
static

Definition at line 34 of file CerberusActivity.java.

34 {
35 CerberusActivity activity = new CerberusActivity(player, player.playerAssistant.instance());
36 activity.add(player);
37 activity.resetCooldown();
38 return activity;
39 }

References CerberusActivity(), and player.

Referenced by com.runehive.game.world.entity.mob.player.PlayerAssistant.setActivity().

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

◆ finish()

void com.runehive.content.activity.impl.CerberusActivity.finish ( )

Finishes the activity.

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

Definition at line 53 of file CerberusActivity.java.

53 {
54 cleanup();
55 remove(player);
56 }

References cleanup(), and player.

Here is the call graph for this function:

◆ getType()

ActivityType com.runehive.content.activity.impl.CerberusActivity.getType ( )

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

Definition at line 113 of file CerberusActivity.java.

113 {
114 return ActivityType.CERBERUS;
115 }

References com.runehive.content.activity.ActivityType.CERBERUS.

◆ onDeath()

void com.runehive.content.activity.impl.CerberusActivity.onDeath ( Mob mob)

Called when the player die.

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

Definition at line 70 of file CerberusActivity.java.

70 {
71 if (mob.isPlayer()) {
72 cleanup();
73
74 player.move(new Position(3087, 3497));
75
76 player.animate(Animation.RESET, true);
77 player.graphic(Graphic.RESET, true);
78 return;
79 }
80
81 World.schedule(new NpcDeath(mob.getNpc(), () -> {
82 finish();
83 restart(10, () -> {
84 if (Area.inCerberus(player)) {
85 create(player);
86 } else {
87 remove(player);
88 }
89 });
90 }));
91 }

References cleanup(), com.runehive.game.world.entity.mob.Mob.getNpc(), com.runehive.game.world.entity.mob.Mob.isPlayer(), player, com.runehive.game.Animation.RESET, com.runehive.game.Graphic.RESET, and com.runehive.game.world.World.schedule().

Here is the call graph for this function:

◆ onLogout()

void com.runehive.content.activity.impl.CerberusActivity.onLogout ( Player player)

Called when the player logs out.

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

Definition at line 102 of file CerberusActivity.java.

102 {
103 cleanup();
104 remove(player);
105 }

References cleanup(), and player.

Here is the call graph for this function:

◆ onRegionChange()

void com.runehive.content.activity.impl.CerberusActivity.onRegionChange ( Player player)

Called when the player changes region.

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

Definition at line 94 of file CerberusActivity.java.

94 {
95 if (!Area.inCerberus(player)) {
96 cleanup();
97 remove(player);
98 }
99 }

References cleanup(), com.runehive.game.world.position.Area.inCerberus(), and player.

Here is the call graph for this function:

◆ start()

void com.runehive.content.activity.impl.CerberusActivity.start ( )
protected

Starts the next activity stage.

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

Definition at line 42 of file CerberusActivity.java.

42 {
43 for (GameObject object : OBJECTS) {
44 object.register();
45 objectList.add(object);
46 }
47
48 add(cerberus);
49 pause();
50 }

References com.runehive.content.activity.Activity.add(), cerberus, objectList, OBJECTS, and com.runehive.content.activity.Activity.pause().

Here is the call graph for this function:

Member Data Documentation

◆ cerberus

Npc com.runehive.content.activity.impl.CerberusActivity.cerberus = new Npc(5862, new Position(1240, 1252))
private

Definition at line 26 of file CerberusActivity.java.

Referenced by cleanup(), and start().

◆ objectList

List<GameObject> com.runehive.content.activity.impl.CerberusActivity.objectList = new ArrayList<>(4)
private

Definition at line 27 of file CerberusActivity.java.

Referenced by cleanup(), and start().

◆ OBJECTS

final GameObject [] com.runehive.content.activity.impl.CerberusActivity.OBJECTS = {new CustomGameObject(23105, new Position(1241, 1242)), new CustomGameObject(23105, new Position(1240, 1242)), new CustomGameObject(23105, new Position(1239, 1242)), new CustomGameObject(23105, new Position(1240, 1236))}
staticprivate

Definition at line 24 of file CerberusActivity.java.

24{new CustomGameObject(23105, new Position(1241, 1242)), new CustomGameObject(23105, new Position(1240, 1242)), new CustomGameObject(23105, new Position(1239, 1242)), new CustomGameObject(23105, new Position(1240, 1236))};

Referenced by start().

◆ player

final Player com.runehive.content.activity.impl.CerberusActivity.player
private

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