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

security.py (1407B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\behaviors\utility\security.py
      2 from eveuniverse.security import SecurityClassFromLevel, securityClassHighSec, securityClassLowSec, securityClassZeroSec, securityClassSafeSec
      3 
      4 def is_in_safe_sec(task):
      5     return get_local_security_level(task) == securityClassSafeSec
      6 
      7 
      8 def is_in_high_sec(task):
      9     return get_local_security_level(task) == securityClassHighSec
     10 
     11 
     12 def is_in_low_sec(task):
     13     return get_local_security_level(task) == securityClassLowSec
     14 
     15 
     16 def is_in_zero_sec(task):
     17     return get_local_security_level(task) == securityClassZeroSec
     18 
     19 
     20 def get_local_security_level(task):
     21     return get_security_level_for_system(task.context.solarSystemId)
     22 
     23 
     24 def get_security_level_for_system(solar_system_id):
     25     return SecurityClassFromLevel(cfg.mapSystemCache[solar_system_id].securityStatus)
     26 
     27 
     28 def get_spawnlist_by_group_owner_and_security_level(task):
     29     ownerToSpawnlistMapping = get_spawnlist_by_owner_map_by_security(task)
     30     return ownerToSpawnlistMapping.get(task.GetGroupOwnerId())
     31 
     32 
     33 def get_spawnlist_by_owner_map_by_security(task):
     34     if is_in_high_sec(task) or is_in_safe_sec(task):
     35         return task.attributes.highSecOwnerToSpawnlistMapping
     36     elif is_in_low_sec(task):
     37         return task.attributes.lowSecOwnerToSpawnlistMapping
     38     else:
     39         return task.attributes.zeroSecOwnerToSpawnlistMapping