コード例 #1
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
 private void target(Info info) {
   if (raidTarget.containsKey(info.getChannel())) {
     info.sendMessage(
         COLOR
             + "The raid target is "
             + raidTarget.get(info.getChannel())
             + " located at "
             + raidLocation.get(info.getChannel()));
   } else info.sendMessage("No target is set.");
 }
コード例 #2
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
 private void setTick(Info info, String time) {
   int addon = 0;
   try {
     addon = Integer.parseInt(time);
   } catch (NumberFormatException e) {
     info.sendMessage(
         "Format exception.  Command should be !setTick # where # is the number of minutes till the next tick.");
   }
   tickSetter = info.getSender();
   tickTime = System.currentTimeMillis();
   OFFSET = (Utils.getRealMinutes(info) + addon) % 15;
   info.sendMessage("Tick set to " + OFFSET + " minutes off.");
 }
コード例 #3
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
 private void aoe(Info info) {
   String msg = COLOR + Colors.BOLD;
   if (info.getMessage().length() > 4) {
     msg += info.getMessage().substring(5) + " ";
   }
   msg += "AOE in!  Call out periodic status of how many hostiles are left.";
   info.sendMessage(msg);
 }
コード例 #4
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
 private void tick(Info info) {
   if (Utils.shouldDefer(info)) return;
   // else
   if (OFFSET == -1) {
     info.sendMessage(
         "Tick not sychronized yet. Wait for the next tick and execute /msg "
             + info.getBot().getName()
             + " !setTickor find out how long until the next tick and execute /msg "
             + info.getBot().getName()
             + " !setTick <mins>");
     return;
   }
   int timeRemaining = 15 - ((15 + Utils.getRealMinutes(info) - OFFSET) % 15);
   long daysSinceSet = (System.currentTimeMillis() - tickTime) / (1000 * 60 * 60 * 24);
   info.sendMessage(
       timeRemaining + " minutes until the next tick (last set " + daysSinceSet + " days ago)");
 }
コード例 #5
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
 /** Sets the time of the next scheduled raid */
 private void setNextRaid(Info info) {
   String raidTime = info.getMessage().substring(13);
   raidTime = substituteTimeZone(raidTime);
   try {
     SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd HH:mm z");
     Date date = parser.parse(raidTime);
     TimeZone z = parser.getTimeZone();
     GregorianCalendar cal = new GregorianCalendar(z);
     cal.setTime(date);
     raids.put(info.getChannel(), cal);
     saveRaids();
     info.sendMessage("Raid time set.");
   } catch (ParseException e) {
     info.sendMessage(
         "Date format was bad.  Date format is like \"2008-11-26 21:45 EST\".  You entered "
             + raidTime);
   }
 }
コード例 #6
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
 private void tickAlarm(Info info) {
   if (OFFSET == -1) {
     info.sendMessage(
         "Tick not sychronized yet. Wait for the next tick and execute /msg "
             + info.getBot().getName()
             + " !setTick or find out how long until the next tick and execute /msg "
             + info.getBot().getName()
             + " !setTick <mins>");
     return;
   }
   int timeRemaining = 15 - ((15 + Utils.getRealMinutes(info) - OFFSET) % 15);
   if (timeRemaining < 2) {
     info.sendMessage(Colors.BLUE + Colors.BOLD + "The tick is in " + timeRemaining + " minutes.");
   } else {
     PingTask ptask = new PingTask(info, "the tick is in one minute.");
     timer.schedule(ptask, (int) ((timeRemaining - 1) * 60 * 1000));
     info.sendMessage("I'll alert you.");
   }
 }
コード例 #7
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
  private void nextRaid(Info info) {
    GregorianCalendar nextRaid = raids.get(info.getChannel());
    GregorianCalendar now = Utils.getRealDate(info);
    int diffMins = (int) ((nextRaid.getTimeInMillis() - now.getTimeInMillis()) / 1000 / 60);
    if (nextRaid.compareTo(now) < 0) {
      info.sendMessage("There is no future raid set.");
      return;
    }
    String tz = info.getMessage().substring(9).trim();
    tz = substituteTimeZone(tz);
    TimeZone timeZone;
    if (tz.length() == 0) timeZone = tZF("GMT");
    else timeZone = tZF(tz);
    formatter.setTimeZone(timeZone);

    String ret = "The next raid is scheduled for " + formatter.format(nextRaid.getTime());
    ret = ret + getTimeDifference(diffMins);
    info.sendMessage(ret);
  }
