Example #1
0
def DoFakeNotification():
	message = u"联盟指挥部,傻逼指挥们,都给老子滚到会议大厅来!"
	notification = Notification(notificationID=1, typeID=notificationConst.notificationTypeServerShutdown, senderID=None, receiverID=session.charid, processed=0, created=blue.os.GetWallclockTime(), data={'text': message})
	notification.subject = u"全屏广播"
	notification.subtext = u"来自:军用馒头"
	sm.ScatterEvent('OnNewNotificationReceived', notification)
	return
 def OnClusterShutdownInitiated(self, explanationLabel, when, duration):
     now = blue.os.GetWallclockTime()
     subtitle = localization.GetByLabel(
         'UI/Shared/ShutdownNotificationSubtitleNoDelay')
     message = localization.GetByLabel(
         explanationLabel,
         intervalRemaining=localization.formatters.
         FormatTimeIntervalWritten(
             when - now,
             showTo=localization.formatters.TIME_CATEGORY_MINUTE),
         shutdownTime=util.FmtDate(when, 'ns'))
     if duration:
         subtitle = localization.GetByLabel(
             'UI/Shared/ShutdownNotificationSubtitleWithDelay',
             delay=localization.formatters.FormatTimeIntervalWritten(
                 when - now,
                 showTo=localization.formatters.TIME_CATEGORY_MINUTE))
         message += localization.GetByLabel(
             '/EVE-Universe/ClusterBroadcast/DowntimeMessageSuffix',
             downtimeInterval=localization.formatters.
             FormatTimeIntervalWritten(
                 duration * const.MIN,
                 showTo=localization.formatters.TIME_CATEGORY_MINUTE))
     notification = Notification(
         notificationID=1,
         typeID=notificationConst.notificationTypeServerShutdown,
         senderID=None,
         receiverID=session.charid,
         processed=0,
         created=blue.os.GetWallclockTime(),
         data={'text': message})
     notification.subject = localization.GetByLabel(
         'UI/Shared/ShutdownNotificationTitle')
     notification.subtext = subtitle
     sm.ScatterEvent('OnNewNotificationReceived', notification)
    def provide(self):
        notificationList = []
        completedDict = sm.GetService('achievementSvc').completedDict
        for taskID, timestamp in completedDict.iteritems():
            if self.onlyShowAfterDate and timestamp <= self.onlyShowAfterDate:
                continue
            notificationData = AchievementTaskFormatter.MakeData(taskID)
            notification = Notification.MakeAchievementNotification(
                data=notificationData, created=timestamp)
            notificationList.append(notification)
            if self.scatterDebug:
                sm.ScatterEvent('OnNewNotificationReceived', notification)

        allGroups = GetAchievementGroups()
        for eachGroup in allGroups:
            if not eachGroup.IsCompleted():
                continue
            lastCompleteTimestamp = max(
                (completedDict.get(taskID, None)
                 for taskID in eachGroup.achievementTaskIDs))
            notificationData = AchievementOpportunityFormatter.MakeData(
                eachGroup.groupID)
            notification = Notification.MakeAchievementNotification(
                data=notificationData,
                created=lastCompleteTimestamp + 1,
                notificationType=notificationConst.
                notificationTypeOpportunityFinished)
            notificationList.append(notification)

        return notificationList
Example #4
0
 def generate(self, sequence):
     newNotification = Notification(notificationID=-1,
                                    typeID=Notification.NORMAL_NOTIFICATION,
                                    senderID=90000001,
                                    receiverID=90000001,
                                    processed=False,
                                    created=blue.os.GetWallclockTime(),
                                    data={})
     newNotification.subject = 'Subject:' + str(sequence)
     newNotification.body = 'Body:' + str(sequence)
     sm.ScatterEvent('OnNewNotificationReceived', newNotification)
 def OnClusterShutdownCancelled(self, explanationLabel):
     notification = Notification(
         notificationID=1,
         typeID=notificationConst.notificationTypeServerShutdown,
         senderID=None,
         receiverID=session.charid,
         processed=0,
         created=blue.os.GetWallclockTime(),
         data={'text': localization.GetByLabel(explanationLabel)})
     notification.subject = localization.GetByLabel(
         'UI/Shared/ShutdownNotificationTitle')
     notification.subtext = localization.GetByLabel(
         'UI/Shared/ClusterShutdownDelayed')
     sm.ScatterEvent('OnNewNotificationReceived', notification)
    def provide(self):
        notificationList = []
        result = []
        skillRowSet = self.skillSvc.GetSkillHistory(10)
        for row in skillRowSet:
            skill = self.skillSvc.GetSkill(row.skillTypeID)
            if skill is None:
                continue
            objectRow = SkillHistoryRow(row, skill.skillRank, cfg,
                                        EVENT_TYPE_TO_ACTION)
            if self.onlyShowAfterDate and objectRow.logDate <= self.onlyShowAfterDate:
                continue
            skillnameAndLevel = localization.GetByLabel(
                'UI/SkillQueue/Skills/SkillNameAndLevel',
                skill=objectRow.skillTypeID,
                amount=objectRow.level)
            result.append(objectRow)
            notification = Notification.MakeSkillNotification(
                header='%s - %s' % (objectRow.actionString, skillnameAndLevel),
                text='',
                created=objectRow.logDate,
                callBack=None,
                callbackargs=[objectRow.skillTypeID])
            notificationList.append(notification)
            if self.scatterDebug:
                sm.ScatterEvent('OnNewNotificationReceived', notification)

        return notificationList
