From fb6123e4ccef950e94e44065f512116ea7633586 Mon Sep 17 00:00:00 2001 From: P0nk Date: Thu, 9 Sep 2021 21:56:45 +0200 Subject: [PATCH] Rename and clean up MapleOla --- src/main/java/client/Character.java | 8 +-- src/main/java/server/events/gm/MapleOla.java | 76 -------------------- src/main/java/server/events/gm/Ola.java | 76 ++++++++++++++++++++ src/main/java/server/maps/MapleMap.java | 2 +- 4 files changed, 81 insertions(+), 81 deletions(-) delete mode 100644 src/main/java/server/events/gm/MapleOla.java create mode 100644 src/main/java/server/events/gm/Ola.java diff --git a/src/main/java/client/Character.java b/src/main/java/client/Character.java index 13ec10d5f5..cdf9c41946 100644 --- a/src/main/java/client/Character.java +++ b/src/main/java/client/Character.java @@ -62,7 +62,7 @@ import server.MapleItemInformationProvider.ScriptedItem; import server.events.MapleEvents; import server.events.RescueGaga; import server.events.gm.Fitness; -import server.events.gm.MapleOla; +import server.events.gm.Ola; import server.life.MapleMonster; import server.life.MaplePlayerNPC; import server.life.MobSkill; @@ -11186,7 +11186,7 @@ public class Character extends AbstractCharacterObject { //EVENTS private byte team = 0; private Fitness fitness; - private MapleOla ola; + private Ola ola; private long snowballattack; public byte getTeam() { @@ -11197,11 +11197,11 @@ public class Character extends AbstractCharacterObject { this.team = (byte) team; } - public MapleOla getOla() { + public Ola getOla() { return ola; } - public void setOla(MapleOla ola) { + public void setOla(Ola ola) { this.ola = ola; } diff --git a/src/main/java/server/events/gm/MapleOla.java b/src/main/java/server/events/gm/MapleOla.java deleted file mode 100644 index 3d10052fc8..0000000000 --- a/src/main/java/server/events/gm/MapleOla.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package server.events.gm; - -import client.Character; -import server.TimerManager; -import tools.PacketCreator; - -import java.util.concurrent.ScheduledFuture; - -/** - * - * @author kevintjuh93 - */ -public class MapleOla { - private Character chr; - private long time = 0; - private long timeStarted = 0; - private ScheduledFuture schedule = null; - - public MapleOla(final Character chr) { - this.chr = chr; - this.schedule = TimerManager.getInstance().schedule(() -> { - if (chr.getMapId() >= 109030001 && chr.getMapId() <= 109030303) - chr.changeMap(chr.getMap().getReturnMap()); - resetTimes(); - }, 360000); - } - - public void startOla() { // TODO: Messages - chr.getMap().startEvent(); - chr.sendPacket(PacketCreator.getClock(360)); - this.timeStarted = System.currentTimeMillis(); - this.time = 360000; - - chr.getMap().getPortal("join00").setPortalStatus(true); - chr.sendPacket(PacketCreator.serverNotice(0, "The portal has now opened. Press the up arrow key at the portal to enter.")); - } - - public boolean isTimerStarted() { - return time > 0 && timeStarted > 0; - } - - public long getTime() { - return time; - } - - public void resetTimes() { - this.time = 0; - this.timeStarted = 0; - schedule.cancel(false); - } - - public long getTimeLeft() { - return time - (System.currentTimeMillis() - timeStarted); - } -} diff --git a/src/main/java/server/events/gm/Ola.java b/src/main/java/server/events/gm/Ola.java new file mode 100644 index 0000000000..0f3bbfa5de --- /dev/null +++ b/src/main/java/server/events/gm/Ola.java @@ -0,0 +1,76 @@ +/* + This file is part of the OdinMS Maple Story Server + Copyright (C) 2008 Patrick Huy + Matthias Butz + Jan Christian Meyer + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation version 3 as published by + the Free Software Foundation. You may not use, modify or distribute + this program under any other version of the GNU Affero General Public + License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +package server.events.gm; + +import client.Character; +import server.TimerManager; +import tools.PacketCreator; + +import java.util.concurrent.ScheduledFuture; + +/** + * @author kevintjuh93 + */ +public class Ola { + private final Character chr; + private long time = 0; + private long timeStarted = 0; + private ScheduledFuture schedule = null; + + public Ola(final Character chr) { + this.chr = chr; + this.schedule = TimerManager.getInstance().schedule(() -> { + if (chr.getMapId() >= 109030001 && chr.getMapId() <= 109030303) { + chr.changeMap(chr.getMap().getReturnMap()); + } + resetTimes(); + }, 360000); + } + + public void startOla() { // TODO: Messages + chr.getMap().startEvent(); + chr.sendPacket(PacketCreator.getClock(360)); + this.timeStarted = System.currentTimeMillis(); + this.time = 360000; + + chr.getMap().getPortal("join00").setPortalStatus(true); + chr.sendPacket(PacketCreator.serverNotice(0, "The portal has now opened. Press the up arrow key at the portal to enter.")); + } + + public boolean isTimerStarted() { + return time > 0 && timeStarted > 0; + } + + public long getTime() { + return time; + } + + public void resetTimes() { + this.time = 0; + this.timeStarted = 0; + schedule.cancel(false); + } + + public long getTimeLeft() { + return time - (System.currentTimeMillis() - timeStarted); + } +} diff --git a/src/main/java/server/maps/MapleMap.java b/src/main/java/server/maps/MapleMap.java index 056d088066..8f323c889a 100644 --- a/src/main/java/server/maps/MapleMap.java +++ b/src/main/java/server/maps/MapleMap.java @@ -3897,7 +3897,7 @@ public class MapleMap { chr.setFitness(new Fitness(chr)); chr.getFitness().startFitness(); } else if (this.mapid == 109030101 || this.mapid == 109030201 || this.mapid == 109030301 || this.mapid == 109030401) { - chr.setOla(new MapleOla(chr)); + chr.setOla(new Ola(chr)); chr.getOla().startOla(); } else if (this.mapid == 109020001 && getOx() == null) { setOx(new MapleOxQuiz(this));