starbaseDogmaItem.py (3832B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\dogma\items\starbaseDogmaItem.py 2 from __future__ import absolute_import 3 from .locationDogmaItem import LocationDogmaItem 4 from utillib import KeyVal 5 import inventorycommon.const as invconst 6 import dogma.const as dgmconst 7 from ccpProfile import TimedFunction 8 9 class StarbaseDogmaItem(LocationDogmaItem): 10 11 @TimedFunction('StarbaseDogmaItem::__init__') 12 def __init__(self, dogmaLocation, item, eveCfg, clientIDFunc): 13 LocationDogmaItem.__init__(self, dogmaLocation, item, eveCfg, clientIDFunc) 14 self.controlTower = None 15 16 def SetLocation(self, locationID, locationDogmaItem, flagID): 17 if self.controlTower and locationID != self.controlTower: 18 raise RuntimeError('Structure %s being assigned to a different location than its currently marked control tower!' % self) 19 LocationDogmaItem.SetLocation(self, locationID, locationDogmaItem, flagID) 20 if self.controlTower: 21 self.AddModifierSet(locationDogmaItem.locationMods) 22 try: 23 groupMods = locationDogmaItem.locationGroupMods[self.groupID] 24 self.AddModifierSet(groupMods) 25 except KeyError: 26 pass 27 28 for skillID in self.reqSkills: 29 try: 30 skillMods = locationDogmaItem.locationReqSkillMods[skillID] 31 self.AddModifierSet(skillMods) 32 except KeyError: 33 pass 34 35 def UnsetLocation(self, locationDogmaItem): 36 LocationDogmaItem.UnsetLocation(self, locationDogmaItem) 37 if self.controlTower is not None: 38 raise RuntimeError('Structure %s being disowned but marked as owned by tower %s' % (self, self.controlTower)) 39 if locationDogmaItem: 40 self.RemoveModifierSet(locationDogmaItem.locationMods) 41 try: 42 groupMods = locationDogmaItem.locationGroupMods[self.groupID] 43 self.RemoveModifierSet(groupMods) 44 except KeyError: 45 pass 46 47 for skillID in self.reqSkills: 48 try: 49 skillMods = locationDogmaItem.locationReqSkillMods[skillID] 50 self.RemoveModifierSet(skillMods) 51 except KeyError: 52 pass 53 54 def GetLocation(self): 55 if self.controlTower: 56 try: 57 location = self.dogmaLocation.dogmaItems[self.controlTower] 58 except KeyError: 59 self.controlTower = None 60 location = self.location 61 62 else: 63 location = self.location 64 return location 65 66 def GetShipID(self): 67 return self.controlTower 68 69 def GetOtherID(self): 70 otherID = self.subLocations.get(invconst.flagHiSlot0, None) 71 if otherID is None: 72 other = self.dogmaLocation.GetChargeNonDB(self.itemID, invconst.flagHiSlot0) 73 if other is not None: 74 otherID = other.itemID 75 return otherID 76 77 def GetCharacterID(self): 78 return None 79 80 def CanFitItem(self, dogmaItem, flagID): 81 if dogmaItem.itemID == self.itemID: 82 return True 83 if flagID == invconst.flagHiSlot0: 84 return True 85 return False 86 87 def IsOnline(self): 88 return dgmconst.effectOnlineForStructures in self.activeEffects 89 90 def IsActive(self): 91 for effectID in self.activeEffects: 92 if effectID == dgmconst.effectOnlineForStructures: 93 continue 94 effect = self.dogmaLocation.GetEffect(effectID) 95 if effect.effectCategory in (dgmconst.dgmEffActivation, dgmconst.dgmEffTarget): 96 return True 97 98 return False 99 100 def SetControlTower(self, newTower): 101 self.controlTower = newTower