SHARE
TWEET

Untitled

a guest Jun 3rd, 2017 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var i = 3;
  2. var setupTask;
  3. var mapadonpc = IDDOMAPA;
  4. var npcId = IDDONPC;
  5.  
  6. function init() {
  7.     em.setProperty("entrada", "false");
  8.     scheduleNew();
  9. }
  10.  
  11. function scheduleNew() {
  12.     var cal = java.util.Calendar.getInstance();
  13.     cal.set(java.util.Calendar.HOUR, 3);
  14.     cal.set(java.util.Calendar.MINUTE, 50);
  15.     cal.set(java.util.Calendar.SECOND, 0);
  16.     var nextTime = cal.getTimeInMillis();
  17.     while (nextTime <= java.lang.System.currentTimeMillis()) {
  18.         nextTime += 1000 * 60 * 60 * 4; // de 4 em 4 horas
  19.     }
  20.     setupTask = em.scheduleAtTimestamp("setup", nextTime);
  21. }
  22.  
  23. function cancelSchedule() {
  24.     setupTask.cancel(true);
  25. }
  26.  
  27. function setup() {
  28.     em.setProperty("entrada", "false");
  29.     var x;
  30.     for (x = 0; x < 3; x++) {
  31.         em.schedule("anunciar", 3 * 60000 + x * 60000);
  32.     }
  33.     em.schedule("start", 3 * 60000 + (x + 1) * 60000);
  34.             if (npcId != null && !npcId.getName().equals("MISSINGNO")) {
  35.                 npcId.setPosition(c.getPlayer().getPosition());
  36.                 npcId.setCy(posy);
  37.                 npcId.setRx0(posx0 + 50);
  38.                 npcId.setRx1(posx1 - 50);
  39.                 npcId.setFh(c.getPlayer().getMap().getFootholds().findBelow(c.getPlayer().getPosition()).getId());
  40.                 npcId.setCustom(true);
  41.                 mapadonpc.addMapObject(npcId);
  42.                 mapadonpc.broadcastMessage(MaplePacketCreator.spawnNPC(npcId));
  43.             }
  44. }
  45.  
  46. function announce() {
  47.     em.setProperty("entrada", "true");
  48.     if (i == 0) i = 3;
  49.     em.getChannelServer().broadcastPacket(
  50.         net.sf.odinms.tools.MaplePacketCreator.serverNotice(6, "[Evento] O evento vai comecar em " +10+ " minutos."));
  51.     i--;
  52. }
  53. function start() {
  54.     scheduleNew();
  55.     em.getChannelServer().broadcastPacket(
  56.         net.sf.odinms.tools.MaplePacketCreator.serverNotice(6, "[Evento] O evento comecou!")); 
  57.     var iter = em.getInstances().iterator();
  58.     while (iter.hasNext()) {
  59.         var eim = iter.next();
  60.         if (eim.getPlayerCount() > 0) {
  61.             startInstance(eim);
  62.         }
  63.     }
  64.         (mapadonpc).removeMapObject(npcId.getObjectId());
  65. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top