Example #1
0
 def UpdateTraining(self, skill):
     if not self or self.destroyed:
         return
     ETA = self._GetEndOfTraining(skill.typeID)
     level = skill.skillLevel
     if not self or self.destroyed or util.GetAttrs(
             self, 'sr', 'node', 'skill', 'typeID') != skill.typeID:
         return
     if ETA:
         time = ETA - gametime.GetWallclockTime()
         secs = time / 10000000L
     else:
         time = 0
         secs = 0
     currentPoints = sm.GetService(
         'skillqueue').GetEstimatedSkillPointsTrained(skill.typeID)
     if util.GetAttrs(self, 'sr', 'node', 'trainToLevel') != level:
         if util.GetAttrs(self, 'sr', 'node', 'timeLeft'):
             time = self.sr.node.timeLeft
         else:
             time = None
     self.SetTimeLeft(time)
     if ETA:
         self.endOfTraining = ETA
     else:
         self.endOfTraining = None
     self.lasttime = gametime.GetWallclockTime()
     self.lastsecs = secs
     self.lastpoints = currentPoints
     self.timer = base.AutoTimer(1000, self.UpdateProgress)
     return currentPoints
Example #2
0
 def ApplyAttributes(self, attributes):
     Window.ApplyAttributes(self, attributes)
     self.taskMap = {}
     self.controller = None
     self.buttonCont = Container(parent=self.sr.main,
                                 name='buttonbar',
                                 align=uiconst.TOTOP,
                                 height=24,
                                 clipChildren=True)
     GradientSprite(bgParent=self.buttonCont,
                    rotation=-math.pi / 2,
                    rgbData=[(0, (1.0, 1.0, 1.3))],
                    alphaData=[(0.6, 0.0), (1.0, 0.05)])
     self.clockCont = Container(parent=self.sr.main,
                                name='clockbar',
                                align=uiconst.TOTOP,
                                height=24,
                                clipChildren=True)
     GradientSprite(bgParent=self.buttonCont,
                    rotation=-math.pi / 2,
                    rgbData=[(0, (1.0, 1.0, 1.3))],
                    alphaData=[(0.6, 0.0), (1.0, 0.05)])
     self.lastUpdateTime = gametime.GetWallclockTime()
     self.lastResetTime = gametime.GetWallclockTime()
     self.currentTimeLabel = eveLabel.EveLabelMedium(parent=self.clockCont,
                                                     text='',
                                                     left=8)
     self.lastUpdateTimeLabel = eveLabel.EveLabelMedium(
         parent=self.clockCont, text='', left=158)
     self.lastResetTimeLabel = eveLabel.EveLabelMedium(
         parent=self.clockCont, text='', left=258)
     self.leftCont = DragResizeCont(
         name='leftCont',
         parent=self.sr.main,
         align=uiconst.TOLEFT_PROP,
         settingsID='BehaviorDebugWindowLeftContent',
         minSize=0.2,
         maxSize=0.8,
         defaultSize=0.5)
     GradientSprite(bgParent=self.leftCont,
                    rotation=0,
                    rgbData=[(0, (1.0, 1.0, 1.3))],
                    alphaData=[(0.8, 0.0), (1.0, 0.05)])
     self.mainScroll = ScrollContainer(name='behaviortree',
                                       parent=self.leftCont.mainCont,
                                       align=uiconst.TOALL,
                                       padding=(4, 4, 4, 4))
     self.blackboardScroll = ScrollContainer(name='blackboards',
                                             parent=self.sr.main,
                                             padding=(4, 4, 4, 4))
     GradientSprite(bgParent=self.blackboardScroll,
                    rotation=0,
                    rgbData=[(0, (1.0, 1.0, 1.3))],
                    alphaData=[(0.8, 0.0), (1.0, 0.05)])
     self.timeUpdateTimer = AutoTimer(1000, self._TimeUpdater)
Example #3
0
 def _TimeUpdater(self):
     self.currentTimeLabel.SetText(
         'Time:  current: %s' % FmtDate(gametime.GetWallclockTime(), 'nl'))
     self.lastUpdateTimeLabel.SetText('tick: %s' %
                                      FmtDate(self.lastUpdateTime, 'nl'))
     self.lastResetTimeLabel.SetText('reset: %s' %
                                     FmtDate(self.lastResetTime, 'nl'))
