use of server.partyquest.MonsterCarnivalParty in project HeavenMS by ronancpl.
the class MapleMap method addPlayer.
public void addPlayer(final MapleCharacter chr) {
int chrSize;
chrWLock.lock();
try {
characters.add(chr);
chrSize = characters.size();
addPartyMemberInternal(chr);
} finally {
chrWLock.unlock();
}
chr.setMapId(mapid);
itemMonitorTimeout = 1;
if (chrSize == 1) {
if (!hasItemMonitor())
startItemMonitor();
if (onFirstUserEnter.length() != 0 && !chr.hasEntered(onFirstUserEnter, mapid) && MapScriptManager.getInstance().scriptExists(onFirstUserEnter, true)) {
chr.enteredScript(onFirstUserEnter, mapid);
MapScriptManager.getInstance().getMapScript(chr.getClient(), onFirstUserEnter, true);
}
}
if (onUserEnter.length() != 0) {
if (onUserEnter.equals("cygnusTest") && (mapid < 913040000 || mapid > 913040006)) {
chr.saveLocation("INTRO");
}
MapScriptManager.getInstance().getMapScript(chr.getClient(), onUserEnter, false);
}
if (FieldLimit.CANNOTUSEMOUNTS.check(fieldLimit) && chr.getBuffedValue(MapleBuffStat.MONSTER_RIDING) != null) {
chr.cancelEffectFromBuffStat(MapleBuffStat.MONSTER_RIDING);
chr.cancelBuffStats(MapleBuffStat.MONSTER_RIDING);
}
if (mapid == 923010000 && getMonsterById(9300102) == null) {
// Kenta's Mount Quest
spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300102), new Point(77, 426));
} else if (mapid == 200090060) {
// To Rien
chr.announce(MaplePacketCreator.getClock(60));
TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
if (chr.getMapId() == 200090060) {
chr.changeMap(140020300, 0);
}
}
}, 60 * 1000);
} else if (mapid == 200090070) {
// To Lith Harbor
chr.announce(MaplePacketCreator.getClock(60));
TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
if (chr.getMapId() == 200090070) {
chr.changeMap(104000000, 3);
}
}
}, 60 * 1000);
} else if (mapid == 200090030) {
// To Ereve (SkyFerry)
chr.getClient().announce(MaplePacketCreator.getClock(60));
TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
if (chr.getMapId() == 200090030) {
chr.changeMap(130000210, 0);
}
}
}, 60 * 1000);
} else if (mapid == 200090031) {
// To Victoria Island (SkyFerry)
chr.getClient().announce(MaplePacketCreator.getClock(60));
TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
if (chr.getMapId() == 200090031) {
chr.changeMap(101000400, 0);
}
}
}, 60 * 1000);
} else if (mapid == 200090021) {
// To Orbis (SkyFerry)
chr.getClient().announce(MaplePacketCreator.getClock(60));
TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
if (chr.getMapId() == 200090021) {
chr.changeMap(200000161, 0);
}
}
}, 60 * 1000);
} else if (mapid == 200090020) {
// To Ereve From Orbis (SkyFerry)
chr.getClient().announce(MaplePacketCreator.getClock(60));
TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
if (chr.getMapId() == 200090020) {
chr.changeMap(130000210, 0);
}
}
}, 60 * 1000);
} else if (mapid == 103040400) {
if (chr.getEventInstance() != null) {
chr.getEventInstance().movePlayer(chr);
}
} else if (MapleMiniDungeonInfo.isDungeonMap(mapid)) {
MapleMiniDungeon mmd = chr.getClient().getChannelServer().getMiniDungeon(mapid);
if (mmd != null)
mmd.registerPlayer(chr);
}
MaplePet[] pets = chr.getPets();
for (int i = 0; i < pets.length; i++) {
if (pets[i] != null) {
pets[i].setPos(getGroundBelow(chr.getPosition()));
chr.announce(MaplePacketCreator.showPet(chr, pets[i], false, false));
} else {
break;
}
}
if (chr.isHidden()) {
broadcastGMMessage(chr, MaplePacketCreator.spawnPlayerMapObject(chr), false);
chr.announce(MaplePacketCreator.getGMEffect(0x10, (byte) 1));
List<Pair<MapleBuffStat, Integer>> dsstat = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.DARKSIGHT, 0));
broadcastGMMessage(chr, MaplePacketCreator.giveForeignBuff(chr.getId(), dsstat), false);
} else {
broadcastMessage(chr, MaplePacketCreator.spawnPlayerMapObject(chr), false);
}
sendObjectPlacement(chr.getClient());
if (isStartingEventMap() && !eventStarted()) {
chr.getMap().getPortal("join00").setPortalStatus(false);
}
if (hasForcedEquip()) {
chr.getClient().announce(MaplePacketCreator.showForcedEquip(-1));
}
if (specialEquip()) {
chr.getClient().announce(MaplePacketCreator.coconutScore(0, 0));
chr.getClient().announce(MaplePacketCreator.showForcedEquip(chr.getTeam()));
}
objectWLock.lock();
try {
this.mapobjects.put(Integer.valueOf(chr.getObjectId()), chr);
} finally {
objectWLock.unlock();
}
if (chr.getPlayerShop() != null) {
addMapObject(chr.getPlayerShop());
}
final MapleDragon dragon = chr.getDragon();
if (dragon != null) {
dragon.setPosition(chr.getPosition());
this.addMapObject(dragon);
if (chr.isHidden()) {
this.broadcastGMMessage(chr, MaplePacketCreator.spawnDragon(dragon));
} else {
this.broadcastMessage(chr, MaplePacketCreator.spawnDragon(dragon));
}
}
MapleStatEffect summonStat = chr.getStatForBuff(MapleBuffStat.SUMMON);
if (summonStat != null) {
MapleSummon summon = chr.getSummonByKey(summonStat.getSourceId());
summon.setPosition(chr.getPosition());
chr.getMap().spawnSummon(summon);
updateMapObjectVisibility(chr, summon);
}
if (mapEffect != null) {
mapEffect.sendStartData(chr.getClient());
}
chr.getClient().announce(MaplePacketCreator.resetForcedStats());
if (mapid == 914000200 || mapid == 914000210 || mapid == 914000220) {
chr.getClient().announce(MaplePacketCreator.aranGodlyStats());
}
if (chr.getEventInstance() != null && chr.getEventInstance().isTimerStarted()) {
chr.getClient().announce(MaplePacketCreator.getClock((int) (chr.getEventInstance().getTimeLeft() / 1000)));
}
if (chr.getFitness() != null && chr.getFitness().isTimerStarted()) {
chr.getClient().announce(MaplePacketCreator.getClock((int) (chr.getFitness().getTimeLeft() / 1000)));
}
if (chr.getOla() != null && chr.getOla().isTimerStarted()) {
chr.getClient().announce(MaplePacketCreator.getClock((int) (chr.getOla().getTimeLeft() / 1000)));
}
if (mapid == 109060000) {
chr.announce(MaplePacketCreator.rollSnowBall(true, 0, null, null));
}
MonsterCarnival carnival = chr.getCarnival();
MonsterCarnivalParty cparty = chr.getCarnivalParty();
if (carnival != null && cparty != null && (mapid == 980000101 || mapid == 980000201 || mapid == 980000301 || mapid == 980000401 || mapid == 980000501 || mapid == 980000601)) {
chr.getClient().announce(MaplePacketCreator.getClock((int) (carnival.getTimeLeft() / 1000)));
chr.getClient().announce(MaplePacketCreator.startCPQ(chr, carnival.oppositeTeam(cparty)));
}
if (hasClock()) {
Calendar cal = Calendar.getInstance();
chr.getClient().announce((MaplePacketCreator.getClockTime(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND))));
}
if (hasBoat() > 0) {
if (hasBoat() == 1)
chr.getClient().announce((MaplePacketCreator.boatPacket(true)));
else
chr.getClient().announce(MaplePacketCreator.boatPacket(false));
}
chr.receivePartyMemberHP();
}
Aggregations