use of server.events.gm.MapleSnowball in project HeavenMS by ronancpl.
the class SnowballHandler method handlePacket.
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
// D3 00 02 00 00 A5 01
MapleCharacter chr = c.getPlayer();
MapleMap map = chr.getMap();
final MapleSnowball snowball = map.getSnowball(chr.getTeam());
final MapleSnowball othersnowball = map.getSnowball(chr.getTeam() == 0 ? (byte) 1 : 0);
int what = slea.readByte();
if (snowball == null || othersnowball == null || snowball.getSnowmanHP() == 0)
return;
if ((System.currentTimeMillis() - chr.getLastSnowballAttack()) < 500)
return;
if (chr.getTeam() != (what % 2))
return;
chr.setLastSnowballAttack(System.currentTimeMillis());
int damage = 0;
if (what < 2 && othersnowball.getSnowmanHP() > 0)
damage = 10;
else if (what == 2 || what == 3) {
if (Math.random() < 0.03)
damage = 45;
else
damage = 15;
}
if (what >= 0 && what <= 4)
snowball.hit(what, damage);
}
use of server.events.gm.MapleSnowball in project HeavenMS by ronancpl.
the class MapleMap method startEvent.
public void startEvent(final MapleCharacter chr) {
if (this.mapid == 109080000 && getCoconut() == null) {
setCoconut(new MapleCoconut(this));
coconut.startEvent();
} else if (this.mapid == 109040000) {
chr.setFitness(new MapleFitness(chr));
chr.getFitness().startFitness();
} else if (this.mapid == 109030101 || this.mapid == 109030201 || this.mapid == 109030301 || this.mapid == 109030401) {
chr.setOla(new MapleOla(chr));
chr.getOla().startOla();
} else if (this.mapid == 109020001 && getOx() == null) {
setOx(new MapleOxQuiz(this));
getOx().sendQuestion();
setOxQuiz(true);
} else if (this.mapid == 109060000 && getSnowball(chr.getTeam()) == null) {
setSnowball(0, new MapleSnowball(0, this));
setSnowball(1, new MapleSnowball(1, this));
getSnowball(chr.getTeam()).startEvent();
}
}
Aggregations