Example #4
0
def GetQueueEntry(skillTypeID,
                  skillLevel,
                  queuePosition,
                  currentSkill,
                  currentQueue,
                  GetTimeForTraining,
                  KeyVal,
                  activate,
                  trainingStartTime=None):
    trainingEndTime = None
    if trainingStartTime is None and activate:
        if queuePosition == 0 or len(currentQueue) == 0:
            trainingStartTime = gametime.GetWallclockTime()
        else:
            trainingStartTime = currentQueue[queuePosition - 1].trainingEndTime
        trainingTime = GetTimeForTraining(skillTypeID, skillLevel)
        trainingEndTime = long(trainingStartTime) + long(trainingTime)
    if currentSkill.skillLevel == skillLevel - 1:
        trainingStartSP = currentSkill.skillPoints
    else:
        trainingStartSP = GetSPForLevelRaw(currentSkill.skillRank,
                                           skillLevel - 1)
    trainingDestinationSP = GetSPForLevelRaw(currentSkill.skillRank,
                                             skillLevel)
    return SkillQueueEntry(queuePosition, skillTypeID, skillLevel,
                           trainingStartSP, trainingStartTime,
                           trainingDestinationSP, trainingEndTime, KeyVal)
Example #5
0
def FormatCountDownTime(targetTime):
    now = gametime.GetWallclockTime()
    if targetTime > now:
        diff = targetTime - now
        timeText = FmtTime(diff)
        timeText += '<br>%s' % FmtDate(targetTime, 'ls')
    else:
        timeText = GetByLabel('UI/Sovereignty/Status/Overtime')
    return timeText
Example #6
0
 def UpdateFutureSystemText(self):
     if self.capitalSystemInfo.newCapitalSystem:
         self.futureSystemCont.display = True
         solarSystemID = self.capitalSystemInfo.newCapitalSystem
         self.futureSystemLabel.text = sm.GetService('infoPanel').GetSolarSystemTrace(solarSystemID, '')
         interval = max(0L, self.capitalSystemInfo.newCapitalSystemValidAfter - gametime.GetWallclockTime())
         self.futureSystemTime.text = GetByLabel('UI/Sovereignty/CapitalChangeTime', time=interval)
     else:
         self.futureSystemCont.display = False
Example #7
0
    def LoadEvents(self, events):
        doReset = False
        for time, name, data in events:
            if name == 'Reset':
                doReset = True

        if doReset:
            self.ResetStatusToInvalid()
        self.lastUpdateTime = gametime.GetWallclockTime()
Example #8
0
 def GetEstimatedSkillPointsTrained(self, skillTypeID):
     startTime = self.GetStartTimeOfQueue()
     currentTime = gametime.GetWallclockTime()
     if startTime is None:
         startTime = currentTime
     trainingCalculator = self.skills.GetSkillTrainingTimeCalculator()
     with trainingCalculator.specific_current_time_context(startTime):
         skillPointsTrained = trainingCalculator.get_skill_points_trained_at_sample_time(
             skillTypeID, startTime, currentTime)
     return skillPointsTrained
Example #9
0
def CalculateStructureStatusFromStructureInfo(structureInfo):
    campaignState = structureInfo.get('campaignState', None)
    vulnerabilityState = structureInfo.get('vulnerabilityState', None)
    if campaignState:
        eventType, defenderID, startTime, scoreByTeamID = campaignState
        if gametime.GetWallclockTime() < startTime:
            structureStatus = STATUS_REINFORCED
        else:
            structureStatus = STATUS_NODEFIGHT
    elif vulnerabilityState is None:
        structureStatus = STATUS_INVULNERABLE
    else:
        startTime, endTime = vulnerabilityState
        now = gametime.GetWallclockTime()
        if now < startTime:
            structureStatus = STATUS_INVULNERABLE
        elif now > endTime:
            structureStatus = STATUS_VULNERABLE_OVERTIME
        else:
            structureStatus = STATUS_VULNERABLE
    return structureStatus
