RuneHive-Game
Loading...
Searching...
No Matches
EmoteAction.java
Go to the documentation of this file.
1package com.runehive.game.action.impl;
2
3import com.runehive.game.Animation;
4import com.runehive.game.Graphic;
5import com.runehive.game.action.Action;
6import com.runehive.game.action.policy.WalkablePolicy;
7import com.runehive.game.world.entity.mob.player.Player;
8
9/**
10 * Handles performing an emote action
11 *
12 * @author Daniel
13 */
14public final class EmoteAction extends Action<Player> {
15 /**
16 * The animation identification.
17 */
18 private final int animation;
19
20 /**
21 * The graphic identification.
22 */
23 private final int graphic;
24
25 /**
26 * Constructs a new <code>EmoteAction</code>.
27 *
28 * @param player The player instance.
29 * @param animation The animation identification.
30 * @param graphic The graphic identification.
31 */
32 public EmoteAction(Player player, int animation, int graphic) {
33 super(player, 3, true);
34 this.animation = animation;
35 this.graphic = graphic;
36 }
37
38 @Override
39 public void execute() {
40 if (animation != -1) {
41 getMob().animate(new Animation(animation));
42 }
43
44 if (graphic != -1) {
45 getMob().graphic(new Graphic(graphic));
46 }
47
48 cancel();
49 }
50
51 @Override
52 public String getName() {
53 return "Emote";
54 }
55
56 @Override
57 public boolean prioritized() {
58 return false;
59 }
60
61 @Override
65}
Class that models a single animation used by an entity.
Represents a single graphic that can be used by entities.
Definition Graphic.java:10
T getMob()
Gets the player.
Definition Action.java:44
Action(T mob, int delay, boolean instant)
Creates a new Action randomevent.
Definition Action.java:24
String getName()
Gets the name of this action.
final int graphic
The graphic identification.
boolean prioritized()
Determines if this action is prioritized.
void execute()
A function representing the unit of work that will be carried out.
final int animation
The animation identification.
EmoteAction(Player player, int animation, int graphic)
Constructs a new EmoteAction.
WalkablePolicy getWalkablePolicy()
Gets the WalkablePolicy of this action.
synchronized final void cancel()
Cancels all subsequent executions.
Definition Task.java:113
This class represents a character controlled by a player.
Definition Player.java:125
A queue policy determines whether the action can occur while walking.
NON_WALKABLE
This indicates actions cannot occur while walking.