예제 #1
0
 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);
 }
예제 #2
0
 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);
   }
 }
예제 #3
0
 /** 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);
   }
 }
예제 #4
0
  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);
  }
예제 #5
0
 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;
 }
예제 #6
0
 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.");
 }