RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.combat.cannon.CannonBuild Class Reference

Created by Daniel on 2017-12-12. More...

Inheritance diagram for com.runehive.content.combat.cannon.CannonBuild:
Collaboration diagram for com.runehive.content.combat.cannon.CannonBuild:

Public Member Functions

 CannonBuild (Player player, Cannon cannon)
Public Member Functions inherited from com.runehive.game.task.TickableTask
void execute ()
 A function representing the unit of work that will be carried out.
 TickableTask (boolean instant, int delay)
Public Member Functions inherited from com.runehive.game.task.Task
Task attach (Object newKey)
 Attaches a new key.
synchronized final void cancel ()
 Cancels all subsequent executions.
synchronized final void cancel (boolean logout)
 Cancels all subsequent executions.
boolean canRun ()
 Determines if the task can be ran.
Optional< Object > getAttachment ()
String getCreationStackTraceStr ()
int getDelay ()
Long getElapsedTimeFromRunStartTime ()
Optional< Long > getRunStartTime ()
long getTaskCreationTime ()
String getTaskId ()
boolean isInstant ()
boolean isRunning ()
void setDelay (int delay)
 Sets the cyclic delay.
void setExecutionTime ()
 Task (boolean instant, int delay)
 Creates a new Task.
 Task (int delay)
 Creates a new Task that doesn't execute instantly.

Protected Member Functions

void onCancel (boolean logout)
 A function executed on cancellation.
void onSchedule ()
 A function executed on registration.
void tick ()
Protected Member Functions inherited from com.runehive.game.task.Task
void baseExecute ()
boolean canSchedule ()
 A function executed on registration.

Private Attributes

final Cannon cannon
final Player player

Additional Inherited Members

Package Functions inherited from com.runehive.game.task.Task
void onException (Exception e)
 A function executed on thrown exceptions.
void onLoop ()
 A function executed when iterated over.
final synchronized void process ()
synchronized void setRunning (boolean running)

Detailed Description

Created by Daniel on 2017-12-12.

Definition at line 13 of file CannonBuild.java.

Constructor & Destructor Documentation

◆ CannonBuild()

com.runehive.content.combat.cannon.CannonBuild.CannonBuild ( Player player,
Cannon cannon )

Definition at line 19 of file CannonBuild.java.

19 {
20 super(false, 1);
21 this.player = player;
22 this.cannon = cannon;
23 }

References cannon, and player.

Member Function Documentation

◆ onCancel()

void com.runehive.content.combat.cannon.CannonBuild.onCancel ( boolean logout)
protected

A function executed on cancellation.

Reimplemented from com.runehive.game.task.Task.

Definition at line 31 of file CannonBuild.java.

31 {
32 player.locking.unlock();
33 }

References player.

◆ onSchedule()

void com.runehive.content.combat.cannon.CannonBuild.onSchedule ( )
protected

A function executed on registration.

Reimplemented from com.runehive.game.task.Task.

Definition at line 26 of file CannonBuild.java.

26 {
27 player.locking.lock();
28 }

References player.

◆ tick()

void com.runehive.content.combat.cannon.CannonBuild.tick ( )
protected

Reimplemented from com.runehive.game.task.TickableTask.

Definition at line 36 of file CannonBuild.java.

36 {
37 switch (tick) {
38 case 1:
39 cannon.setStage(CannonManager.Setup.BASE);
40 player.face(Direction.NORTH_EAST);
41 player.animate(new Animation(827));
42 player.inventory.remove(new Item(6));
43 break;
44 case 2:
45 cannon.register();
46 break;
47 case 3:
48 cannon.setStage(CannonManager.Setup.STAND);
49 player.animate(new Animation(827));
50 player.inventory.remove(new Item(8));
51 break;
52 case 5:
53 cannon.setStage(CannonManager.Setup.BARRELS);
54 player.animate(new Animation(827));
55 player.inventory.remove(new Item(10));
56 break;
57 case 6:
58 cannon.unregister();
59 cannon.setObject(new CustomGameObject(9, cannon.getPosition()));
60 cannon.register();
61 break;
62 case 7:
63 cannon.setStage(CannonManager.Setup.FURNACE);
64 player.animate(new Animation(827));
65 player.inventory.remove(new Item(12));
66 break;
67 case 8:
68 cannon.unregister();
69 cannon.setObject(new CustomGameObject(6, cannon.getPosition()));
70 cannon.register();
71 break;
72 case 9:
73 cannon.setRotation(CannonManager.Rotation.NORTH);
74 cannon.setStage(CannonManager.Setup.COMPLETE_CANNON);
75 player.locking.unlock();
76 CannonManager.ACTIVE_CANNONS.put(player.getName(), cannon);
77 cancel();
78 break;
79 }
80 }

References com.runehive.content.combat.cannon.CannonManager.ACTIVE_CANNONS, com.runehive.content.combat.cannon.CannonManager.Setup.BARRELS, com.runehive.content.combat.cannon.CannonManager.Setup.BASE, com.runehive.game.task.Task.cancel(), cannon, com.runehive.content.combat.cannon.CannonManager.Setup.COMPLETE_CANNON, com.runehive.content.combat.cannon.CannonManager.Setup.FURNACE, com.runehive.content.combat.cannon.CannonManager.Rotation.NORTH, com.runehive.game.world.entity.mob.Direction.NORTH_EAST, player, com.runehive.content.combat.cannon.CannonManager.Setup.STAND, and tick().

Referenced by tick().

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

Member Data Documentation

◆ cannon

final Cannon com.runehive.content.combat.cannon.CannonBuild.cannon
private

Definition at line 16 of file CannonBuild.java.

Referenced by CannonBuild(), and tick().

◆ player

final Player com.runehive.content.combat.cannon.CannonBuild.player
private

Definition at line 15 of file CannonBuild.java.

Referenced by CannonBuild(), onCancel(), onSchedule(), and tick().


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