Rename and clean up MapleCoconut
This commit is contained in:
@@ -25,7 +25,7 @@ package net.server.channel.handlers;
|
|||||||
import client.Client;
|
import client.Client;
|
||||||
import net.AbstractPacketHandler;
|
import net.AbstractPacketHandler;
|
||||||
import net.packet.InPacket;
|
import net.packet.InPacket;
|
||||||
import server.events.gm.MapleCoconut;
|
import server.events.gm.Coconut;
|
||||||
import server.events.gm.MapleCoconuts;
|
import server.events.gm.MapleCoconuts;
|
||||||
import server.maps.MapleMap;
|
import server.maps.MapleMap;
|
||||||
import tools.PacketCreator;
|
import tools.PacketCreator;
|
||||||
@@ -42,7 +42,7 @@ public final class CoconutHandler extends AbstractPacketHandler {
|
|||||||
*/
|
*/
|
||||||
int id = p.readShort();
|
int id = p.readShort();
|
||||||
MapleMap map = c.getPlayer().getMap();
|
MapleMap map = c.getPlayer().getMap();
|
||||||
MapleCoconut event = map.getCoconut();
|
Coconut event = map.getCoconut();
|
||||||
MapleCoconuts nut = event.getCoconut(id);
|
MapleCoconuts nut = event.getCoconut(id);
|
||||||
if (!nut.isHittable()){
|
if (!nut.isHittable()){
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -32,32 +32,31 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author kevintjuh93
|
* @author kevintjuh93
|
||||||
*/
|
*/
|
||||||
//Make them better :)
|
//Make them better :)
|
||||||
public class MapleCoconut extends MapleEvent {
|
public class Coconut extends MapleEvent {
|
||||||
private MapleMap map = null;
|
private MapleMap map = null;
|
||||||
private int MapleScore = 0;
|
private int MapleScore = 0;
|
||||||
private int StoryScore = 0;
|
private int StoryScore = 0;
|
||||||
private int countBombing = 80;
|
private int countBombing = 80;
|
||||||
private int countFalling = 401;
|
private int countFalling = 401;
|
||||||
private int countStopped = 20;
|
private int countStopped = 20;
|
||||||
private List<MapleCoconuts> coconuts = new LinkedList<>();
|
private final List<MapleCoconuts> coconuts = new LinkedList<>();
|
||||||
|
|
||||||
public MapleCoconut(MapleMap map) {
|
public Coconut(MapleMap map) {
|
||||||
super(1, 50);
|
super(1, 50);
|
||||||
this.map = map;
|
this.map = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startEvent() {
|
public void startEvent() {
|
||||||
map.startEvent();
|
map.startEvent();
|
||||||
for (int i = 0; i < 506; i++) {
|
for (int i = 0; i < 506; i++) {
|
||||||
coconuts.add(new MapleCoconuts(i));
|
coconuts.add(new MapleCoconuts(i));
|
||||||
}
|
}
|
||||||
map.broadcastMessage(PacketCreator.hitCoconut(true, 0, 0));
|
map.broadcastMessage(PacketCreator.hitCoconut(true, 0, 0));
|
||||||
setCoconutsHittable(true);
|
setCoconutsHittable(true);
|
||||||
map.broadcastMessage(PacketCreator.getClock(300));
|
map.broadcastMessage(PacketCreator.getClock(300));
|
||||||
|
|
||||||
TimerManager.getInstance().schedule(() -> {
|
TimerManager.getInstance().schedule(() -> {
|
||||||
if (map.getId() == 109080000) {
|
if (map.getId() == 109080000) {
|
||||||
@@ -88,10 +87,10 @@ public class MapleCoconut extends MapleEvent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 300000);
|
}, 300000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bonusTime() {
|
public void bonusTime() {
|
||||||
map.broadcastMessage(PacketCreator.getClock(120));
|
map.broadcastMessage(PacketCreator.getClock(120));
|
||||||
TimerManager.getInstance().schedule(() -> {
|
TimerManager.getInstance().schedule(() -> {
|
||||||
if (getMapleScore() == getStoryScore()) {
|
if (getMapleScore() == getStoryScore()) {
|
||||||
for (Character chr : map.getCharacters()) {
|
for (Character chr : map.getCharacters()) {
|
||||||
@@ -100,34 +99,34 @@ public class MapleCoconut extends MapleEvent {
|
|||||||
}
|
}
|
||||||
warpOut();
|
warpOut();
|
||||||
} else if (getMapleScore() > getStoryScore()) {
|
} else if (getMapleScore() > getStoryScore()) {
|
||||||
for (Character chr : map.getCharacters()) {
|
for (Character chr : map.getCharacters()) {
|
||||||
if (chr.getTeam() == 0) {
|
if (chr.getTeam() == 0) {
|
||||||
chr.sendPacket(PacketCreator.showEffect("event/coconut/victory"));
|
chr.sendPacket(PacketCreator.showEffect("event/coconut/victory"));
|
||||||
chr.sendPacket(PacketCreator.playSound("Coconut/Victory"));
|
chr.sendPacket(PacketCreator.playSound("Coconut/Victory"));
|
||||||
} else {
|
} else {
|
||||||
chr.sendPacket(PacketCreator.showEffect("event/coconut/lose"));
|
chr.sendPacket(PacketCreator.showEffect("event/coconut/lose"));
|
||||||
chr.sendPacket(PacketCreator.playSound("Coconut/Failed"));
|
chr.sendPacket(PacketCreator.playSound("Coconut/Failed"));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
warpOut();
|
|
||||||
} else {
|
|
||||||
for (Character chr : map.getCharacters()) {
|
|
||||||
if (chr.getTeam() == 1) {
|
|
||||||
chr.sendPacket(PacketCreator.showEffect("event/coconut/victory"));
|
|
||||||
chr.sendPacket(PacketCreator.playSound("Coconut/Victory"));
|
|
||||||
} else {
|
|
||||||
chr.sendPacket(PacketCreator.showEffect("event/coconut/lose"));
|
|
||||||
chr.sendPacket(PacketCreator.playSound("Coconut/Failed"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
warpOut();
|
|
||||||
}
|
}
|
||||||
|
warpOut();
|
||||||
|
} else {
|
||||||
|
for (Character chr : map.getCharacters()) {
|
||||||
|
if (chr.getTeam() == 1) {
|
||||||
|
chr.sendPacket(PacketCreator.showEffect("event/coconut/victory"));
|
||||||
|
chr.sendPacket(PacketCreator.playSound("Coconut/Victory"));
|
||||||
|
} else {
|
||||||
|
chr.sendPacket(PacketCreator.showEffect("event/coconut/lose"));
|
||||||
|
chr.sendPacket(PacketCreator.playSound("Coconut/Failed"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
warpOut();
|
||||||
|
}
|
||||||
}, 120000);
|
}, 120000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void warpOut() {
|
public void warpOut() {
|
||||||
setCoconutsHittable(false);
|
setCoconutsHittable(false);
|
||||||
TimerManager.getInstance().schedule(() -> {
|
TimerManager.getInstance().schedule(() -> {
|
||||||
List<Character> chars = new ArrayList<>(map.getCharacters());
|
List<Character> chars = new ArrayList<>(map.getCharacters());
|
||||||
|
|
||||||
@@ -140,23 +139,23 @@ public class MapleCoconut extends MapleEvent {
|
|||||||
}
|
}
|
||||||
map.setCoconut(null);
|
map.setCoconut(null);
|
||||||
}, 12000);
|
}, 12000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMapleScore() {
|
public int getMapleScore() {
|
||||||
return MapleScore;
|
return MapleScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStoryScore() {
|
public int getStoryScore() {
|
||||||
return StoryScore;
|
return StoryScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMapleScore() {
|
public void addMapleScore() {
|
||||||
this.MapleScore += 1;
|
this.MapleScore += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addStoryScore() {
|
public void addStoryScore() {
|
||||||
this.StoryScore += 1;
|
this.StoryScore += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBombings() {
|
public int getBombings() {
|
||||||
return countBombing;
|
return countBombing;
|
||||||
@@ -146,7 +146,7 @@ public class MapleMap {
|
|||||||
private boolean eventstarted = false, isMuted = false;
|
private boolean eventstarted = false, isMuted = false;
|
||||||
private MapleSnowball snowball0 = null;
|
private MapleSnowball snowball0 = null;
|
||||||
private MapleSnowball snowball1 = null;
|
private MapleSnowball snowball1 = null;
|
||||||
private MapleCoconut coconut;
|
private Coconut coconut;
|
||||||
|
|
||||||
//CPQ
|
//CPQ
|
||||||
private int maxMobs;
|
private int maxMobs;
|
||||||
@@ -3870,11 +3870,11 @@ public class MapleMap {
|
|||||||
return fieldType == 4 || fieldType == 19;
|
return fieldType == 4 || fieldType == 19;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCoconut(MapleCoconut nut) {
|
public void setCoconut(Coconut nut) {
|
||||||
this.coconut = nut;
|
this.coconut = nut;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapleCoconut getCoconut() {
|
public Coconut getCoconut() {
|
||||||
return coconut;
|
return coconut;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3891,7 +3891,7 @@ public class MapleMap {
|
|||||||
|
|
||||||
public void startEvent(final Character chr) {
|
public void startEvent(final Character chr) {
|
||||||
if (this.mapid == 109080000 && getCoconut() == null) {
|
if (this.mapid == 109080000 && getCoconut() == null) {
|
||||||
setCoconut(new MapleCoconut(this));
|
setCoconut(new Coconut(this));
|
||||||
coconut.startEvent();
|
coconut.startEvent();
|
||||||
} else if (this.mapid == 109040000) {
|
} else if (this.mapid == 109040000) {
|
||||||
chr.setFitness(new MapleFitness(chr));
|
chr.setFitness(new MapleFitness(chr));
|
||||||
|
|||||||
Reference in New Issue
Block a user