baseDogma.py (1781B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\common\script\dogma\baseDogma.py 2 import carbon.common.script.sys.service as service 3 from eve.common.lib import appConst as const 4 from eve.common.script.sys.idCheckers import IsCharacter 5 from eveexceptions import UserError 6 7 class BaseDogma(service.Service): 8 __guid__ = 'svc.baseDogma' 9 10 def Run(self, *args): 11 service.Service.Run(self, *args) 12 13 def __init__(self): 14 service.Service.__init__(self) 15 16 def SkillCheck(self, env, arg1, arg2): 17 dogmaLM = env.dogmaLM 18 if IsCharacter(env.charID): 19 dogmaLM.CheckSkillRequirementsForType(env.charID, env.itemTypeID, arg1) 20 return 1 21 22 def UserError(self, env, arg1, arg2): 23 dogmaLM = env.dogmaLM 24 moduleID = env.itemID 25 args = {'moduleName': (const.UE_TYPEID, env.itemTypeID)} 26 if arg1 == 'NotEnoughPower': 27 args['moduleType'] = env.itemTypeID 28 args['require'] = dogmaLM.GetAttributeValue(moduleID, const.attributePower) 29 shipID = env.shipID 30 powerOutput = dogmaLM.GetAttributeValue(shipID, const.attributePowerOutput) 31 args['remaining'] = powerOutput - dogmaLM.GetAttributeValue(shipID, const.attributePowerLoad) 32 args['total'] = powerOutput 33 elif arg1 == 'NotEnoughCpu': 34 args['require'] = dogmaLM.GetAttributeValue(moduleID, const.attributeCpu) 35 shipID = env.shipID 36 cpuOutput = dogmaLM.GetAttributeValue(shipID, const.attributeCpuOutput) 37 args['remaining'] = cpuOutput - dogmaLM.GetAttributeValue(shipID, const.attributeCpuLoad) 38 args['total'] = cpuOutput 39 args['moduleType'] = env.itemTypeID 40 raise UserError(arg1, args)