(modifyingItem, effect)
| 49 | |
| 50 | |
| 51 | def getResistanceAttrID(modifyingItem, effect): |
| 52 | # If it doesn't exist on the effect, check the modifying module's attributes. |
| 53 | # If it's there, cache it and return |
| 54 | if effect.resistanceID: |
| 55 | return effect.resistanceID |
| 56 | cacheKey = (modifyingItem.item.ID, effect.ID) |
| 57 | try: |
| 58 | return resistanceCache[cacheKey] |
| 59 | except KeyError: |
| 60 | attrPrefix = effect.getattr('prefix') |
| 61 | if attrPrefix: |
| 62 | resistanceID = int(modifyingItem.getModifiedItemAttr('{}ResistanceID'.format(attrPrefix))) or None |
| 63 | if not resistanceID: |
| 64 | resistanceID = int(modifyingItem.getModifiedItemAttr('{}RemoteResistanceID'.format(attrPrefix))) or None |
| 65 | else: |
| 66 | resistanceID = int(modifyingItem.getModifiedItemAttr("remoteResistanceID")) or None |
| 67 | resistanceCache[cacheKey] = resistanceID |
| 68 | return resistanceID |
| 69 | |
| 70 | |
| 71 | class ItemAttrShortcut: |
no test coverage detected