Example #10
0
def UpdateAndGetNewAchievements(existingAchivements, completedDict,
                                statsTrakcer):
    newAchievementDict = {}
    for key, achievement in existingAchivements.iteritems():
        if achievement.achievementID in completedDict:
            continue
        if achievement.IsAchievementFulfilled(statsTrakcer.GetStatistics()):
            timestamp = gametime.GetWallclockTime()
            statsTrakcer.AddAchievement(achievement.achievementID,
                                        dateAchieved=timestamp)
            newAchievementDict[achievement.achievementID] = timestamp

    return newAchievementDict
Example #11
0
 def __init__(self, quest):
     super(QuestCompleteNotification, self).__init__(
         notificationID=-1,
         typeID=notificationconst.notificationTypeQuestComplete,
         senderID=None,
         receiverID=None,
         processed=False,
         created=gametime.GetWallclockTime(),
         data=None)
     self.subject = localization.GetByLabel(
         'UI/Quest/QuestCompleteNotificationSubject',
         title=quest.titleLabel,
         reward=quest.rewardLabel)
Example #12
0
 def GetAddedSpAndAddedTimeForSkill(self, skillTypeID, skillLevel, skillSet,
                                    theoreticalSkillPointsDict,
                                    trainingTimeOffset, skillBoosters):
     skillStartTime = long(trainingTimeOffset) + gametime.GetWallclockTime()
     isAccelerated = skillBoosters.is_any_booster_active_at_time(
         skillStartTime)
     if skillTypeID not in theoreticalSkillPointsDict:
         skillObj = skillSet.get(skillTypeID, None)
         theoreticalSkillPointsDict[
             skillTypeID] = self.GetSkillPointsFromSkillObject(
                 skillTypeID, skillObj)
     addedSP, addedTime = self.GetSkillPointsAndTimeNeededToTrain(
         skillTypeID, skillLevel, theoreticalSkillPointsDict[skillTypeID],
         skillStartTime)
     return (addedSP, addedTime, isAccelerated)
Example #13
0
def GetStructureStatusString(structureInfo, getTimeString=False):
    structureTypeID = structureInfo['typeID']
    typeString = dashboardConst.STRUCTURELABEL_BY_TYPEID[structureTypeID]
    typeLabel = GetByLabel(typeString)
    timeText = None
    structureStatus = CalculateStructureStatusFromStructureInfo(structureInfo)
    if structureStatus == dashboardConst.STATUS_VULNERABLE:
        text = GetByLabel('UI/Sovereignty/Status/VulnerableNowType',
                          typeName=typeLabel)
        vulnerabilityState = structureInfo.get('vulnerabilityState', None)
        startTime, endTime = vulnerabilityState
        timeText = FormatCountDownTime(endTime)
    elif structureStatus == dashboardConst.STATUS_VULNERABLE_OVERTIME:
        text = GetByLabel('UI/Sovereignty/Status/VulnerableType',
                          typeName=typeLabel)
        timeText = GetByLabel('UI/Sovereignty/Status/Overtime')
    elif structureStatus == dashboardConst.STATUS_REINFORCED:
        text = GetByLabel('UI/Sovereignty/Status/ReinforcedType',
                          typeName=typeLabel)
        campaignState = structureInfo.get('campaignState', None)
        eventType, defenderID, startTime, scoreByTeamID = campaignState
        timeText = FormatCountDownTime(startTime)
    elif structureStatus == dashboardConst.STATUS_INVULNERABLE:
        text = GetByLabel('UI/Sovereignty/Status/InvulnerableType',
                          typeName=typeLabel)
        vulnerabilityState = structureInfo.get('vulnerabilityState', None)
        if vulnerabilityState is None:
            timeText = GetByLabel('UI/Sovereignty/Status/Unknown')
        else:
            startTime, endTime = vulnerabilityState
            if startTime - gametime.GetWallclockTime() > DAY:
                startDateFormat = 'ls'
            else:
                startDateFormat = 'ns'
            startTimeText = FmtDate(startTime, startDateFormat)
            endTimeText = FmtDate(endTime, 'ns')
            timeText = '%s<br>%s-%s' % (
                GetByLabel('UI/Sovereignty/Status/VulnerabilityWindow'),
                startTimeText, endTimeText)
    elif structureStatus == dashboardConst.STATUS_NODEFIGHT:
        text = GetByLabel('UI/Sovereignty/Status/ContestedType',
                          typeName=typeLabel)
        timeText = GetByLabel('UI/Sovereignty/StatusOngoing')
    else:
        text = ''
    if getTimeString:
        return (text, timeText)
    return text
