Rename and clean up MapleOla

This commit is contained in:
P0nk
2021-09-09 21:56:45 +02:00
parent 324fe48df2
commit fb6123e4cc
4 changed files with 81 additions and 81 deletions

View File

@@ -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;
}

View File

@@ -1,76 +0,0 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
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 <http://www.gnu.org/licenses/>.
*/
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);
}
}

View File

@@ -0,0 +1,76 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
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 <http://www.gnu.org/licenses/>.
*/
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);
}
}

View File

@@ -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));