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

moduleRestrictions.py (1572B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\dogma\moduleRestrictions.py
      2 import dogma.const as dogmaConst
      3 from eveuniverse.security import is_high_sec_or_higher, is_low_sec
      4 from eveexceptions import UserError
      5 
      6 def CheckAllowedInCurrentSecurityClass(dogmaLM, itemID):
      7     if is_low_sec(dogmaLM.securityClass):
      8         _CheckDisallowedInEmpire(dogmaLM, itemID, dogmaConst.attributeAllowInFullyCorruptedLowSec)
      9     elif is_high_sec_or_higher(dogmaLM.securityClass):
     10         _CheckDisallowedInEmpire(dogmaLM, itemID, dogmaConst.attributeAllowInFullyCorruptedHighSec)
     11         _CheckDisallowedInHighSec(dogmaLM, itemID)
     12 
     13 
     14 def _CheckDisallowedInEmpire(dogmaLM, itemID, allowedExceptionAttribute):
     15     disallowedInEmpire = dogmaLM.GetAttributeValue(itemID, dogmaConst.attributeDisallowInEmpireSpace)
     16     if not disallowedInEmpire:
     17         return
     18     if dogmaLM.IsFullyCorrupted():
     19         allowInFullyCorruptSystem = dogmaLM.GetAttributeValue(itemID, allowedExceptionAttribute)
     20         if allowInFullyCorruptSystem:
     21             return
     22     raise UserError('CantInEmpireSpace')
     23 
     24 
     25 def _CheckDisallowedInHighSec(dogmaLM, itemID):
     26     disallowedInHighSec = dogmaLM.GetAttributeValue(itemID, dogmaConst.attributeDisallowInHighSec)
     27     if not disallowedInHighSec:
     28         return
     29     if dogmaLM.IsFullyCorrupted():
     30         allowInFullyCorruptHighSecSystem = dogmaLM.GetAttributeValue(itemID, dogmaConst.attributeAllowInFullyCorruptedHighSec)
     31         if allowInFullyCorruptHighSecSystem:
     32             return
     33     raise UserError('CantInHighSecSpace')