public void eventCleanupTimerStart(GridEnforcer ge, int secondsRemaining) { if (ge == null) { return; } GridOwner owner = ge.Owner; GridOwner.OWNER_TYPE owner_type = owner.OwnerType; long gridFactionID = ge.Owner.FactionID; BaseResponse.DEST_TYPE destType = BaseResponse.DEST_TYPE.NONE; List <long> Destinations = new List <long>(); string message = ""; if (owner_type == GridOwner.OWNER_TYPE.FACTION) { destType = BaseResponse.DEST_TYPE.FACTION; Destinations.Add(gridFactionID); message += "Your faction's "; } else if (owner_type == GridOwner.OWNER_TYPE.PLAYER) { destType = BaseResponse.DEST_TYPE.PLAYER; Destinations.Add(ge.Owner.PlayerID); message += "Your "; } else { List <long> nearbyPlayers = ge.Grid.getPlayerIDsWithinPlacementRadius(); if (nearbyPlayers.Count > 0) { destType = BaseResponse.DEST_TYPE.PLAYER; Destinations = nearbyPlayers; message += "Nearby "; } else { return; } } log("msg details built", "eventCleanupTimerStart", Logger.severity.TRACE); // build notification message += "grid " + ge.Grid.DisplayName + " will have some of its offending blocks removed in " + Utility.prettySeconds(secondsRemaining); log("msg built, building noti", "eventDerelictStart"); NotificationResponse noti = new NotificationResponse() { NotificationText = message, Time = Constants.NotificationMillis, Font = MyFontEnum.Red, Destination = Destinations, DestType = destType }; log("notification built, sending message", "eventDerelictStart"); m_MailMan.send(noti); log("Msg sent", "eventDerelictStart"); }
public void eventCleanupTimerEnd(GridEnforcer ge, DerelictTimer.COMPLETION c) { //log("start", "eventCleanupTimerEnd", Logger.severity.TRACE); if (ge == null) { return; } //log("grid exists, getting owner", "eventCleanupTimerEnd", Logger.severity.TRACE); GridOwner owner = ge.Owner; //log("grid exists, getting owner type", "eventCleanupTimerEnd", Logger.severity.TRACE); GridOwner.OWNER_TYPE owner_type = owner.OwnerType; //log("grid exists, getting faction", "eventCleanupTimerEnd", Logger.severity.TRACE); long gridFactionID = ge.Owner.FactionID; //log("determining destinations", "eventCleanupTimerEnd", Logger.severity.TRACE); BaseResponse.DEST_TYPE destType = BaseResponse.DEST_TYPE.NONE; List <long> Destinations = new List <long>(); string message = ""; if (owner_type == GridOwner.OWNER_TYPE.FACTION) { destType = BaseResponse.DEST_TYPE.FACTION; Destinations.Add(gridFactionID); message += "Your faction's "; } else if (owner_type == GridOwner.OWNER_TYPE.PLAYER) { destType = BaseResponse.DEST_TYPE.PLAYER; Destinations.Add(ge.Owner.PlayerID); message += "Your "; } else { List <long> nearbyPlayers = ge.Grid.getPlayerIDsWithinPlacementRadius(); if (nearbyPlayers.Count > 0) { destType = BaseResponse.DEST_TYPE.PLAYER; Destinations = nearbyPlayers; message += "Nearby "; } else { return; } } log("building message", "eventCleanupTimerEnd", Logger.severity.TRACE); MyFontEnum font = MyFontEnum.Red; if (c == DerelictTimer.COMPLETION.CANCELLED) { message += "grid " + ge.Grid.DisplayName + " is now within limits."; font = MyFontEnum.Green; } else if (c == DerelictTimer.COMPLETION.ELAPSED) { message += "grid " + ge.Grid.DisplayName + " had some of its offending blocks removed."; font = MyFontEnum.Red; } log("Sending message", "eventDerelictEnd"); NotificationResponse noti = new NotificationResponse() { NotificationText = message, Time = Constants.NotificationMillis, Font = font, Destination = Destinations, DestType = destType }; m_MailMan.send(noti); }
public void eventCleanupViolation(GridEnforcer ge, List <GridEnforcer.VIOLATION> violations) { log("Start", "eventCleanupViolation"); if (ge == null) { return; } log("Determine destination", "eventCleanupViolation"); GridOwner owner = ge.Owner; GridOwner.OWNER_TYPE owner_type = owner.OwnerType; long gridFactionID = ge.Owner.FactionID; BaseResponse.DEST_TYPE destType = BaseResponse.DEST_TYPE.NONE; List <long> Destinations = new List <long>(); string message = ""; if (owner_type == GridOwner.OWNER_TYPE.FACTION) { destType = BaseResponse.DEST_TYPE.FACTION; Destinations.Add(gridFactionID); message += "Your faction's "; } else if (owner_type == GridOwner.OWNER_TYPE.PLAYER) { destType = BaseResponse.DEST_TYPE.PLAYER; Destinations.Add(ge.Owner.PlayerID); message += "Your "; } else { List <long> nearbyPlayers = ge.Grid.getPlayerIDsWithinPlacementRadius(); if (nearbyPlayers.Count > 0) { destType = BaseResponse.DEST_TYPE.PLAYER; Destinations = nearbyPlayers; message += "Nearby unowned "; } else { return; } } message += "grid '" + ge.Grid.DisplayName + "' "; log("Build violations message", "eventCleanupViolation"); if (violations != null) { message += "is violating: "; foreach (GridEnforcer.VIOLATION violation in violations) { message += violation.Name + ": " + violation.Count + "/" + violation.Limit + " "; } message += " and "; } log("Build time message", "eventCleanupViolation"); int secondsUntilCleanup = ge.TimeUntilCleanup; message += "will have some blocks removed in " + Utility.prettySeconds(secondsUntilCleanup); // send log("Sending message", "eventDerelictStart"); NotificationResponse noti = new NotificationResponse() { NotificationText = message, Time = Constants.NotificationMillis, Font = MyFontEnum.Red, Destination = Destinations, DestType = destType }; m_MailMan.send(noti); }