public void onMapLoad(final MapleCharacter chr) { try { em.getIv().invokeFunction("onMapLoad", this, chr); } catch (ScriptException ex) { ex.printStackTrace(); } catch (NoSuchMethodException ex) { // Ignore, we don't want to update this for all events. } }
// Separate function to warp players to a "finish" map, if applicable public final void finishPQ() { try { em.getIv().invokeFunction("clearPQ", this); } catch (ScriptException ex) { ex.printStackTrace(); } catch (NoSuchMethodException ex) { ex.printStackTrace(); } }
public final void removePlayer(final MapleCharacter chr) { try { em.getIv().invokeFunction("playerExit", this, chr); } catch (ScriptException ex) { ex.printStackTrace(); } catch (NoSuchMethodException ex) { ex.printStackTrace(); } }
public final void leftParty(final MapleCharacter chr) { try { em.getIv().invokeFunction("leftParty", this, chr); } catch (ScriptException ex) { ex.printStackTrace(); } catch (NoSuchMethodException ex) { ex.printStackTrace(); } }
public final void disbandParty() { try { em.getIv().invokeFunction("disbandParty", this); } catch (ScriptException ex) { ex.printStackTrace(); } catch (NoSuchMethodException ex) { ex.printStackTrace(); } }
public void playerKilled(MapleCharacter chr) { try { em.getIv().invokeFunction("playerDead", this, chr); } catch (ScriptException ex) { ex.printStackTrace(); } catch (NoSuchMethodException ex) { ex.printStackTrace(); } }
public void changedMap(final MapleCharacter chr, final int mapid) { try { em.getIv().invokeFunction("changedMap", this, chr, mapid); } catch (NullPointerException npe) { } catch (ScriptException ex) { ex.printStackTrace(); } catch (NoSuchMethodException ex) { ex.printStackTrace(); } }
/** * @param chr * @param mob */ public void monsterKilled(final MapleCharacter chr, final MapleMonster mob) { try { Integer kc = killCount.get(chr); int inc = ((Double) em.getIv().invokeFunction("monsterValue", this, mob.getId())).intValue(); if (kc == null) { kc = inc; } else { kc += inc; } killCount.put(chr, kc); if (chr.getCarnivalParty() != null) { em.getIv().invokeFunction("monsterKilled", this, chr, mob.getStats().getCP()); } } catch (ScriptException ex) { ex.printStackTrace(); } catch (NoSuchMethodException ex) { ex.printStackTrace(); } }
public boolean revivePlayer(MapleCharacter chr) { try { Object b = em.getIv().invokeFunction("playerRevive", this, chr); if (b instanceof Boolean) { return (Boolean) b; } } catch (ScriptException ex) { ex.printStackTrace(); } catch (NoSuchMethodException ex) { ex.printStackTrace(); } return true; }
public void unregisterMonster(MapleMonster mob) { mobs.remove(mob); mob.setEventInstance(null); if (mobs.size() == 0) { try { em.getIv().invokeFunction("allMonstersDead", this); } catch (ScriptException ex) { ex.printStackTrace(); } catch (NoSuchMethodException ex) { ex.printStackTrace(); } } }
public void playerDisconnected(final MapleCharacter chr) { try { byte ret = ((Double) em.getIv().invokeFunction("playerDisconnected", this, chr)).byteValue(); if (ret == 0) { unregisterPlayer(chr); if (getPlayerCount() <= 0) { dispose(); } } else { mutex.lock(); try { if (ret > 0) { unregisterPlayer(chr); if (getPlayerCount() < ret) { for (MapleCharacter player : chars) { removePlayer(player); } dispose(); } } else { unregisterPlayer(chr); ret *= -1; if (isLeader(chr)) { for (MapleCharacter player : chars) { removePlayer(player); } dispose(); } else { if (getPlayerCount() < ret) { for (MapleCharacter player : chars) { removePlayer(player); } dispose(); } } } } finally { mutex.unlock(); } } } catch (ScriptException ex) { ex.printStackTrace(); } catch (NoSuchMethodException ex) { ex.printStackTrace(); } }
public void registerPlayer(MapleCharacter chr) { try { mutex.lock(); try { chars.add(chr); } finally { mutex.unlock(); } chr.setEventInstance(this); em.getIv().invokeFunction("playerEntry", this, chr); } catch (ScriptException ex) { ex.printStackTrace(); } catch (NoSuchMethodException ex) { ex.printStackTrace(); } }
public final void registerCarnivalParty( final MapleCharacter leader, final MapleMap map, final byte team) { leader.clearCarnivalRequests(); List<MapleCharacter> characters = new LinkedList<MapleCharacter>(); final MapleParty party = leader.getParty(); if (party == null) { return; } for (MaplePartyCharacter pc : party.getMembers()) { final MapleCharacter c = map.getCharacterById_InMap(pc.getId()); characters.add(c); registerPlayer(c); c.resetCP(); } final MapleCarnivalParty carnivalParty = new MapleCarnivalParty(leader, characters, team); try { em.getIv().invokeFunction("registerCarnivalParty", this, carnivalParty); } catch (ScriptException ex) { ex.printStackTrace(); } catch (NoSuchMethodException ex) { ex.printStackTrace(); } }