Example #7
0
 def OnCCPNotification(self,
                       title,
                       subtitle,
                       text,
                       notificationTypeID,
                       language=None):
     if language is None or language == session.languageID:
         notification = Notification(notificationID=1,
                                     typeID=notificationTypeID,
                                     senderID=None,
                                     receiverID=session.charid,
                                     processed=0,
                                     created=blue.os.GetWallclockTime(),
                                     data={'text': text})
         notification.subject = title
         notification.subtext = subtitle
         sm.ScatterEvent('OnNewNotificationReceived', notification)
Example #8
0
 def MakeSkillQueueEmptyNotification(self, skillQueueNotification):
     queueText = localization.GetByLabel('UI/SkillQueue/NoSkillsInQueue')
     skillQueueNotification = Notification.MakeSkillNotification(
         header=queueText,
         text='',
         created=blue.os.GetWallclockTime(),
         callBack=sm.StartService('skills').OnOpenCharacterSheet,
         callbackargs=None,
         notificationType=Notification.SKILL_NOTIFICATION_EMPTYQUEUE)
     return skillQueueNotification
 def OnContactLoggedOff(self, charID):
     labelText = self._GetLabelTextForChar(charID)
     loggedOffNotification = Notification.MakeContactLoggedOffNotification(
         contactCharID=charID,
         currentCharID=session.charid,
         created=blue.os.GetWallclockTime(),
         subject=localization.GetByLabel('UI/Common/UserIsOffline',
                                         charid=charID),
         labelText=labelText)
     sm.ScatterEvent('OnNewNotificationReceived', loggedOffNotification)
Example #10
0
    def GetUnreadNotifications(self):
        self.LogInfo('Getting unread notifications')
        if self.unreadNotifications is None:
            unreadNotifications = []
            newNotifications = self.notificationMgr.GetUnprocessed()
            newSenders = []
            for newNotification in newNotifications:
                notificationObj = Notification.FromDTO(newNotification)
                if IsTypeInCommunications(notificationObj.typeID):
                    unreadNotifications.append(
                        Notification.FromDTO(newNotification))
                    newSenders.append(newNotification.senderID)
                    groupID = GetTypeGroup(newNotification.typeID)
                    if groupID in self.unreadCount:
                        self.unreadCount[groupID] += 1
                    else:
                        self.unreadCount[groupID] = 1

            self.unreadNotifications = unreadNotifications
            sm.GetService('mailSvc').PrimeOwners(newSenders)
        return self.unreadNotifications
Example #11
0
    def provide(self):
        notificationList = []
        completedDict = sm.GetService('achievementSvc').completedDict
        allAchievements = AchievementLoader().GetAchievements(
            getDisabled=False)
        taskIdsForGroup = GetTaskIds()
        for taskID, timestamp in completedDict.iteritems():
            if self.IsNotificationTooOld(timestamp):
                continue
            if taskID not in allAchievements:
                continue
            if taskID not in taskIdsForGroup:
                continue
            notificationData = AchievementTaskFormatter.MakeData(taskID)
            notification = Notification.MakeAchievementNotification(
                data=notificationData, created=timestamp)
            notificationList.append(notification)
            if self.scatterDebug:
                sm.ScatterEvent('OnNewNotificationReceived', notification)

        allGroups = GetAchievementGroups()
        for eachGroup in allGroups:
            if not eachGroup.IsCompleted():
                continue
            lastCompleteTimestamp = max(
                (completedDict.get(taskID, None)
                 for taskID in eachGroup.achievementTaskIDs))
            if self.IsNotificationTooOld(lastCompleteTimestamp):
                continue
            notificationData = AchievementOpportunityFormatter.MakeData(
                eachGroup.groupID)
            notification = Notification.MakeAchievementNotification(
                data=notificationData,
                created=lastCompleteTimestamp + 1,
                notificationType=notificationConst.
                notificationTypeOpportunityFinished)
            notificationList.append(notification)

        return notificationList
Example #12
0
    def GetAllNotifications(self, fromID=0):
        if self.allNotifications is None:
            allServerNotifications = self.notificationMgr.GetAllNotifications(
                fromID=fromID)
            newSenders = []
            allClientNotifications = []
            for notification in allServerNotifications:
                allClientNotifications.append(
                    Notification.FromDTO(notification))
                newSenders.append(notification.senderID)

            sm.GetService('mailSvc').PrimeOwners(newSenders)
            self.allNotifications = allClientNotifications
        return self.allNotifications
