Turn map id magic numbers into constants

This commit is contained in:
P0nk
2021-11-07 14:26:34 +01:00
parent c022c3595f
commit b15a7e61d4
51 changed files with 615 additions and 341 deletions

View File

@@ -23,6 +23,7 @@
package server.events.gm;
import client.Character;
import constants.id.MapId;
import server.TimerManager;
import server.maps.MapleMap;
import tools.PacketCreator;
@@ -59,7 +60,7 @@ public class Coconut extends Event {
map.broadcastMessage(PacketCreator.getClock(300));
TimerManager.getInstance().schedule(() -> {
if (map.getId() == 109080000) {
if (map.getId() == MapId.EVENT_COCONUT_HARVEST) {
if (getMapleScore() == getStoryScore()) {
bonusTime();
} else if (getMapleScore() > getStoryScore()) {
@@ -132,9 +133,9 @@ public class Coconut extends Event {
for (Character chr : chars) {
if ((getMapleScore() > getStoryScore() && chr.getTeam() == 0) || (getStoryScore() > getMapleScore() && chr.getTeam() == 1)) {
chr.changeMap(109050000);
chr.changeMap(MapId.EVENT_WINNER);
} else {
chr.changeMap(109050001);
chr.changeMap(MapId.EVENT_EXIT);
}
}
map.setCoconut(null);

View File

@@ -23,6 +23,7 @@
package server.events.gm;
import client.Character;
import constants.id.MapId;
import server.TimerManager;
import tools.PacketCreator;
@@ -41,7 +42,7 @@ public class Fitness {
public Fitness(final Character chr) {
this.chr = chr;
this.schedule = TimerManager.getInstance().schedule(() -> {
if (chr.getMapId() >= 109040000 && chr.getMapId() <= 109040004) {
if (MapId.isPhysicalFitness(chr.getMapId())) {
chr.changeMap(chr.getMap().getReturnMap());
}
}, 900000);
@@ -82,7 +83,7 @@ public class Fitness {
if (chr.getFitness() == null) {
resetTimes();
}
if (chr.getMap().getId() >= 109040000 && chr.getMap().getId() <= 109040004) {
if (MapId.isPhysicalFitness(chr.getMapId())) {
if (getTimeLeft() > 9000 && getTimeLeft() < 11000) {
chr.sendPacket(PacketCreator.serverNotice(0, "You have 10 sec left. Those of you unable to beat the game, we hope you beat it next time! Great job everyone!! See you later~"));
} else if (getTimeLeft() > 99000 && getTimeLeft() < 101000) {

View File

@@ -22,6 +22,7 @@
package server.events.gm;
import client.Character;
import constants.id.MapId;
import server.TimerManager;
import tools.PacketCreator;
@@ -39,7 +40,7 @@ public class Ola {
public Ola(final Character chr) {
this.chr = chr;
this.schedule = TimerManager.getInstance().schedule(() -> {
if (chr.getMapId() >= 109030001 && chr.getMapId() <= 109030303) {
if (MapId.isOlaOla(chr.getMapId())) {
chr.changeMap(chr.getMap().getReturnMap());
}
resetTimes();

View File

@@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package server.events.gm;
import client.Character;
import constants.id.MapId;
import server.TimerManager;
import server.maps.MapleMap;
import tools.PacketCreator;
@@ -152,10 +153,10 @@ public class Snowball {
public void warpOut() {
TimerManager.getInstance().schedule(() -> {
if (winner == true) {
map.warpOutByTeam(team, 109050000);
if (winner) {
map.warpOutByTeam(team, MapId.EVENT_WINNER);
} else {
map.warpOutByTeam(team, 109050001);
map.warpOutByTeam(team, MapId.EVENT_EXIT);
}
map.setSnowball(team, null);