NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

agencyUtil.py (4958B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\agencyNew\agencyUtil.py
      2 import itertools
      3 from eve.client.script.ui.shared.agencyNew import agencyConst
      4 from eve.client.script.ui.shared.standings.standingUIConst import THRESHOLD_VALUES_BY_THRESHOLDTYPE, THRESHOLDS_FACTIONORCORPWITHAGENTS, AGENT_LEVEL_BY_THRESHOLD_ID
      5 from eve.common.script.sys import idCheckers
      6 from eve.common.script.util.eveCommonUtils import lerp_color
      7 from localization import GetByLabel
      8 trainingDaysOverride = None
      9 
     10 def GetRoundRobinMix(iterables, numMax = -1):
     11     pending = len(iterables)
     12     nexts = itertools.cycle((it.next for it in iterables))
     13     while pending and numMax:
     14         try:
     15             for next in nexts:
     16                 yield next()
     17                 if numMax is not None:
     18                     numMax -= 1
     19                     if not numMax:
     20                         return
     21 
     22         except StopIteration:
     23             pending -= 1
     24             nexts = itertools.cycle(itertools.islice(nexts, pending))
     25 
     26 
     27 def GetRewardHint(rewardType, ownerID = None):
     28     label = agencyConst.HINT_BY_REWARDTYPE[rewardType]
     29     ownerName = cfg.eveowners.Get(ownerID).ownerName if ownerID else None
     30     if label:
     31         return GetByLabel(label, ownerName=ownerName)
     32 
     33 
     34 def GetUnlockedAgents(fromID, newStanding, oldStanding):
     35     standingThresholdByThresholdID = {thresholdID:THRESHOLD_VALUES_BY_THRESHOLDTYPE[thresholdID] for thresholdID in THRESHOLDS_FACTIONORCORPWITHAGENTS}
     36     thresholdOvertaken = next(((thresholdID, threshold) for thresholdID, threshold in standingThresholdByThresholdID.iteritems() if oldStanding <= threshold <= newStanding), None)
     37     if thresholdOvertaken:
     38         agentLvlUnlocked = AGENT_LEVEL_BY_THRESHOLD_ID[thresholdOvertaken[0]]
     39         if idCheckers.IsFaction(fromID):
     40             allAgentsInFaction = sm.GetService('agents').GetAgentsByFactionID(fromID).Clone()
     41             allAgentsInFactionOfUnlockedLvl = allAgentsInFaction.Filter('level')[agentLvlUnlocked]
     42             return allAgentsInFactionOfUnlockedLvl
     43         if idCheckers.IsNPCCorporation(fromID):
     44             allAgentsInCorp = sm.GetService('agents').GetAgentsByCorpID(fromID).Clone()
     45             allAgentsInCorpOfUnlockedLvl = allAgentsInCorp.Filter('level')[agentLvlUnlocked]
     46             return allAgentsInCorpOfUnlockedLvl
     47     return []
     48 
     49 
     50 def CheckTrainingDaysAbove(minDays):
     51     return True
     52 
     53 
     54 def CheckTrainingDaysBelow(maxDays):
     55     pass
     56 
     57 
     58 def GetTrainingDaysTotal():
     59     if trainingDaysOverride is not None:
     60         return trainingDaysOverride
     61     sp = sm.GetService('skills').GetTotalSkillPointsForCharacter()
     62     return SkillPointsToTrainingDays(sp)
     63 
     64 
     65 def SkillPointsToTrainingDays(sp):
     66     return (sp - 366000) / 40000.0
     67 
     68 
     69 def IsNewAgencyEnabled():
     70     return True
     71 
     72 
     73 def GetTimeRemainingText(remaining):
     74     if remaining > 0:
     75         return GetByLabel('UI/Agency/ExpiresIn', remaining=remaining)
     76     else:
     77         return GetByLabel('UI/Inflight/Scanner/Expired')
     78 
     79 
     80 def GetESSBountyColor(minBountyOutput, maxBountyOutput, equilibriumValue, bountiesOutput):
     81     if equilibriumValue <= bountiesOutput <= maxBountyOutput:
     82         newColor = lerp_color(max(bountiesOutput - equilibriumValue, 0), max(maxBountyOutput - equilibriumValue, 0), start_point=agencyConst.ESS_EQUILIBRIUM_PAYOUT_COLOR, end_point=agencyConst.ESS_HIGH_PAYOUT_COLOR)
     83     elif minBountyOutput <= bountiesOutput <= equilibriumValue / 2:
     84         newColor = lerp_color(max(bountiesOutput - equilibriumValue, 0), max(maxBountyOutput - equilibriumValue, 0), start_point=agencyConst.ESS_LOW_PAYOUT_COLOR, end_point=agencyConst.ESS_MEDIUM_PAYOUT_COLOR)
     85     else:
     86         newColor = lerp_color(bountiesOutput, maxBountyOutput, start_point=agencyConst.ESS_MEDIUM_PAYOUT_COLOR, end_point=agencyConst.ESS_EQUILIBRIUM_PAYOUT_COLOR)
     87     return newColor
     88 
     89 
     90 def GetNumberOfJumps(solarSystemID):
     91     return sm.GetService('clientPathfinderService').GetAutopilotJumpCount(fromID=session.solarsystemid2, toID=solarSystemID)
     92 
     93 
     94 def IsAvoidanceSystem(solarSystemID):
     95     return solarSystemID in sm.GetService('clientPathfinderService').GetExpandedAvoidanceItems()
     96 
     97 
     98 def GetSystemsWithinJumpRange(fromID, jumpCountMin, jumpCountMax, shouldIncludeAvoided = False):
     99     pathFinderService = sm.GetService('clientPathfinderService')
    100     inRange = pathFinderService.GetSystemsWithinAutopilotJumpRange(fromID, jumpCountMin, jumpCountMax)
    101     if shouldIncludeAvoided:
    102         allAvoidedSolarSystemIDs = pathFinderService.GetExpandedAvoidanceItems()
    103         for solarSystemID in allAvoidedSolarSystemIDs:
    104             jumps = GetNumberOfJumps(solarSystemID)
    105             if solarSystemID in inRange[jumps]:
    106                 continue
    107             if jumpCountMin <= jumps < jumpCountMax:
    108                 inRange[jumps].append(solarSystemID)
    109 
    110     return inRange
    111 
    112 
    113 def GetNoRouteFoundText(solarSystemID):
    114     return sm.GetService('clientPathfinderService').GetNoRouteFoundTextAutopilot(solarSystemID)