예제 #1
0
 internal static void SendMobileNotifications()
 {
     while (NotificationManager.pushQueue.Count > 0)
     {
         NotificationManager.SendNotification(NotificationManager.pushQueue.Dequeue());
     }
 }
예제 #2
0
 internal static void SendEmailNotification()
 {
     if (Trinity.Settings.Notification.MailEnabled && NotificationManager.EmailMessage.Length > 0)
     {
         NotificationManager.SendEmail(
             Trinity.Settings.Notification.EmailAddress,
             Trinity.Settings.Notification.EmailAddress,
             "New DB stash loot - " + FileManager.BattleTagName,
             NotificationManager.EmailMessage.ToString(),
             NotificationManager.SmtpServer,
             Trinity.Settings.Notification.EmailPassword);
     }
     NotificationManager.EmailMessage.Clear();
 }
예제 #3
0
        /// <summary>
        /// Log the nice items we found and stashed
        /// </summary>
        internal static void LogGoodItems(CachedACDItem acdItem, GItemBaseType itemBaseType, GItemType itemType, double itemValue)
        {
            FileStream LogStream = null;

            try
            {
                string filePath = Path.Combine(FileManager.LoggingPath, "StashLog - " + Trinity.Player.ActorClass.ToString() + ".log");
                LogStream = File.Open(filePath, FileMode.Append, FileAccess.Write, FileShare.Read);

                //TODO : Change File Log writing
                using (StreamWriter LogWriter = new StreamWriter(LogStream))
                {
                    if (!_loggedAnythingThisStash)
                    {
                        _loggedAnythingThisStash = true;
                        LogWriter.WriteLine(DateTime.Now.ToString() + ":");
                        LogWriter.WriteLine("====================");
                    }
                    string sLegendaryString        = "";
                    bool   shouldSendNotifications = false;
                    if (acdItem.Quality >= ItemQuality.Legendary)
                    {
                        if (!Trinity.Settings.Notification.LegendaryScoring)
                        {
                            shouldSendNotifications = true;
                        }
                        else if (Trinity.Settings.Notification.LegendaryScoring && Trinity.CheckScoreForNotification(itemBaseType, itemValue))
                        {
                            shouldSendNotifications = true;
                        }
                        if (shouldSendNotifications)
                        {
                            NotificationManager.AddNotificationToQueue(acdItem.RealName + " [" + itemType.ToString() +
                                                                       "] (Score=" + itemValue.ToString() + ". " + ValueItemStatString + ")",
                                                                       ZetaDia.Service.Hero.Name + " new legendary!", ProwlNotificationPriority.Emergency);
                        }
                        sLegendaryString = " {legendary item}";

                        // Change made by bombastic
                        Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "+=+=+=+=+=+=+=+=+ LEGENDARY FOUND +=+=+=+=+=+=+=+=+");
                        Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "+  Name:       {0} ({1})", acdItem.RealName, itemType);
                        Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "+  Score:       {0:0}", itemValue);
                        Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "+  Attributes: {0}", ValueItemStatString);
                        Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+");
                    }
                    else
                    {
                        // Check for non-legendary notifications
                        shouldSendNotifications = Trinity.CheckScoreForNotification(itemBaseType, itemValue);
                        if (shouldSendNotifications)
                        {
                            NotificationManager.AddNotificationToQueue(acdItem.RealName + " [" + itemType.ToString() + "] (Score=" + itemValue.ToString() + ". " + ValueItemStatString + ")", ZetaDia.Service.Hero.Name + " new item!", ProwlNotificationPriority.Emergency);
                        }
                    }
                    if (shouldSendNotifications)
                    {
                        NotificationManager.EmailMessage.AppendLine(itemBaseType.ToString() + " - " + itemType.ToString() + " '" + acdItem.RealName + "'. Score = " + Math.Round(itemValue).ToString() + sLegendaryString)
                        .AppendLine("  " + ValueItemStatString)
                        .AppendLine();
                    }
                    LogWriter.WriteLine(itemBaseType.ToString() + " - " + itemType.ToString() + " '" + acdItem.RealName + "'. Score = " + Math.Round(itemValue).ToString() + sLegendaryString);
                    LogWriter.WriteLine("  " + ValueItemStatString);
                    LogWriter.WriteLine("");
                }
                LogStream.Close();
            }
            catch (IOException)
            {
                Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "Fatal Error: File access error for stash log file.");
                if (LogStream != null)
                {
                    LogStream.Close();
                }
            }
        }