All packet creating methods now create Packet instead of byte[]
This commit got way too big... - Remove deprecated methods for sending packets - Favor OutPacket & Packet over MaplePacketLittleEndianWriter, LittleEndianWriter, and byte array - Split up some packet creating methods into separate classes
This commit is contained in:
@@ -66,22 +66,22 @@ public class MapleCoconut extends MapleEvent {
|
||||
} else if (getMapleScore() > getStoryScore()) {
|
||||
for (MapleCharacter chr : map.getCharacters()) {
|
||||
if (chr.getTeam() == 0) {
|
||||
chr.getClient().announce(PacketCreator.showEffect("event/coconut/victory"));
|
||||
chr.getClient().announce(PacketCreator.playSound("Coconut/Victory"));
|
||||
chr.sendPacket(PacketCreator.showEffect("event/coconut/victory"));
|
||||
chr.sendPacket(PacketCreator.playSound("Coconut/Victory"));
|
||||
} else {
|
||||
chr.getClient().announce(PacketCreator.showEffect("event/coconut/lose"));
|
||||
chr.getClient().announce(PacketCreator.playSound("Coconut/Failed"));
|
||||
chr.sendPacket(PacketCreator.showEffect("event/coconut/lose"));
|
||||
chr.sendPacket(PacketCreator.playSound("Coconut/Failed"));
|
||||
}
|
||||
}
|
||||
warpOut();
|
||||
} else {
|
||||
for (MapleCharacter chr : map.getCharacters()) {
|
||||
if (chr.getTeam() == 1) {
|
||||
chr.getClient().announce(PacketCreator.showEffect("event/coconut/victory"));
|
||||
chr.getClient().announce(PacketCreator.playSound("Coconut/Victory"));
|
||||
chr.sendPacket(PacketCreator.showEffect("event/coconut/victory"));
|
||||
chr.sendPacket(PacketCreator.playSound("Coconut/Victory"));
|
||||
} else {
|
||||
chr.getClient().announce(PacketCreator.showEffect("event/coconut/lose"));
|
||||
chr.getClient().announce(PacketCreator.playSound("Coconut/Failed"));
|
||||
chr.sendPacket(PacketCreator.showEffect("event/coconut/lose"));
|
||||
chr.sendPacket(PacketCreator.playSound("Coconut/Failed"));
|
||||
}
|
||||
}
|
||||
warpOut();
|
||||
@@ -95,29 +95,29 @@ public class MapleCoconut extends MapleEvent {
|
||||
TimerManager.getInstance().schedule(() -> {
|
||||
if (getMapleScore() == getStoryScore()) {
|
||||
for (MapleCharacter chr : map.getCharacters()) {
|
||||
chr.getClient().announce(PacketCreator.showEffect("event/coconut/lose"));
|
||||
chr.getClient().announce(PacketCreator.playSound("Coconut/Failed"));
|
||||
chr.sendPacket(PacketCreator.showEffect("event/coconut/lose"));
|
||||
chr.sendPacket(PacketCreator.playSound("Coconut/Failed"));
|
||||
}
|
||||
warpOut();
|
||||
} else if (getMapleScore() > getStoryScore()) {
|
||||
for (MapleCharacter chr : map.getCharacters()) {
|
||||
if (chr.getTeam() == 0) {
|
||||
chr.getClient().announce(PacketCreator.showEffect("event/coconut/victory"));
|
||||
chr.getClient().announce(PacketCreator.playSound("Coconut/Victory"));
|
||||
chr.sendPacket(PacketCreator.showEffect("event/coconut/victory"));
|
||||
chr.sendPacket(PacketCreator.playSound("Coconut/Victory"));
|
||||
} else {
|
||||
chr.getClient().announce(PacketCreator.showEffect("event/coconut/lose"));
|
||||
chr.getClient().announce(PacketCreator.playSound("Coconut/Failed"));
|
||||
chr.sendPacket(PacketCreator.showEffect("event/coconut/lose"));
|
||||
chr.sendPacket(PacketCreator.playSound("Coconut/Failed"));
|
||||
}
|
||||
}
|
||||
warpOut();
|
||||
} else {
|
||||
for (MapleCharacter chr : map.getCharacters()) {
|
||||
if (chr.getTeam() == 1) {
|
||||
chr.getClient().announce(PacketCreator.showEffect("event/coconut/victory"));
|
||||
chr.getClient().announce(PacketCreator.playSound("Coconut/Victory"));
|
||||
chr.sendPacket(PacketCreator.showEffect("event/coconut/victory"));
|
||||
chr.sendPacket(PacketCreator.playSound("Coconut/Victory"));
|
||||
} else {
|
||||
chr.getClient().announce(PacketCreator.showEffect("event/coconut/lose"));
|
||||
chr.getClient().announce(PacketCreator.playSound("Coconut/Failed"));
|
||||
chr.sendPacket(PacketCreator.showEffect("event/coconut/lose"));
|
||||
chr.sendPacket(PacketCreator.playSound("Coconut/Failed"));
|
||||
}
|
||||
}
|
||||
warpOut();
|
||||
|
||||
@@ -49,13 +49,13 @@ public class MapleFitness {
|
||||
|
||||
public void startFitness() {
|
||||
chr.getMap().startEvent();
|
||||
chr.getClient().announce(PacketCreator.getClock(900));
|
||||
chr.getClient().sendPacket(PacketCreator.getClock(900));
|
||||
this.timeStarted = System.currentTimeMillis();
|
||||
this.time = 900000;
|
||||
checkAndMessage();
|
||||
|
||||
chr.getMap().getPortal("join00").setPortalStatus(true);
|
||||
chr.getClient().announce(PacketCreator.serverNotice(0, "The portal has now opened. Press the up arrow key at the portal to enter."));
|
||||
chr.sendPacket(PacketCreator.serverNotice(0, "The portal has now opened. Press the up arrow key at the portal to enter."));
|
||||
}
|
||||
|
||||
public boolean isTimerStarted() {
|
||||
@@ -84,29 +84,29 @@ public class MapleFitness {
|
||||
}
|
||||
if (chr.getMap().getId() >= 109040000 && chr.getMap().getId() <= 109040004) {
|
||||
if (getTimeLeft() > 9000 && getTimeLeft() < 11000) {
|
||||
chr.getClient().announce(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~"));
|
||||
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) {
|
||||
chr.getClient().announce(PacketCreator.serverNotice(0, "Alright, you don't have much time remaining. Please hurry up a little!"));
|
||||
chr.sendPacket(PacketCreator.serverNotice(0, "Alright, you don't have much time remaining. Please hurry up a little!"));
|
||||
} else if (getTimeLeft() > 239000 && getTimeLeft() < 241000) {
|
||||
chr.getClient().announce(PacketCreator.serverNotice(0, "The 4th stage is the last one for [The Maple Physical Fitness Test]. Please don't give up at the last minute and try your best. The reward is waiting for you at the very top!"));
|
||||
chr.sendPacket(PacketCreator.serverNotice(0, "The 4th stage is the last one for [The Maple Physical Fitness Test]. Please don't give up at the last minute and try your best. The reward is waiting for you at the very top!"));
|
||||
} else if (getTimeLeft() > 299000 && getTimeLeft() < 301000) {
|
||||
chr.getClient().announce(PacketCreator.serverNotice(0, "The 3rd stage offers traps where you may see them, but you won't be able to step on them. Please be careful of them as you make your way up."));
|
||||
chr.sendPacket(PacketCreator.serverNotice(0, "The 3rd stage offers traps where you may see them, but you won't be able to step on them. Please be careful of them as you make your way up."));
|
||||
} else if (getTimeLeft() > 359000 && getTimeLeft() < 361000) {
|
||||
chr.getClient().announce(PacketCreator.serverNotice(0, "For those who have heavy lags, please make sure to move slowly to avoid falling all the way down because of lags."));
|
||||
chr.sendPacket(PacketCreator.serverNotice(0, "For those who have heavy lags, please make sure to move slowly to avoid falling all the way down because of lags."));
|
||||
} else if (getTimeLeft() > 499000 && getTimeLeft() < 501000) {
|
||||
chr.getClient().announce(PacketCreator.serverNotice(0, "Please remember that if you die during the event, you'll be eliminated from the game. If you're running out of HP, either take a potion or recover HP first before moving on."));
|
||||
chr.sendPacket(PacketCreator.serverNotice(0, "Please remember that if you die during the event, you'll be eliminated from the game. If you're running out of HP, either take a potion or recover HP first before moving on."));
|
||||
} else if (getTimeLeft() > 599000 && getTimeLeft() < 601000) {
|
||||
chr.getClient().announce(PacketCreator.serverNotice(0, "The most important thing you'll need to know to avoid the bananas thrown by the monkeys is *Timing* Timing is everything in this!"));
|
||||
chr.sendPacket(PacketCreator.serverNotice(0, "The most important thing you'll need to know to avoid the bananas thrown by the monkeys is *Timing* Timing is everything in this!"));
|
||||
} else if (getTimeLeft() > 659000 && getTimeLeft() < 661000) {
|
||||
chr.getClient().announce(PacketCreator.serverNotice(0, "The 2nd stage offers monkeys throwing bananas. Please make sure to avoid them by moving along at just the right timing."));
|
||||
chr.sendPacket(PacketCreator.serverNotice(0, "The 2nd stage offers monkeys throwing bananas. Please make sure to avoid them by moving along at just the right timing."));
|
||||
} else if (getTimeLeft() > 699000 && getTimeLeft() < 701000) {
|
||||
chr.getClient().announce(PacketCreator.serverNotice(0, "Please remember that if you die during the event, you'll be eliminated from the game. You still have plenty of time left, so either take a potion or recover HP first before moving on."));
|
||||
chr.sendPacket(PacketCreator.serverNotice(0, "Please remember that if you die during the event, you'll be eliminated from the game. You still have plenty of time left, so either take a potion or recover HP first before moving on."));
|
||||
} else if (getTimeLeft() > 779000 && getTimeLeft() < 781000) {
|
||||
chr.getClient().announce(PacketCreator.serverNotice(0, "Everyone that clears [The Maple Physical Fitness Test] on time will be given an item, regardless of the order of finish, so just relax, take your time, and clear the 4 stages."));
|
||||
chr.sendPacket(PacketCreator.serverNotice(0, "Everyone that clears [The Maple Physical Fitness Test] on time will be given an item, regardless of the order of finish, so just relax, take your time, and clear the 4 stages."));
|
||||
} else if (getTimeLeft() > 839000 && getTimeLeft() < 841000) {
|
||||
chr.getClient().announce(PacketCreator.serverNotice(0, "There may be a heavy lag due to many users at stage 1 all at once. It won't be difficult, so please make sure not to fall down because of heavy lag."));
|
||||
chr.sendPacket(PacketCreator.serverNotice(0, "There may be a heavy lag due to many users at stage 1 all at once. It won't be difficult, so please make sure not to fall down because of heavy lag."));
|
||||
} else if (getTimeLeft() > 869000 && getTimeLeft() < 871000) {
|
||||
chr.getClient().announce(PacketCreator.serverNotice(0, "[MapleStory Physical Fitness Test] consists of 4 stages, and if you happen to die during the game, you'll be eliminated from the game, so please be careful of that."));
|
||||
chr.sendPacket(PacketCreator.serverNotice(0, "[MapleStory Physical Fitness Test] consists of 4 stages, and if you happen to die during the game, you'll be eliminated from the game, so please be careful of that."));
|
||||
}
|
||||
} else {
|
||||
resetTimes();
|
||||
|
||||
@@ -48,12 +48,12 @@ public class MapleOla {
|
||||
|
||||
public void startOla() { // TODO: Messages
|
||||
chr.getMap().startEvent();
|
||||
chr.getClient().announce(PacketCreator.getClock(360));
|
||||
chr.sendPacket(PacketCreator.getClock(360));
|
||||
this.timeStarted = System.currentTimeMillis();
|
||||
this.time = 360000;
|
||||
|
||||
chr.getMap().getPortal("join00").setPortalStatus(true);
|
||||
chr.getClient().announce(PacketCreator.serverNotice(0, "The portal has now opened. Press the up arrow key at the portal to enter."));
|
||||
chr.sendPacket(PacketCreator.serverNotice(0, "The portal has now opened. Press the up arrow key at the portal to enter."));
|
||||
}
|
||||
|
||||
public boolean isTimerStarted() {
|
||||
|
||||
@@ -58,8 +58,8 @@ public class MapleSnowball {
|
||||
|
||||
for (MapleCharacter chr : characters) {
|
||||
if (chr != null) {
|
||||
chr.announce(PacketCreator.rollSnowBall(false, 1, map.getSnowball(0), map.getSnowball(1)));
|
||||
chr.announce(PacketCreator.getClock(600));
|
||||
chr.sendPacket(PacketCreator.rollSnowBall(false, 1, map.getSnowball(0), map.getSnowball(1)));
|
||||
chr.sendPacket(PacketCreator.getClock(600));
|
||||
}
|
||||
}
|
||||
hittable = true;
|
||||
@@ -67,13 +67,13 @@ public class MapleSnowball {
|
||||
if (map.getSnowball(team).getPosition() > map.getSnowball(team == 0 ? 1 : 0).getPosition()) {
|
||||
for (MapleCharacter chr : characters) {
|
||||
if (chr != null)
|
||||
chr.announce(PacketCreator.rollSnowBall(false, 3, map.getSnowball(0), map.getSnowball(0)));
|
||||
chr.sendPacket(PacketCreator.rollSnowBall(false, 3, map.getSnowball(0), map.getSnowball(0)));
|
||||
}
|
||||
winner = true;
|
||||
} else if (map.getSnowball(team == 0 ? 1 : 0).getPosition() > map.getSnowball(team).getPosition()) {
|
||||
for (MapleCharacter chr : characters) {
|
||||
if (chr != null)
|
||||
chr.announce(PacketCreator.rollSnowBall(false, 4, map.getSnowball(0), map.getSnowball(0)));
|
||||
chr.sendPacket(PacketCreator.rollSnowBall(false, 4, map.getSnowball(0), map.getSnowball(0)));
|
||||
}
|
||||
winner = true;
|
||||
} //Else
|
||||
@@ -138,7 +138,7 @@ public class MapleSnowball {
|
||||
public void message(int message) {
|
||||
for (MapleCharacter chr : characters) {
|
||||
if (chr != null)
|
||||
chr.announce(PacketCreator.snowballMessage(team, message));
|
||||
chr.sendPacket(PacketCreator.snowballMessage(team, message));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user