RuneHive-Game
Loading...
Searching...
No Matches
MobAnimation.java
Go to the documentation of this file.
1package com.runehive.game.world.entity.mob;
2
3import com.runehive.game.world.entity.mob.npc.definition.NpcDefinition;
4
5import java.util.EnumSet;
6
7public class MobAnimation {
8
9 public static final int PLAYER_STAND = 808;
10 public static final int PLAYER_WALK = 819;
11 public static final int PLAYER_TURN_180 = 820;
12 public static final int PLAYER_TURN_90_CW = 821;
13 public static final int PLAYER_TURN_90_CCW = 822;
14 public static final int PLAYER_TURN = 823;
15 public static final int PLAYER_RUN = 824;
16
17 private int stand;
18 private int turn;
19 private int walk;
20 private int turn180;
21 private int turn90CW;
22 private int turn90CCW;
23 private int run;
24 private final EnumSet<UpdateFlag> updateFlags;
25
26 MobAnimation(EnumSet<UpdateFlag> updateFlags) {
27 this.updateFlags = updateFlags;
28 }
29
30 public void set(int stand, int turn, int walk, int turn180, int turn90cw, int turn90ccw, int run) {
31 this.stand = stand;
32 this.turn = turn;
33 this.walk = walk;
34 this.turn180 = turn180;
35 this.turn90CW = turn90cw;
36 this.turn90CCW = turn90ccw;
37 this.run = run;
39 }
40
41 public void reset() {
42 this.stand = PLAYER_STAND;
43 this.turn = PLAYER_TURN;
44 this.walk = PLAYER_WALK;
45 this.turn180 = PLAYER_TURN_180;
46 this.turn90CW = PLAYER_TURN_90_CW;
47 this.turn90CCW = PLAYER_TURN_90_CCW;
48 this.run = PLAYER_RUN;
50 }
51
52 public void setNpcAnimations(NpcDefinition definition) {
53 this.stand = definition.getStand();
54 this.walk = definition.getWalk();
55 this.turn180 = definition.getTurn180();
56 this.turn90CW = definition.getTurn90CW();
57 this.turn90CCW = definition.getTurn90CCW();
59 }
60
61 public int getStand() {
62 return stand;
63 }
64
65 public int getTurn() {
66 return turn;
67 }
68
69 public int getWalk() {
70 return walk;
71 }
72
73 public int getTurn180() {
74 return turn180 <= 0 || turn180 == PLAYER_TURN_180 ? getWalk() : turn180;
75 }
76
77 public int getTurn90CW() {
78 return turn90CW <= 0 || turn90CW == PLAYER_TURN_90_CW ? getWalk() : turn90CW;
79 }
80
81 public int getTurn90CCW() {
83 }
84
85 public int getRun() {
86 return run;
87 }
88
89 public void setStand(int stand) {
90 if (this.stand != stand)
92 this.stand = stand;
93 }
94
95 public void setTurn(int turn) {
96 if (this.turn != turn)
98 this.turn = turn;
99 }
100
101 public void setWalk(int walk) {
102 if (this.walk != walk)
104 this.walk = walk;
105 }
106
107 public void setTurn180(int turn180) {
108 if (this.turn180 != turn180)
110 this.turn180 = turn180;
111 }
112
113 public void setTurn90CW(int turn90cw) {
114 if (turn90CW != turn90cw)
116 turn90CW = turn90cw;
117 }
118
119 public void setTurn90CCW(int turn90ccw) {
120 if (turn90CCW != turn90ccw)
122 turn90CCW = turn90ccw;
123 }
124
125 public void setRun(int run) {
126 if (this.run != run)
128 this.run = run;
129 }
130
133 other.stand = stand;
134 other.turn = turn;
135 other.walk = walk;
136 other.turn180 = turn180;
137 other.turn90CW = turn90CW;
138 other.turn90CCW = turn90CCW;
139 other.run = run;
140 return other;
141 }
142}
void setNpcAnimations(NpcDefinition definition)
MobAnimation(EnumSet< UpdateFlag > updateFlags)