예제 #1
0
 public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception {
   if (splitted[0].equalsIgnoreCase("reloadmap")) {
     if (splitted.length < 2) {
       mc.dropMessage("If you don't know how to use it. You should't be using it.");
       return;
     }
     int mapid = Integer.parseInt(splitted[1]);
     MapleMap map = c.getChannelServer().getMapFactory().getMap(mapid);
     map.deleteAndReloadMap();
   } else if (splitted[0].equalsIgnoreCase("reloaddropspawn")) {
     try {
       TimerManager.getInstance().stop();
     } catch (Exception e) {
       mc.dropMessage("Error : " + e);
       e.printStackTrace();
     } finally {
       try {
         TimerManager tMan = TimerManager.getInstance();
         tMan.start();
         mc.dropMessage("Success");
       } catch (Exception e) {
         mc.dropMessage("Error : " + e);
         e.printStackTrace();
       }
     }
   } else if (splitted[0].equalsIgnoreCase("resetreactors")) {
     c.getPlayer().getMap().resetReactors();
   }
 }
예제 #2
0
  public final boolean disposeIfPlayerBelow(final byte size, final int towarp) {
    MapleMap map = null;
    if (towarp != 0) {
      map = this.getMapFactory().getMap(towarp);
    }
    mutex.lock();
    try {
      if (chars.size() <= size) {

        MapleCharacter chr;
        for (int i = 0; i < chars.size(); i++) {
          chr = chars.get(i);
          unregisterPlayer(chr);

          if (towarp != 0) {
            chr.changeMap(map, map.getPortal(0));
          }
        }
        dispose();
        return true;
      }
    } finally {
      mutex.unlock();
    }
    return false;
  }
예제 #3
0
  public final MapleMap getMapInstance(int args) {
    final MapleMap map = mapFactory.getInstanceMap(mapIds.get(args));

    // in case reactors need shuffling and we are actually loading the map
    if (!mapFactory.isInstanceMapLoaded(mapIds.get(args))) {
      if (em.getProperty("shuffleReactors") != null
          && em.getProperty("shuffleReactors").equals("true")) {
        map.shuffleReactors();
      }
    }
    return map;
  }
예제 #4
0
  public void registerSquad(MapleSquad squad, MapleMap map) {
    final int mapid = map.getId();

    for (MapleCharacter player : squad.getMembers()) {
      if (player != null && player.getMapId() == mapid) {
        registerPlayer(player);
      }
    }
  }
예제 #5
0
 public static final void partySearchStart(SeekableLittleEndianAccessor slea, MapleClient c) {
   int min = slea.readInt();
   int max = slea.readInt();
   slea.readInt(); // members
   int jobs = slea.readInt();
   MapleCharacter chr = c.getPlayer();
   MapleMap map = chr.getMap();
   Collection<MapleMapObject> mapobjs = map.getAllPlayer();
   for (MapleMapObject mapobj : mapobjs) {
     if (chr.getParty().getMembers().size() > 5) {
       break;
     }
     if (mapobj instanceof MapleCharacter) {
       MapleCharacter tchar = (MapleCharacter) mapobj;
       int charlvl = tchar.getLevel();
       if (charlvl >= min && charlvl <= max && isValidJob(tchar.getJob(), jobs)) {
         if (c.getPlayer().getParty() == null) {
           try {
             WorldChannelInterface wci = c.getChannelServer().getWorldInterface();
             MapleParty party = c.getPlayer().getParty();
             int partyid = party.getId();
             party = wci.getParty(partyid);
             if (party != null) {
               if (party.getMembers().size() < 6) {
                 MaplePartyCharacter partyplayer = new MaplePartyCharacter(tchar);
                 wci.updateParty(party.getId(), PartyOperation.JOIN, partyplayer);
                 c.getPlayer().receivePartyMemberHP();
                 c.getPlayer().updatePartyMemberHP();
               } else {
                 c.getSession().write(MaplePacketCreator.partyStatusMessage(17));
               }
             }
           } catch (Exception e) {
             c.getChannelServer().reconnectWorld();
           }
         }
       }
     }
   }
 }
예제 #6
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();
    }
  }
예제 #7
0
 public void registerParty(MapleParty party, MapleMap map) {
   for (MaplePartyCharacter pc : party.getMembers()) {
     MapleCharacter c = map.getCharacterById_InMap(pc.getId());
     registerPlayer(c);
   }
 }