Example #13
0
    def GetNotificationsByGroupID(self, groupID):
        if groupID not in self.notifications:
            self.notifications[groupID] = []
            cache = self.notifications[groupID]
            newNotifications = self.notificationMgr.GetByGroupID(groupID)
            newSenders = []
            for newNotification in newNotifications:
                notificationObj = Notification.FromDTO(newNotification)
                if IsTypeInCommunications(notificationObj.typeID):
                    cache.append(notificationObj)
                    newSenders.append(newNotification.senderID)

            sm.GetService('mailSvc').PrimeOwners(newSenders)
        return self.notifications[groupID]
Example #14
0
 def NotifySkills(self, skillChanges, canTrain, isLogonSummary=False):
     emptyQueueNotification = None
     header = '%s - %s'
     skillNotification = None
     subtext = ''
     acttext = localization.GetByLabel(
         'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillTrainingComplete'
     )
     leftSide, rightSide = sm.StartService(
         'neocom').GetSidePanelSideOffset()
     checkQueue = True
     if len(skillChanges):
         eve.Message('skillTrainingFanfare')
         if isLogonSummary or len(skillChanges) > 1:
             subtext = localization.GetByLabel(
                 'UI/SkillQueue/Skills/NumberOfSkills',
                 amount=len(skillChanges))
         else:
             skillTypeID, skillChange = skillChanges[0]
             currentSkill = self.GetSkill(skillTypeID)
             subtext = localization.GetByLabel(
                 'UI/SkillQueue/Skills/SkillNameAndLevel',
                 skill=skillTypeID,
                 amount=currentSkill.skillLevel)
             if skillChange < 0:
                 acttext = localization.GetByLabel(
                     'UI/CharacterSheet/CharacterSheetWindow/SkillTabs/SkillClonePenalty'
                 )
                 checkQueue = False
         header = header % (acttext, subtext)
         skillNotification = Notification.MakeSkillNotification(
             header=header,
             text='',
             created=blue.os.GetWallclockTime(),
             callBack=sm.StartService('skills').OnOpenCharacterSheet,
             callbackargs=skillChanges)
     if checkQueue and canTrain:
         queue = sm.GetService('skillqueue').GetServerQueue()
         if not len(queue) or queue[0].trainingStartTime is None:
             emptyQueueNotification = self.MakeSkillQueueEmptyNotification(
                 None)
     if skillNotification:
         sm.ScatterEvent('OnNewNotificationReceived', skillNotification)
     if emptyQueueNotification:
         sm.ScatterEvent('OnNewNotificationReceived',
                         emptyQueueNotification)
Example #15
0
 def OnNotificationReceived(self,
                            notificationID,
                            typeID,
                            senderID,
                            created,
                            data={}):
     notification = Notification(notificationID=notificationID,
                                 typeID=typeID,
                                 senderID=senderID,
                                 receiverID=session.charid,
                                 processed=False,
                                 created=created,
                                 data=data)
     groupID = GetTypeGroup(typeID)
     if groupID is None:
         log.LogException('No group for typeID = %s' % typeID)
     elif IsTypeInCommunications(typeID):
         self.InsertNotification(groupID, notification)
         self.AddToUnread(groupID, notification)
     if typeID in self.delayedNotificationsByID:
         self.delayedNotificationsByID[typeID].add(notification)
     else:
         self.ProcessNotification(notification)
Example #16
0
 def ShowSkillNotification(self, skillTypeIDs, left, onlineTraining):
     data = util.KeyVal()
     skillText = ''
     notifySkillTraining = False
     if len(skillTypeIDs) == 1:
         skill = sm.StartService('skills').GetMySkillsFromTypeID(skillTypeIDs[0])
         skillLevel = skill.skillLevel if skill is not None else localization.GetByLabel('UI/Generic/Unknown')
         skillText = localization.GetByLabel('UI/SkillQueue/Skills/SkillNameAndLevel', skill=skillTypeIDs[0], amount=skillLevel)
         if onlineTraining:
             notifySkillTraining = True
     else:
         notifySkillTraining = True
         skillText = localization.GetByLabel('UI/SkillQueue/Skills/NumberOfSkills', amount=len(skillTypeIDs))
     queue = sm.GetService('skillqueue').GetServerQueue()
     skillQueueNotification = None
     if len(queue) == 0:
         skillQueueNotification = self.MakeSkillQueueEmptyNotification(skillQueueNotification)
     headerText = localization.GetByLabel('UI/Generic/SkillTrainingComplete')
     skillnotification = Notification.MakeSkillNotification(headerText + ' - ' + skillText, skillText, blue.os.GetWallclockTime(), callBack=sm.StartService('skills').OnOpenCharacterSheet, callbackargs=skillTypeIDs)
     if notifySkillTraining:
         sm.ScatterEvent('OnNewNotificationReceived', skillnotification)
     if skillQueueNotification:
         sm.ScatterEvent('OnNewNotificationReceived', skillQueueNotification)