示例#1
0
 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.
   }
 }
示例#2
0
 // 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();
   }
 }
示例#3
0
 public final void removePlayer(final MapleCharacter chr) {
   try {
     em.getIv().invokeFunction("playerExit", this, chr);
   } catch (ScriptException ex) {
     ex.printStackTrace();
   } catch (NoSuchMethodException ex) {
     ex.printStackTrace();
   }
 }
示例#4
0
 public final void leftParty(final MapleCharacter chr) {
   try {
     em.getIv().invokeFunction("leftParty", this, chr);
   } catch (ScriptException ex) {
     ex.printStackTrace();
   } catch (NoSuchMethodException ex) {
     ex.printStackTrace();
   }
 }
示例#5
0
 public final void disbandParty() {
   try {
     em.getIv().invokeFunction("disbandParty", this);
   } catch (ScriptException ex) {
     ex.printStackTrace();
   } catch (NoSuchMethodException ex) {
     ex.printStackTrace();
   }
 }
示例#6
0
 public void playerKilled(MapleCharacter chr) {
   try {
     em.getIv().invokeFunction("playerDead", this, chr);
   } catch (ScriptException ex) {
     ex.printStackTrace();
   } catch (NoSuchMethodException ex) {
     ex.printStackTrace();
   }
 }
示例#7
0
 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();
   }
 }
示例#8
0
 /**
  * @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();
   }
 }
示例#9
0
 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;
 }
示例#10
0
 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();
     }
   }
 }
示例#11
0
  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();
    }
  }
示例#12
0
 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();
   }
 }
示例#13
0
  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();
    }
  }