コード例 #8
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
 private void setTarget(Info info) {
   String factionInfo = info.getMessage().substring(11);
   String[] splitInfo = factionInfo.split("/");
   if (splitInfo.length != 2) {
     info.sendMessage("usage for !setTarget is !setTarget <faction>/<location>");
   } else {
     raidTarget.put(info.getChannel(), splitInfo[0]);
     raidLocation.put(info.getChannel(), splitInfo[1]);
     target(info);
   }
 }
コード例 #9
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
 private void go(Info info) {
   String msg = COLOR + Colors.BOLD + "MOVE OUT!";
   if (raidTarget.get(info.getChannel()) != null) {
     msg +=
         Colors.NORMAL
             + COLOR
             + " Target is "
             + raidTarget.get(info.getChannel())
             + " "
             + raidLocation.get(info.getChannel());
   }
   info.sendMessage(msg);
 }
コード例 #10
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
 public boolean handleMessage(Info info) {
   String message = info.getMessage();
   if (message.equalsIgnoreCase("!go")) {
     go(info);
   } else if (message.equalsIgnoreCase("!ward")) {
     ward(info);
   } else if (message.startsWith("!aoe")) {
     aoe(info);
   } else if (message.equalsIgnoreCase("!pile")) {
     pile(info);
   } else if (message.startsWith("!setPath")) {
     setPath(info);
   } else if (message.startsWith("!setTarget")) {
     setTarget(info);
   } else if (message.equalsIgnoreCase("!path")) {
     path(info);
   } else if (message.equalsIgnoreCase("!target")) {
     target(info);
   } else if (message.equalsIgnoreCase("!tanks")) {
     tanks(info);
   } else if (message.equalsIgnoreCase("!clearAll")) {
     clearStats(info);
   } else if (message.equalsIgnoreCase("!tick")) {
     tick(info);
   } else if (message.equalsIgnoreCase("!setTick")) {
     setTick(info);
   } else if (message.startsWith("!setTick ")) {
     String time = message.substring(9);
     setTick(info, time);
   } else if (message.equalsIgnoreCase("!whoSetTick")) {
     info.sendMessage("The tick was set by " + tickSetter + " at " + new Date(tickTime));
   } else if (message.equalsIgnoreCase("!tickAlarm")) {
     tickAlarm(info);
   } else if (message.startsWith("!setnextraid ")) {
     setNextRaid(info);
   } else if (message.startsWith("!nextraid")) {
     nextRaid(info);
   } else return false;
   return true;
 }
コード例 #11
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
 private void clearStats(Info info) {
   raidTarget.remove(info.getChannel());
   raidLocation.remove(info.getChannel());
   raidPath.remove(info.getChannel());
   info.sendMessage("Raid status cleared.");
 }
コード例 #12
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
 private void tanks(Info info) {
   String msg = COLOR + Colors.BOLD + "Tanks in!  Call out when pets are cleared!";
   info.sendMessage(msg);
 }
コード例 #13
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
 private void pile(Info info) {
   String msg = COLOR + Colors.BOLD + "Everyone in!  Let's clear them out!";
   info.sendMessage(msg);
 }
コード例 #14
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
 private void setPath(Info info) {
   String path = info.getMessage().substring(8);
   raidPath.put(info.getChannel(), path);
   info.sendMessage("The path to the target is set.");
 }
コード例 #15
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
 private void path(Info info) {
   if (raidPath.containsKey(info.getChannel())) {
     info.sendMessage(COLOR + raidPath.get(info.getChannel()));
   } else info.sendMessage("No path to the target is set.");
 }
コード例 #16
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
 private void setTick(Info info) {
   tickSetter = info.getSender();
   tickTime = System.currentTimeMillis();
   OFFSET = Utils.getRealMinutes(info) % 15;
   info.sendMessage("Tick set to " + OFFSET + " minutes off.");
 }
コード例 #17
0
ファイル: RaidCommands.java プロジェクト: Whytemeet/nexusbot
 private void ward(Info info) {
   String msg = COLOR + Colors.BOLD + "Start bashing.  Call out when the ward is down.";
   info.sendMessage(msg);
 }