environment.py (4773B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\dogma\effects\environment.py 2 from dogma.const import effectUseMissiles, effectWarpDisruptSphere, effectOrbitalStrike 3 from inventorycommon.const import orbitalStrikeAmmo 4 from dogma.effects import GetEwarTypeByEffectID 5 6 class Environment: 7 itemID = None 8 charID = None 9 shipID = None 10 targetID = None 11 targetIDs = None 12 otherID = None 13 effectID = None 14 structureID = None 15 startTime = None 16 currentStartTime = None 17 currentSeed = None 18 iterationSuccess = None 19 random = None 20 shipGroupID = None 21 shipCategoryID = None 22 targetTypeID = None 23 otherTypeID = None 24 itemTypeID = None 25 graphicInfo = None 26 unexpectedStop = False 27 actualEffectID = None 28 29 def __init__(self, itemID, charID, shipID, targetID, otherID, effectID, dogmaLM, expressionID, structureID): 30 self.effectID = effectID 31 self.dogmaLM = dogmaLM 32 self.expressionID = expressionID 33 self.slaves = None 34 self.graphicInfo = None 35 if itemID: 36 self.itemID = itemID 37 if type(itemID) is tuple: 38 self.itemTypeID = itemID[2] 39 elif isinstance(itemID, basestring): 40 self.itemTypeID = int(itemID.split('_')[1]) 41 else: 42 self.itemTypeID = dogmaLM.GetItem(itemID).typeID 43 if charID: 44 self.charID = charID 45 if shipID: 46 self.shipID = shipID 47 item = dogmaLM.GetItem(shipID) 48 self.shipGroupID = item.groupID 49 self.shipCategoryID = item.categoryID 50 if targetID: 51 self.targetID = targetID 52 self.targetTypeID = dogmaLM.GetItem(targetID).typeID 53 if otherID: 54 self.otherID = otherID 55 if type(otherID) is tuple: 56 self.otherTypeID = otherID[2] 57 elif isinstance(otherID, basestring): 58 self.itemTypeID = otherID.split('_')[1] 59 else: 60 self.otherTypeID = dogmaLM.GetItem(otherID).typeID 61 self.actualEffectID = effectID 62 if effectID in (effectUseMissiles, effectWarpDisruptSphere) and self.otherTypeID is not None: 63 defEffectID = dogmaLM.dogmaStaticMgr.defaultEffectByType.get(self.otherTypeID) 64 if defEffectID is not None: 65 self.actualEffectID = defEffectID 66 if self.otherTypeID in orbitalStrikeAmmo: 67 self.actualEffectID = effectOrbitalStrike 68 if structureID: 69 self.structureID = structureID 70 71 def Line(self): 72 return [self.itemID, 73 self.charID, 74 self.shipID, 75 self.targetID, 76 self.otherID, 77 [], 78 self.effectID, 79 self.structureID] 80 81 def UpdateOtherID(self, otherID): 82 self.otherID = otherID 83 if type(otherID) is tuple: 84 self.otherTypeID = otherID[2] 85 else: 86 self.otherTypeID = self.dogmaLM.inventory2.GetItem(otherID).typeID 87 88 def Effect(self): 89 return self.dogmaLM.broker.effects[self.effectID] 90 91 def OnStart(self, effect, t): 92 if self.currentStartTime is None: 93 if effect.rangeChance or effect.electronicChance or effect.propulsionChance: 94 self.jammingType = GetEwarTypeByEffectID(self.effectID) 95 self.currentStartTime = t 96 97 def __repr__(self): 98 return ' ItemID: %s, EffectID: %s, CharID: %s, ShipID: %s, TargetID: %s, OtherID: %s, StructureID: %s' % (self.itemID, 99 self.effectID, 100 self.charID, 101 self.shipID, 102 self.targetID, 103 self.otherID, 104 self.structureID) 105 106 107 class BrainEnvironment(Environment): 108 109 def __init__(self, itemID, charID, shipID, targetID, otherID, effectID, dogmaLM, expressionID, structureID): 110 self.effectID = effectID 111 self.dogmaLM = dogmaLM 112 self.expressionID = expressionID 113 self.slaves = None 114 self.graphicInfo = None 115 self.itemID = itemID 116 self.itemTypeID = dogmaLM.GetItem(itemID).typeID 117 if charID: 118 self.charID = charID 119 if shipID: 120 self.shipID = shipID 121 item = dogmaLM.GetItem(shipID) 122 self.shipGroupID = item.groupID 123 self.shipCategoryID = item.categoryID 124 if targetID: 125 self.targetID = targetID 126 self.targetTypeID = dogmaLM.GetItem(targetID).typeID 127 if otherID: 128 self.otherID = otherID 129 if type(otherID) is tuple: 130 self.otherTypeID = otherID[2] 131 else: 132 self.otherTypeID = dogmaLM.GetItem(otherID).typeID 133 if structureID: 134 self.structureID = structureID 135 self.actualEffectID = effectID