Example #14
0
 def GetTimeForTraining(self, skillTypeID, toLevel, trainingStartTime=0):
     currentTraining = self.SkillInTraining(skillTypeID)
     currentSkillPointsDict = {}
     currentTime = gametime.GetWallclockTime()
     if currentTraining:
         trainingEndTime = self.GetEndOfTraining(skillTypeID)
         timeForTraining = trainingEndTime - currentTime
     else:
         timeOffset = 0
         if trainingStartTime:
             timeOffset = trainingStartTime - currentTime
         skill = self.skills.GetSkill(skillTypeID)
         attributes = self.GetPlayerAttributeDict()
         skillBoosters = self.GetSkillAcceleratorBoosters()
         skillBoosters.apply_expired_attributes_at_time_offset(
             attributes, timeOffset)
         currentSkillPointsDict[
             skillTypeID] = self.GetSkillPointsFromSkillObject(
                 skillTypeID, skill)
         _, timeForTraining = self.GetSkillPointsAndTimeNeededToTrain(
             skillTypeID, toLevel, currentSkillPointsDict[skillTypeID],
             trainingStartTime or currentTime)
     return long(timeForTraining)
Example #15
0
 def UpdateProgress(self):
     try:
         if self.endOfTraining is None:
             self.timer = None
             return
         skill = self.rec
         endOfTrainingTime = self._GetEndOfTraining(skill.typeID)
         if endOfTrainingTime is None:
             return
         timeLeft = endOfTrainingTime - gametime.GetWallclockTime()
         skillSvc = sm.GetService('skills')
         skillPointsForNextLevel = skillSvc.SkillpointsNextLevel(
             skill.typeID)
         if skillPointsForNextLevel is None:
             return
         currentPoints = sm.GetService(
             'skillqueue').GetEstimatedSkillPointsTrained(skill.typeID)
         self.OnSkillpointChange(currentPoints)
         self.SetTimeLeft(timeLeft)
         self.UpdateHalfTrained()
     except:
         self.timer = None
         log.LogException()
         sys.exc_clear()
Example #16
0
def IsBoosterExpiredThen(timeOffset, boosterExpiryTime):
    return boosterExpiryTime <= gametime.GetWallclockTime() + timeOffset
Example #17
0
 def _get_time_until_expiration(self):
     return self.expiration_date - gametime.GetWallclockTime()
Example #18
0
 def nextAvailableShortLabel(self):
     timeLeft = self._timestamp - gametime.GetWallclockTime()
     return localization.GetByLabel('UI/Quest/TimeUntilAvailableShort',
                                    time=timeLeft)
Example #19
0
 def isComplete(self):
     return gametime.GetWallclockTime() < self._timestamp
Example #20
0
 def MakeSampleData(variant = 0):
     return StructureDestructRequested.MakeData(1926, 30004797, 150135866, 'my corp', gametime.GetWallclockTime())
Example #21
0
    def ResetStatusToInvalid(self):
        for entry in self.taskMap.itervalues():
            entry.SetStatus(TaskInvalidStatus)

        self.lastResetTime = gametime.GetWallclockTime()
Example #22
0
 def GetTrainingEndTimeOfQueue(self):
     return gametime.GetWallclockTime() + self.GetTrainingLengthOfQueue()
Example #23
0
def CalculateDecayedInfluence(info):
    currentTime = gametime.GetWallclockTime()
    return CalculateDecayedInfluenceWithTime(info.influence, info.lastUpdated, currentTime, info.decayRate, info.graceTime)