rem
stringlengths 0
322k
| add
stringlengths 0
2.05M
| context
stringlengths 8
228k
|
---|---|---|
MelString('NAM0','bloodSprayPath'), MelString('NAM1','bloodDecalPath'), | MelStruct('NAM4','I',('impactMaterialType',0L)), MelStruct('NAM5','I',('soundLevel',0L)), | def loadData(self,record,ins,type,size,readId): if size == 52: MelStruct.loadData(self,record,ins,type,size,readId) return #--Else 42 byte record (skips trainSkill, trainLevel,unused1... unpacked = ins.unpack('2iI7i2I',size,readId) unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked, record.flags.getTrueAttrs() |
potions[longid] = (eid,) + tuple(func(field) for func,field in | alch[longid] = (eid,) + tuple(func(field) for func,field in | def readFromText(self,textPath): """Reads stats from specified text file.""" alch, ammo, armor, books, ingredients, keys, lights, misc, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','ARMO','BOOK','INGR','KEYM','LIGH','MISC','WEAP')] aliases = self.aliases ins = bolt.CsvReader(textPath) pack,unpack = struct.pack,struct.unpack sfloat = lambda a: unpack('f',pack('f',float(a)))[0] #--Force standard precision for fields in ins: if len(fields) < 3 or fields[2][:2] != '0x': continue type,modName,objectStr,eid = fields[0:4] modName = GPath(modName) longid = (GPath(aliases.get(modName,modName)),int(objectStr[2:],16)) if type == 'ALCH': potions[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'AMMO': ammo[longid] = (eid,) + tuple(func(field) for func,field in #--(speed, value, clipRounds) zip((sfloat,int,int),fields[4:7])) elif type == 'ARMO': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, ar) zip((sfloat,int,int,int),fields[4:8])) elif type == 'BOOK': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'INGR': ingredients[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'KEYM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'LIGH': lights[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, duration) zip((sfloat,int,int),fields[4:7])) elif type == 'MISC': misc[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'WEAP': weapons[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, damage, clipsize, #-- reach, ammoUse, minSpread, spread, sightFov, baseVatsToHitChance, projectileCount, #-- minRange, maxRange, fireRate, overrideActionPoint, rumbleLeftMotorStrength, #-- rumbleRightMotorStrength, rumbleDuration, overrideDamageToWeaponMult, attackShotsPerSec, #-- reloadTime, jamTime, aimArc, rambleWavelangth, limbDmgMult, sightUsage, #-- semiAutomaticFireDelayMin, semiAutomaticFireDelayMax, criticalDamage, criticalMultiplier) zip((sfloat,int,int,int,int, sfloat,int,sfloat,sfloat,sfloat,int,int, sfloat,sfloat,sfloat,sfloat,sfloat, sfloat,sfloat,sfloat,sfloat, sfloat,sfloat,sfloat,sfloat,sfloat,sfloat, sfloat,sfloat,int,sfloat),fields[4:35])) ins.close() |
_("Removes unpleasant auto aim."), | _("Increase Auto Aim settings to a level at which Snipers can benefit from them."), | def buildPatch(self,patchFile,keep,log): """Build patch.""" eids = ((self.key,),self.key)[isinstance(self.key,tuple)] for eid,value in zip(eids,self.choiceValues[self.chosen]): gmst = MreGmst(('GMST',0,0,0,0,0)) gmst.eid,gmst.value,gmst.longFids = eid,value,True fid = gmst.fid = keep(gmst.getFallout3Fid()) patchFile.GMST.setRecord(gmst) if len(self.choiceLabels) > 1: if self.choiceLabels[self.chosen].startswith('Custom'): log('* %s: %s %4.2f' % (self.label,self.choiceLabels[self.chosen],self.choiceValues[self.chosen][0])) else: log('* %s: %s' % (self.label,self.choiceLabels[self.chosen])) else: log('* ' + self.label) |
if form1234[2] == 'I': | if len(form1234) > 2 and form1234[2] == 'I': | def mapFids(self,record,function,save=False): """Applies function to fids. If save is true, then fid is set to result of function.""" for target in record.conditions: form1234 = target.form1234 if form1234[0] == 'I': result = function(target.param1) if save: target.param1 = result if form1234[1] == 'I': result = function(target.param2) if save: target.param2 = result if form1234[2] == 'I': result = function(target.param3) if save: target.param3 = result if form1234[3] == 'I': result = function(target.param4) if save: target.param4 = result |
if form1234[3] == 'I': | if len(form1234) > 3 and form1234[3] == 'I': | def mapFids(self,record,function,save=False): """Applies function to fids. If save is true, then fid is set to result of function.""" for target in record.conditions: form1234 = target.form1234 if form1234[0] == 'I': result = function(target.param1) if save: target.param1 = result if form1234[1] == 'I': result = function(target.param2) if save: target.param2 = result if form1234[2] == 'I': result = function(target.param3) if save: target.param3 = result if form1234[3] == 'I': result = function(target.param4) if save: target.param4 = result |
defaultItemCheck = True | defaultItemCheck = inisettings['AutoItemCheck'] | def buildPatch(self,log,progress): """Edits patch file as desired. Should write to log.""" pass |
defaultItemCheck = True | defaultItemCheck = inisettings['AutoItemCheck'] | def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) if self.isEnabled: self.patchFile.aliases = self.aliases |
autoKey = ('C.Climate','C.Light','C.Water','C.Owner') defaultItemCheck = False | autoKey = ('C.Climate','C.Light','C.Water','C.Owner','C.Name','C.RecordFlags') defaultItemCheck = inisettings['AutoItemCheck'] | def saveConfig(self,configs): """Save config to configs dictionary.""" ListPatcher.saveConfig(self,configs) if self.isEnabled: importedMods = [item for item,value in self.configChecks.iteritems() if value and reModExt.search(item.s)] configs['ImportedMods'].update(importedMods) |
cellData[fid][attr] = cellBlock.cell.__getattribute__(attr) | if tempCellData[fid][attr] != cellBlock.cell.__getattribute__(attr): cellData[fid][attr] = tempCellData[fid][attr] | def importCellBlockData(cellBlock): if not cellBlock.cell.flags1.ignored: fid = cellBlock.cell.fid if fid not in cellData: cellData[fid] = {} cellData[fid+('flags',)] = {} for attr in attrs: cellData[fid][attr] = cellBlock.cell.__getattribute__(attr) for flag in flags: cellData[fid+('flags',)][flag] = cellBlock.cell.flags.__getattr__(flag) |
cellData[fid+('flags',)][flag] = cellBlock.cell.flags.__getattr__(flag) | if tempCellData[fid+('flags',)][flag] != cellBlock.cell.flags.__getattr__(flag): cellData[fid+('flags',)][flag] = tempCellData[fid+('flags',)][flag] | def importCellBlockData(cellBlock): if not cellBlock.cell.flags1.ignored: fid = cellBlock.cell.fid if fid not in cellData: cellData[fid] = {} cellData[fid+('flags',)] = {} for attr in attrs: cellData[fid][attr] = cellBlock.cell.__getattribute__(attr) for flag in flags: cellData[fid+('flags',)][flag] = cellBlock.cell.flags.__getattr__(flag) |
attrs = set(reduce(operator.add, (self.recAttrs[bashKey] for bashKey in srcInfo.getBashTags() if bashKey in self.recAttrs))) | masters = modInfos[srcMod].header.masters attrs = set(reduce(operator.add, (self.recAttrs[bashKey] for bashKey in srcInfo.getBashTags() if bashKey in self.recAttrs))) | def importCellBlockData(cellBlock): if not cellBlock.cell.flags1.ignored: fid = cellBlock.cell.fid if fid not in cellData: cellData[fid] = {} cellData[fid+('flags',)] = {} for attr in attrs: cellData[fid][attr] = cellBlock.cell.__getattribute__(attr) for flag in flags: cellData[fid+('flags',)][flag] = cellBlock.cell.flags.__getattr__(flag) |
defaultItemCheck = False | defaultItemCheck = inisettings['AutoItemCheck'] | def handleCellBlock(cellBlock): modified=False for attr,value in cellData[cellBlock.cell.fid].iteritems(): if cellBlock.cell.__getattribute__(attr) != value: cellBlock.cell.__setattr__(attr,value) modified=True for flag,value in cellData[cellBlock.cell.fid+('flags',)].iteritems(): if cellBlock.cell.flags.__getattr__(flag) != value: cellBlock.cell.flags.__setattr__(flag,value) modified=True if modified: cellBlock.cell.setChanged() keep(cellBlock.cell.fid) return modified |
defaultItemCheck = False | defaultItemCheck = inisettings['AutoItemCheck'] | def buildPatch(self,log,progress): """Merge last version of record with patched graphics data as needed.""" if not self.isActive: return modFile = self.patchFile keep = self.patchFile.getKeeper() id_data = self.id_data type_count = {} for recClass in self.srcClasses: type = recClass.classType if type not in modFile.tops: continue type_count[type] = 0 deprint(recClass,type,type_count[type]) for record in modFile.tops[type].records: fid = record.fid if fid not in id_data: continue for attr,value in id_data[fid].iteritems(): if record.__getattribute__(attr) != value: break else: continue for attr,value in id_data[fid].iteritems(): record.__setattr__(attr,value) keep(fid) type_count[type] += 1 log.setHeader('= '+self.__class__.name) log(_("=== Source Mods")) for mod in self.sourceMods: log("* " +mod.s) log(_("\n=== Modified Records")) for type,count in sorted(type_count.items()): if count: log("* %s: %d" % (type,count)) |
defaultItemCheck = False | defaultItemCheck = inisettings['AutoItemCheck'] | def buildPatch(self,log,progress): """Make changes to patchfile.""" if not self.isActive: return modFile = self.patchFile keep = self.patchFile.getKeeper() id_factions= self.id_factions type_count = {} for type in self.activeTypes: if type not in modFile.tops: continue type_count[type] = 0 for record in modFile.tops[type].records: fid = record.fid if fid in id_factions: newFactions = set(id_factions[fid]) curFactions = set((x.faction,x.rank) for x in record.factions) changed = newFactions - curFactions if not changed: continue doKeep = False for faction,rank in changed: for entry in record.factions: if entry.faction == faction: if entry.rank != rank: entry.rank = rank doKeep = True keep(fid) break else: entry = MelObject() entry.faction = faction entry.rank = rank entry.unused1 = 'ODB' record.factions.append(entry) doKeep = True if doKeep: record.factions = [x for x in record.factions if x.rank != -1] type_count[type] += 1 keep(fid) log.setHeader('= '+self.__class__.name) log(_("=== Source Mods/Files")) for file in self.srcFiles: log("* " +file.s) log(_("\n=== Refactioned Actors")) for type,count in sorted(type_count.items()): if count: log("* %s: %d" % (type,count)) |
for type,count in sorted(type_count.items()): if count: log("* %s: %d" % (type,count)) class ImportScriptContents(ImportPatcher): """Imports the contents of scripts -- currently only object/mgef scripts.""" name = _('Import Script Contents') text = _("Import the actual contents of scripts scripts.") tip = text autoRe = re.compile(r"^UNDEFINED$",re.I) autoKey = 'ScriptContents' def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} self.srcClasses = set() self.sourceMods = self.getConfigChecked() self.isActive = len(self.sourceMods) != 0 recAttrs_class = self.recAttrs_class = {} for recClass in (MreScpt,): recAttrs_class[recClass] = ('numRefs','lastIndex','compiledSize','scriptType','compiled_p','scriptText','vars','references',) for recClass in (MreQust,): recAttrs_class[recClass] = ('stages',) self.longTypes = set(('SCPT','QUST','DIAL','INFO')) def initData(self,progress): """Get graphics from source files.""" if not self.isActive: return id_data = self.id_data recAttrs_class = self.recAttrs_class loadFactory = LoadFactory(False,*recAttrs_class.keys()) longTypes = self.longTypes & set(x.classType for x in self.recAttrs_class) progress.setFull(len(self.sourceMods)) for index,srcMod in enumerate(self.sourceMods): if srcMod not in modInfos: continue srcInfo = modInfos[srcMod] srcFile = ModFile(srcInfo,loadFactory) srcFile.load(True) srcFile.convertToLongFids(longTypes) mapper = srcFile.getLongMapper() for recClass,recAttrs in recAttrs_class.iteritems(): if recClass.classType not in srcFile.tops: continue self.srcClasses.add(recClass) for record in srcFile.tops[recClass.classType].getActiveRecords(): fid = mapper(record.fid) id_data[fid] = dict((attr,record.__getattribute__(attr)) for attr in recAttrs) progress.plus() self.longTypes = self.longTypes & set(x.classType for x in self.srcClasses) self.isActive = bool(self.srcClasses) def getReadClasses(self): """Returns load factory classes needed for reading.""" if not self.isActive: return None return self.srcClasses def getWriteClasses(self): """Returns load factory classes needed for writing.""" if not self.isActive: return None return self.srcClasses def scanModFile(self, modFile, progress): """Scan mod file against source data.""" if not self.isActive: return id_data = self.id_data modName = modFile.fileInfo.name mapper = modFile.getLongMapper() if self.longTypes: modFile.convertToLongFids(self.longTypes) for recClass in self.srcClasses: type = recClass.classType if type not in modFile.tops: continue patchBlock = getattr(self.patchFile,type) for record in modFile.tops[type].getActiveRecords(): fid = record.fid if not record.longFids: fid = mapper(fid) if fid not in id_data: continue for attr,value in id_data[fid].iteritems(): if record.__getattribute__(attr) != value: patchBlock.setRecord(record.getTypeCopy(mapper)) break def buildPatch(self,log,progress): """Merge last version of record with patched graphics data as needed.""" if not self.isActive: return modFile = self.patchFile keep = self.patchFile.getKeeper() id_data = self.id_data type_count = {} for recClass in self.srcClasses: type = recClass.classType if type not in modFile.tops: continue type_count[type] = 0 for record in modFile.tops[type].records: fid = record.fid if fid not in id_data: continue for attr,value in id_data[fid].iteritems(): if record.__getattribute__(attr) != value: break else: continue for attr,value in id_data[fid].iteritems(): record.__setattr__(attr,value) keep(fid) type_count[type] += 1 log.setHeader('= '+self.__class__.name) log(_("=== Source Mods")) for mod in self.sourceMods: log("* " +mod.s) log(_("\n=== Modified Records")) for type,count in sorted(type_count.items()): | for type,count in sorted(type_count.iteritems()): | def buildPatch(self,log,progress): """Merge last version of record with patched graphics data as needed.""" if not self.isActive: return modFile = self.patchFile keep = self.patchFile.getKeeper() id_data = self.id_data type_count = {} for recClass in self.srcClasses: type = recClass.classType if type not in modFile.tops: continue type_count[type] = 0 #deprint(recClass,type,type_count[type]) for record in modFile.tops[type].records: fid = record.fid if fid not in id_data: continue for attr,value in id_data[fid].iteritems(): if record.__getattribute__(attr) != value: break else: continue for attr,value in id_data[fid].iteritems(): record.__setattr__(attr,value) keep(fid) type_count[type] += 1 log.setHeader('= '+self.__class__.name) log(_("=== Source Mods")) for mod in self.sourceMods: log("* " +mod.s) log(_("\n=== Modified Records")) for type,count in sorted(type_count.items()): if count: log("* %s: %d" % (type,count)) |
defaultItemCheck = False | defaultItemCheck = inisettings['AutoItemCheck'] | def buildPatch(self,log,progress): """Merge last version of record with patched graphics data as needed.""" if not self.isActive: return modFile = self.patchFile keep = self.patchFile.getKeeper() id_data = self.id_data type_count = {} for recClass in self.srcClasses: type = recClass.classType if type not in modFile.tops: continue type_count[type] = 0 #deprint(recClass,type,type_count[type]) for record in modFile.tops[type].records: fid = record.fid if fid not in id_data: continue for attr,value in id_data[fid].iteritems(): if record.__getattribute__(attr) != value: break else: continue for attr,value in id_data[fid].iteritems(): record.__setattr__(attr,value) keep(fid) type_count[type] += 1 log.setHeader('= '+self.__class__.name) log(_("=== Source Mods")) for mod in self.sourceMods: log("* " +mod.s) log(_("\n=== Modified Records")) for type,count in sorted(type_count.items()): if count: log("* %s: %d" % (type,count)) |
defaultItemCheck = False | defaultItemCheck = inisettings['AutoItemCheck'] | def buildPatch(self,log,progress): """Applies delta to patchfile.""" if not self.isActive: return keep = self.patchFile.getKeeper() id_deltas = self.id_deltas mod_count = {} for type in ('NPC_','CREA','CONT'): for record in getattr(self.patchFile,type).records: changed = False deltas = id_deltas.get(record.fid) if not deltas: continue removable = set(x.item for x in record.items) for removeItems,addEntries in reversed(deltas): if removeItems: #--Skip if some items to be removed have already been removed if not removeItems.issubset(removable): continue record.items = [x for x in record.items if x.item not in removeItems] removable -= removeItems changed = True if addEntries: current = set(x.item for x in record.items) for entry in addEntries: if entry.item not in current: record.items.append(entry) changed = True if changed: keep(record.fid) mod = record.fid[0] mod_count[mod] = mod_count.get(mod,0) + 1 #--Log log.setHeader('= '+self.__class__.name) log(_("=== Source Mods")) for mod in self.srcMods: log("* " +mod.s) log(_("\n=== Inventories Changed: %d") % (sum(mod_count.values()),)) for mod in modInfos.getOrdered(mod_count): log('* %s: %3d' % (mod.s,mod_count[mod])) |
defaultItemCheck = False | defaultItemCheck = inisettings['AutoItemCheck'] | def buildPatch(self,log,progress): """Edits patch file as desired. Will write to log.""" if not self.isActive: return count = {} keep = self.patchFile.getKeeper() for record in self.patchFile.NPC_.records: race = record.race model = record.model if (model.modPath != 'Characters\_male\SkeletonBeast.nif' and model.modPath != 'Characters\_male\SkeletonBeast.NIF' ): if (race == 0x3cdc or race == 0x5b54 ): model.modPath = 'Characters\_male\SkeletonBeast.nif' model.modb_p = None #?? model.modt_p = None #?? elif record.model.modPath == 'Characters\_male\SkeletonBeast.nif': if race in (0x224fc,0x191c1,0x19204,0x00907,0x224fd,0x00d43,0x00019,0x223c8): model.modPath = 'Characters\_male\Skeleton.nif' model.modb_p = None #?? model.modt_p = None #?? keep(record.fid) srcMod = record.fid[0] count[srcMod] = count.get(srcMod,0) + 1 #--Log log.setHeader('= '+self.__class__.name) log(_('* %d Skeletons Tweaked') % (sum(count.values()),)) for srcMod in sorted(count.keys()): log(' * %3d %s' % (count[srcMod],srcMod)) |
defaultItemCheck = False | defaultItemCheck = inisettings['AutoItemCheck'] | def buildPatch(self,log,progress): """Adds merged lists to patchfile.""" if not self.isActive: return keep = self.patchFile.getKeeper() worldsPatched = set() for worldBlock in self.patchFile.WRLD.worldBlocks: worldId = worldBlock.world.fid curRoad = worldBlock.road newRoad = self.world_road.get(worldId) if newRoad and (not curRoad or curRoad.points_p != newRoad.points_p or curRoad.connections_p != newRoad.connections_p ): worldBlock.road = newRoad keep(worldId) keep(newRoad.fid) worldsPatched.add((worldId[0].s,worldBlock.world.eid)) log.setHeader('= '+self.__class__.name) log(_("=== Source Mods")) for mod in self.sourceMods: log("* " +mod.s) log(_("\n=== Worlds Patched")) for modWorld in sorted(worldsPatched): log('* %s: %s' % modWorld) |
defaultItemCheck = False | defaultItemCheck = inisettings['AutoItemCheck'] | def buildPatch(self,log,progress): """Merge last version of record with patched sound data as needed.""" if not self.isActive: return modFile = self.patchFile keep = self.patchFile.getKeeper() id_data = self.id_data type_count = {} for recClass in self.srcClasses: type = recClass.classType if type not in modFile.tops: continue type_count[type] = 0 #deprint(recClass,type,type_count[type]) for record in modFile.tops[type].records: fid = record.fid if fid not in id_data: continue for attr,value in id_data[fid].items(): if record.__getattribute__(attr) != value: break else: continue for attr,value in id_data[fid].items(): record.__setattr__(attr,value) keep(fid) type_count[type] += 1 log.setHeader('= '+self.__class__.name) log(_("=== Source Mods")) for mod in self.sourceMods: log("* " +mod.s) log(_("\n=== Modified Records")) for type,count in sorted(type_count.items()): if count: log("* %s: %d" % (type,count)) |
defaultItemCheck = False | defaultItemCheck = inisettings['AutoItemCheck'] | def buildPatch(self,log,progress): """Adds merged lists to patchfile.""" if not self.isActive: return patchFile = self.patchFile keep = self.patchFile.getKeeper() id_stat = self.id_stat allCounts = [] for type in self.activeTypes: if type not in patchFile.tops: continue typeFields = self.typeFields[type] count,counts = 0,{} for record in patchFile.tops[type].records: fid = record.fid stats = id_stat.get(fid) if not stats: continue modStats = tuple(record.__getattribute__(attr) for attr in typeFields) if modStats == stats[1:]: continue for attr,value in zip(typeFields,stats[1:]): record.__setattr__(attr,value) keep(fid) count += 1 counts[fid[0]] = 1 + counts.get(fid[0],0) allCounts.append((type,count,counts)) log.setHeader('= '+self.__class__.name) log(_("=== Source Mods/Files")) for file in self.srcFiles: log("* " +file.s) log(_("\n=== Modified Stats")) for type,count,counts in allCounts: if not count: continue typeName = {'ALCH':_('alch'),'AMMO':_('Ammo'),'ARMO':_('Armor'),'INGR':_('Ingr'),'MISC':_('Misc'),'WEAP':_('Weapons'),'SLGM':_('Soulgem'),'SGST':_('Sigil Stone'),'LIGH':_('Lights'),'KEYM':_('Keys'),'CLOT':_('Clothes'),'BOOK':_('Books'),'APPA':_('Apparatus')}[type] log("* %s: %d" % (typeName,count)) for modName in sorted(counts): log(" * %s: %d" % (modName.s,counts[modName])) |
defaultItemCheck = False | defaultItemCheck = inisettings['AutoItemCheck'] | def getBook(objectId,eid,full,value,iconPath,modelPath,modb_p): book = MreBook(('BOOK',0,0,0,0)) book.longFids = True book.changed = True book.eid = eid book.full = full book.value = value book.weight = 0.2 book.fid = keep((GPath('Cobl Main.esm'),objectId)) book.text = '<div align="left"><font face=3 color=4444>' book.text += _("Salan's Catalog of %s\r\n\r\n") % full book.iconPath = iconPath book.model = book.getDefault('model') book.model.modPath = modelPath book.model.modb_p = modb_p book.modb = book self.patchFile.BOOK.setRecord(book) return book |
MelStruct('VNAM','I','soundlevel'), | MelStruct('VNAM','I','soundLevel'), | def loadData(self,record,ins,type,size,readId): if size == 48: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 40: unpacked = ins.unpack('10I',size,readId) elif size == 36: unpacked = ins.unpack('9I',size,readId) else: raise "Unexpected size encountered for IPDS:DATA subrecord: %s" % size unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked |
recAttrs_class[recClass] = ('sound',) | recAttrs_class[recClass] = ('soundLooping','soundActivation') | def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self.getConfigChecked() self.isActive = len(self.sourceMods) != 0 #--Type Fields recAttrs_class = self.recAttrs_class = {} for recClass in (MreMgef,): recAttrs_class[recClass] = ('castingSound','boltSound','hitSound','areaSound') for recClass in (MreActi,MreLigh): recAttrs_class[recClass] = ('sound',) for recClass in (MreWthr,): recAttrs_class[recClass] = ('sound','sounds') for recClass in (MreCont,): recAttrs_class[recClass] = ('soundOpen','soundClose') for recClass in (MreDoor,): recAttrs_class[recClass] = ('soundOpen','soundClose','soundLoop') #--Needs Longs self.longTypes = set(('MGEF','ACTI','LIGH','WTHR','CONT','DOOR')) |
self.longTypes = set(('MGEF','ACTI','LIGH','WTHR','CONT','DOOR')) | self.longTypes = set(('MGEF','ACTI','LIGH','WTHR','CONT','DOOR','EXPL','IPCT','PROJ')) | def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self.getConfigChecked() self.isActive = len(self.sourceMods) != 0 #--Type Fields recAttrs_class = self.recAttrs_class = {} for recClass in (MreMgef,): recAttrs_class[recClass] = ('castingSound','boltSound','hitSound','areaSound') for recClass in (MreActi,MreLigh): recAttrs_class[recClass] = ('sound',) for recClass in (MreWthr,): recAttrs_class[recClass] = ('sound','sounds') for recClass in (MreCont,): recAttrs_class[recClass] = ('soundOpen','soundClose') for recClass in (MreDoor,): recAttrs_class[recClass] = ('soundOpen','soundClose','soundLoop') #--Needs Longs self.longTypes = set(('MGEF','ACTI','LIGH','WTHR','CONT','DOOR')) |
MelStruct('EFID','4s',('name','REHE')), | MelFid('EFID','baseEffect'), | def __init__(self,attr='effects'): """Initialize elements.""" MelGroups.__init__(self,attr, MelStruct('EFID','4s',('name','REHE')), MelStruct('EFIT','5i','magnitude','area','duration','recipient','actorValue'), # MelGroup('scriptEffect', # MelEffects.MelEffectsScit(), # MelString('FULL','full'), # ), MelConditions(), ) |
MelString('ICON','maleIconPath'), MelString('MICO','maleIcon'), | MelString('ICON','maleLargeIconPath'), MelString('MICO','maleSmallIconPath'), | # def __init__(self,attr='model',index=0): |
MelString('ICO2','femaleIconPath'), MelString('MIC2','femaleIcon'), | MelString('ICO2','femaleLargeIconPath'), MelString('MIC2','femaleSmallIconPath'), | # def __init__(self,attr='model',index=0): |
zip((sfloat,int,int,),fields[4:7])) | zip((sfloat,int,int),fields[4:7])) | def readFromText(self,textPath): """Reads stats from specified text file.""" alch, ammo, armor, books, ingredients, keys, lights, misc, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','ARMO','BOOK','INGR','KEYM','LIGH','MISC','WEAP')] aliases = self.aliases ins = bolt.CsvReader(textPath) pack,unpack = struct.pack,struct.unpack sfloat = lambda a: unpack('f',pack('f',float(a)))[0] #--Force standard precision for fields in ins: if len(fields) < 3 or fields[2][:2] != '0x': continue type,modName,objectStr,eid = fields[0:4] modName = GPath(modName) longid = (GPath(aliases.get(modName,modName)),int(objectStr[2:],16)) if type == 'ALCH': alch[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'AMMO': ammo[longid] = (eid,) + tuple(func(field) for func,field in #--(speed, value, clipRounds) zip((sfloat,int,int),fields[4:7])) elif type == 'ARMO': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, ar) zip((sfloat,int,int,int),fields[4:8])) elif type == 'BOOK': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'INGR': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'KEYM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'LIGH': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, duration) zip((sfloat,int,int,),fields[4:7])) elif type == 'MISC': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'WEAP': weapons[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, damage, clipsize, #-- reach, ammoUse, minSpread, spread, sightFov, baseVatsToHitChance, projectileCount, #-- minRange, maxRange, fireRate, overrideActionPoint, rumbleLeftMotorStrength, #-- rumbleRightMotorStrength, rumbleDuration, overrideDamageToWeaponMult, attackShotsPerSec, #-- reloadTime, jamTime, aimArc, rambleWavelangth, limbDmgMult, sightUsage, #-- semiAutomaticFireDelayMin, semiAutomaticFireDelayMax, criticalDamage, criticalMultiplier) zip((sfloat,int,int,int,int, sfloat,int,sfloat,sfloat,sfloat,int,int, sfloat,sfloat,sfloat,sfloat,sfloat, sfloat,sfloat,sfloat,sfloat, sfloat,sfloat,sfloat,sfloat,sfloat,sfloat, sfloat,sfloat,int,sfloat),fields[4:35])) ins.close() |
self.type_stats = {'ALCH':{},'AMMO':{},'APPA':{},'ARMO':{},'BOOK':{},'CLOT':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'SGST':{},'SLGM':{},'WEAP':{}} | self.type_stats = {'ALCH':{},'AMMO':{},'ARMO':{},'BOOK':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'WEAP':{}} | def __init__(self,types=None,aliases=None): """Initialize.""" #--type_stats[type] = ... #--AMMO: (eid, weight, value, damage, speed, epoints) #--ARMO: (eid, weight, value, health, strength) #--WEAP: (eid, weight, value, health, damage, speed, reach, epoints) self.type_stats = {'ALCH':{},'AMMO':{},'APPA':{},'ARMO':{},'BOOK':{},'CLOT':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'SGST':{},'SLGM':{},'WEAP':{}} self.type_attrs = { 'ALCH':('value', 'eid', 'full'), 'AMMO':('value', 'eid', 'full'), 'APPA':('value', 'eid', 'full'), 'ARMO':('value', 'eid', 'full'), 'BOOK':('value', 'eid', 'full'), 'CLOT':('value', 'eid', 'full'), 'INGR':('value', 'eid', 'full'), 'KEYM':('value', 'eid', 'full'), 'LIGH':('value', 'eid', 'full'), 'MISC':('value', 'eid', 'full'), 'SGST':('value', 'eid', 'full'), 'SLGM':('value', 'eid', 'full'), 'WEAP':('value', 'eid', 'full'), } self.aliases = aliases or {} #--For aliasing mod names |
'APPA':('value', 'eid', 'full'), | def __init__(self,types=None,aliases=None): """Initialize.""" #--type_stats[type] = ... #--AMMO: (eid, weight, value, damage, speed, epoints) #--ARMO: (eid, weight, value, health, strength) #--WEAP: (eid, weight, value, health, damage, speed, reach, epoints) self.type_stats = {'ALCH':{},'AMMO':{},'APPA':{},'ARMO':{},'BOOK':{},'CLOT':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'SGST':{},'SLGM':{},'WEAP':{}} self.type_attrs = { 'ALCH':('value', 'eid', 'full'), 'AMMO':('value', 'eid', 'full'), 'APPA':('value', 'eid', 'full'), 'ARMO':('value', 'eid', 'full'), 'BOOK':('value', 'eid', 'full'), 'CLOT':('value', 'eid', 'full'), 'INGR':('value', 'eid', 'full'), 'KEYM':('value', 'eid', 'full'), 'LIGH':('value', 'eid', 'full'), 'MISC':('value', 'eid', 'full'), 'SGST':('value', 'eid', 'full'), 'SLGM':('value', 'eid', 'full'), 'WEAP':('value', 'eid', 'full'), } self.aliases = aliases or {} #--For aliasing mod names |
|
'CLOT':('value', 'eid', 'full'), | def __init__(self,types=None,aliases=None): """Initialize.""" #--type_stats[type] = ... #--AMMO: (eid, weight, value, damage, speed, epoints) #--ARMO: (eid, weight, value, health, strength) #--WEAP: (eid, weight, value, health, damage, speed, reach, epoints) self.type_stats = {'ALCH':{},'AMMO':{},'APPA':{},'ARMO':{},'BOOK':{},'CLOT':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'SGST':{},'SLGM':{},'WEAP':{}} self.type_attrs = { 'ALCH':('value', 'eid', 'full'), 'AMMO':('value', 'eid', 'full'), 'APPA':('value', 'eid', 'full'), 'ARMO':('value', 'eid', 'full'), 'BOOK':('value', 'eid', 'full'), 'CLOT':('value', 'eid', 'full'), 'INGR':('value', 'eid', 'full'), 'KEYM':('value', 'eid', 'full'), 'LIGH':('value', 'eid', 'full'), 'MISC':('value', 'eid', 'full'), 'SGST':('value', 'eid', 'full'), 'SLGM':('value', 'eid', 'full'), 'WEAP':('value', 'eid', 'full'), } self.aliases = aliases or {} #--For aliasing mod names |
|
'SGST':('value', 'eid', 'full'), 'SLGM':('value', 'eid', 'full'), | def __init__(self,types=None,aliases=None): """Initialize.""" #--type_stats[type] = ... #--AMMO: (eid, weight, value, damage, speed, epoints) #--ARMO: (eid, weight, value, health, strength) #--WEAP: (eid, weight, value, health, damage, speed, reach, epoints) self.type_stats = {'ALCH':{},'AMMO':{},'APPA':{},'ARMO':{},'BOOK':{},'CLOT':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'SGST':{},'SLGM':{},'WEAP':{}} self.type_attrs = { 'ALCH':('value', 'eid', 'full'), 'AMMO':('value', 'eid', 'full'), 'APPA':('value', 'eid', 'full'), 'ARMO':('value', 'eid', 'full'), 'BOOK':('value', 'eid', 'full'), 'CLOT':('value', 'eid', 'full'), 'INGR':('value', 'eid', 'full'), 'KEYM':('value', 'eid', 'full'), 'LIGH':('value', 'eid', 'full'), 'MISC':('value', 'eid', 'full'), 'SGST':('value', 'eid', 'full'), 'SLGM':('value', 'eid', 'full'), 'WEAP':('value', 'eid', 'full'), } self.aliases = aliases or {} #--For aliasing mod names |
|
loadFactory= LoadFactory(False,MreAlch,MreAmmo,MreAppa,MreArmo,MreBook,MreClot,MreIngr,MreKeym,MreLigh,MreMisc,MreSgst,MreSlgm,MreWeap) | loadFactory= LoadFactory(False,MreAlch,MreAmmo,MreArmo,MreBook,MreIngr,MreKeym,MreLigh,MreMisc,MreWeap) | def readFromMod(self,modInfo): """Reads stats from specified mod.""" loadFactory= LoadFactory(False,MreAlch,MreAmmo,MreAppa,MreArmo,MreBook,MreClot,MreIngr,MreKeym,MreLigh,MreMisc,MreSgst,MreSlgm,MreWeap) modFile = ModFile(modInfo,loadFactory) modFile.load(True) mapper = modFile.getLongMapper() for type in self.type_stats: stats, attrs = self.type_stats[type], self.type_attrs[type] for record in getattr(modFile,type).getActiveRecords(): longid = mapper(record.fid) recordGetAttr = record.__getattribute__ stats[longid] = tuple(recordGetAttr(attr) for attr in attrs) |
loadFactory= LoadFactory(True,MreAlch,MreAmmo,MreAppa,MreArmo,MreBook,MreClot,MreIngr,MreKeym,MreLigh,MreMisc,MreSgst,MreSlgm,MreWeap) | loadFactory= LoadFactory(True,MreAlch,MreAmmo,MreArmo,MreBook,MreIngr,MreKeym,MreLigh,MreMisc,MreWeap) | def writeToMod(self,modInfo): """Writes stats to specified mod.""" loadFactory= LoadFactory(True,MreAlch,MreAmmo,MreAppa,MreArmo,MreBook,MreClot,MreIngr,MreKeym,MreLigh,MreMisc,MreSgst,MreSlgm,MreWeap) modFile = ModFile(modInfo,loadFactory) modFile.load(True) mapper = modFile.getLongMapper() changed = {} #--changed[modName] = numChanged for type in self.type_stats: stats, attrs = self.type_stats[type], self.type_attrs[type] for record in getattr(modFile,type).getActiveRecords(): longid = mapper(record.fid) itemStats = stats.get(longid,None) if not itemStats: continue map(record.__setattr__,attrs,itemStats) record.setChanged() changed[longid[0]] = 1 + changed.get(longid[0],0) if changed: modFile.safeSave() return changed |
('APPA', bolt.csvFormat('iss')+'\n', ('"' + '","'.join((_('Mod Name'),_('ObjectIndex'), _('Value'),_('Editor Id'),_('Name'))) + '"\n')), | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
|
('"' + '","'.join((_('Mod Name'),_('ObjectIndex'), _('Value'),_('Editor Id'),_('Name'))) + '"\n')), ('CLOT', bolt.csvFormat('iss')+'\n', | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
|
('SGST', bolt.csvFormat('iss')+'\n', ('"' + '","'.join((_('Mod Name'),_('ObjectIndex'), _('Value'),_('Editor Id'),_('Name'))) + '"\n')), ('SLGM', bolt.csvFormat('iss')+'\n', ('"' + '","'.join((_('Mod Name'),_('ObjectIndex'), _('Value'),_('Editor Id'),_('Name'))) + '"\n')), | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
|
self.type_stats = {'ALCH':{},'AMMO':{},'APPA':{},'ARMO':{},'BOOK':{},'CLOT':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'SGST':{},'SLGM':{},'WEAP':{}} | self.type_stats = {'ALCH':{},'AMMO':{},'ARMO':{},'BOOK':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'WEAP':{}} | def __init__(self,types=None,aliases=None): """Initialize.""" self.type_stats = {'ALCH':{},'AMMO':{},'APPA':{},'ARMO':{},'BOOK':{},'CLOT':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'SGST':{},'SLGM':{},'WEAP':{}} self.type_attrs = { 'ALCH':('eid', 'full', 'weight', 'value', 'iconPath'), 'AMMO':('eid', 'full', 'weight', 'value', 'damage', 'speed', 'enchantPoints', 'iconPath'), 'APPA':('eid', 'full', 'weight', 'value', 'quality', 'iconPath'), 'ARMO':('eid', 'full', 'weight', 'value', 'health', 'strength', 'maleIconPath', 'femaleIconPath'), 'BOOK':('eid', 'full', 'weight', 'value', 'enchantPoints', 'iconPath'), 'CLOT':('eid', 'full', 'weight', 'value', 'enchantPoints', 'maleIconPath', 'femaleIconPath'), 'INGR':('eid', 'full', 'weight', 'value', 'iconPath'), 'KEYM':('eid', 'full', 'weight', 'value', 'iconPath'), 'LIGH':('eid', 'full', 'weight', 'value', 'duration', 'iconPath'), 'MISC':('eid', 'full', 'weight', 'value', 'iconPath'), 'SGST':('eid', 'full', 'weight', 'value', 'uses', 'iconPath'), 'SLGM':('eid', 'full', 'weight', 'value', 'iconPath'), 'WEAP':('eid', 'full', 'weight', 'value', 'health', 'damage', 'speed', 'reach', 'enchantPoints', 'iconPath'), } self.aliases = aliases or {} #--For aliasing mod fulls self.model = {} self.Mmodel = {} self.Fmodel = {} self.MGndmodel = {} self.FGndmodel = {} |
'ALCH':('eid', 'full', 'weight', 'value', 'iconPath'), 'AMMO':('eid', 'full', 'weight', 'value', 'damage', 'speed', 'enchantPoints', 'iconPath'), 'APPA':('eid', 'full', 'weight', 'value', 'quality', 'iconPath'), 'ARMO':('eid', 'full', 'weight', 'value', 'health', 'strength', 'maleIconPath', 'femaleIconPath'), 'BOOK':('eid', 'full', 'weight', 'value', 'enchantPoints', 'iconPath'), 'CLOT':('eid', 'full', 'weight', 'value', 'enchantPoints', 'maleIconPath', 'femaleIconPath'), | 'ALCH':('eid', 'full', 'weight', 'value', 'largeIconPath', 'smallIconPath'), 'AMMO':('eid', 'full', 'speed', 'value', 'clipRounds', 'largeIconPath', 'smallIconPath'), 'ARMO':('eid', 'full', 'weight', 'value', 'health', 'ar', 'maleLargeIconPath', 'maleSmallIconPath', 'femaleLargeIconPath', 'femaleSmallIconPath'), 'BOOK':('eid', 'full', 'weight', 'value', 'largeIconPath', 'smallIconPath'), | def __init__(self,types=None,aliases=None): """Initialize.""" self.type_stats = {'ALCH':{},'AMMO':{},'APPA':{},'ARMO':{},'BOOK':{},'CLOT':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'SGST':{},'SLGM':{},'WEAP':{}} self.type_attrs = { 'ALCH':('eid', 'full', 'weight', 'value', 'iconPath'), 'AMMO':('eid', 'full', 'weight', 'value', 'damage', 'speed', 'enchantPoints', 'iconPath'), 'APPA':('eid', 'full', 'weight', 'value', 'quality', 'iconPath'), 'ARMO':('eid', 'full', 'weight', 'value', 'health', 'strength', 'maleIconPath', 'femaleIconPath'), 'BOOK':('eid', 'full', 'weight', 'value', 'enchantPoints', 'iconPath'), 'CLOT':('eid', 'full', 'weight', 'value', 'enchantPoints', 'maleIconPath', 'femaleIconPath'), 'INGR':('eid', 'full', 'weight', 'value', 'iconPath'), 'KEYM':('eid', 'full', 'weight', 'value', 'iconPath'), 'LIGH':('eid', 'full', 'weight', 'value', 'duration', 'iconPath'), 'MISC':('eid', 'full', 'weight', 'value', 'iconPath'), 'SGST':('eid', 'full', 'weight', 'value', 'uses', 'iconPath'), 'SLGM':('eid', 'full', 'weight', 'value', 'iconPath'), 'WEAP':('eid', 'full', 'weight', 'value', 'health', 'damage', 'speed', 'reach', 'enchantPoints', 'iconPath'), } self.aliases = aliases or {} #--For aliasing mod fulls self.model = {} self.Mmodel = {} self.Fmodel = {} self.MGndmodel = {} self.FGndmodel = {} |
'KEYM':('eid', 'full', 'weight', 'value', 'iconPath'), 'LIGH':('eid', 'full', 'weight', 'value', 'duration', 'iconPath'), 'MISC':('eid', 'full', 'weight', 'value', 'iconPath'), 'SGST':('eid', 'full', 'weight', 'value', 'uses', 'iconPath'), 'SLGM':('eid', 'full', 'weight', 'value', 'iconPath'), 'WEAP':('eid', 'full', 'weight', 'value', 'health', 'damage', 'speed', 'reach', 'enchantPoints', 'iconPath'), | 'KEYM':('eid', 'full', 'weight', 'value', 'largeIconPath', 'smallIconPath'), 'LIGH':('eid', 'full', 'weight', 'value', 'duration','iconPath'), 'MISC':('eid', 'full', 'weight', 'value', 'largeIconPath', 'smallIconPath'), 'WEAP':('eid', 'full', 'weight', 'value', 'health', 'damage','clipsize', 'reach','ammoUse','minSpread','spread','sightFov','baseVatsToHitChance','projectileCount', 'minRange','maxRange','fireRate','overrideActionPoint','rumbleLeftMotorStrength', 'rumbleRightMotorStrength','rumbleDuration','overrideDamageToWeaponMult','attackShotsPerSec', 'reloadTime','jamTime','aimArc','rambleWavelangth','limbDmgMult','sightUsage', 'semiAutomaticFireDelayMin','semiAutomaticFireDelayMax','criticalDamage','criticalMultiplier', 'largeIconPath', 'smallIconPath'), | def __init__(self,types=None,aliases=None): """Initialize.""" self.type_stats = {'ALCH':{},'AMMO':{},'APPA':{},'ARMO':{},'BOOK':{},'CLOT':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'SGST':{},'SLGM':{},'WEAP':{}} self.type_attrs = { 'ALCH':('eid', 'full', 'weight', 'value', 'iconPath'), 'AMMO':('eid', 'full', 'weight', 'value', 'damage', 'speed', 'enchantPoints', 'iconPath'), 'APPA':('eid', 'full', 'weight', 'value', 'quality', 'iconPath'), 'ARMO':('eid', 'full', 'weight', 'value', 'health', 'strength', 'maleIconPath', 'femaleIconPath'), 'BOOK':('eid', 'full', 'weight', 'value', 'enchantPoints', 'iconPath'), 'CLOT':('eid', 'full', 'weight', 'value', 'enchantPoints', 'maleIconPath', 'femaleIconPath'), 'INGR':('eid', 'full', 'weight', 'value', 'iconPath'), 'KEYM':('eid', 'full', 'weight', 'value', 'iconPath'), 'LIGH':('eid', 'full', 'weight', 'value', 'duration', 'iconPath'), 'MISC':('eid', 'full', 'weight', 'value', 'iconPath'), 'SGST':('eid', 'full', 'weight', 'value', 'uses', 'iconPath'), 'SLGM':('eid', 'full', 'weight', 'value', 'iconPath'), 'WEAP':('eid', 'full', 'weight', 'value', 'health', 'damage', 'speed', 'reach', 'enchantPoints', 'iconPath'), } self.aliases = aliases or {} #--For aliasing mod fulls self.model = {} self.Mmodel = {} self.Fmodel = {} self.MGndmodel = {} self.FGndmodel = {} |
loadFactory= LoadFactory(False,MreAlch,MreAmmo,MreAppa,MreArmo,MreBook,MreClot,MreIngr,MreKeym,MreLigh,MreMisc,MreSgst,MreSlgm,MreWeap) | loadFactory= LoadFactory(False,MreAlch,MreAmmo,MreArmo,MreBook,MreIngr,MreKeym,MreLigh,MreMisc,MreWeap) | def readFromMod(self,modInfo): """Reads stats from specified mod.""" loadFactory= LoadFactory(False,MreAlch,MreAmmo,MreAppa,MreArmo,MreBook,MreClot,MreIngr,MreKeym,MreLigh,MreMisc,MreSgst,MreSlgm,MreWeap) modFile = ModFile(modInfo,loadFactory) modFile.load(True) mapper = modFile.getLongMapper() for type in self.type_stats: stats, attrs = self.type_stats[type], self.type_attrs[type] for record in getattr(modFile,type).getActiveRecords(): longid = mapper(record.fid) recordGetAttr = record.__getattribute__ stats[longid] = tuple(recordGetAttr(attr) for attr in attrs) if type in ['ALCH','AMMO','APPA','BOOK','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP']: if record.model: self.model[longid] = record.model.modPath elif type in ['CLOT','ARMO']: if record.maleBody: self.Mmodel[longid] = record.maleBody.modPath if record.maleWorld: self.MGndmodel[longid] = record.maleWorld.modPath if record.femaleBody: self.Fmodel[longid] = record.femaleBody.modPath if record.femaleWorld: self.FGndmodel[longid] = record.femaleWorld.modPath |
if type in ['ALCH','AMMO','APPA','BOOK','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP']: | if type in ['ALCH','AMMO','BOOK','INGR','KEYM','LIGH','MISC']: | def readFromMod(self,modInfo): """Reads stats from specified mod.""" loadFactory= LoadFactory(False,MreAlch,MreAmmo,MreAppa,MreArmo,MreBook,MreClot,MreIngr,MreKeym,MreLigh,MreMisc,MreSgst,MreSlgm,MreWeap) modFile = ModFile(modInfo,loadFactory) modFile.load(True) mapper = modFile.getLongMapper() for type in self.type_stats: stats, attrs = self.type_stats[type], self.type_attrs[type] for record in getattr(modFile,type).getActiveRecords(): longid = mapper(record.fid) recordGetAttr = record.__getattribute__ stats[longid] = tuple(recordGetAttr(attr) for attr in attrs) if type in ['ALCH','AMMO','APPA','BOOK','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP']: if record.model: self.model[longid] = record.model.modPath elif type in ['CLOT','ARMO']: if record.maleBody: self.Mmodel[longid] = record.maleBody.modPath if record.maleWorld: self.MGndmodel[longid] = record.maleWorld.modPath if record.femaleBody: self.Fmodel[longid] = record.femaleBody.modPath if record.femaleWorld: self.FGndmodel[longid] = record.femaleWorld.modPath |
elif type in ['CLOT','ARMO']: | elif type in ['WEAP',]: if record.model: self.model[longid] = record.model.modPath if record.shellCasingModel: self.ShellCasingmodel[longid] = record.shellCasingModel.modPath if record.scopeModel: self.Scopemodel[longid] = record.scopeModel.modPath if record.worldModel: self.Gndmodel[longid] = record.worldModel.modPath elif type in ['ARMO',]: | def readFromMod(self,modInfo): """Reads stats from specified mod.""" loadFactory= LoadFactory(False,MreAlch,MreAmmo,MreAppa,MreArmo,MreBook,MreClot,MreIngr,MreKeym,MreLigh,MreMisc,MreSgst,MreSlgm,MreWeap) modFile = ModFile(modInfo,loadFactory) modFile.load(True) mapper = modFile.getLongMapper() for type in self.type_stats: stats, attrs = self.type_stats[type], self.type_attrs[type] for record in getattr(modFile,type).getActiveRecords(): longid = mapper(record.fid) recordGetAttr = record.__getattribute__ stats[longid] = tuple(recordGetAttr(attr) for attr in attrs) if type in ['ALCH','AMMO','APPA','BOOK','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP']: if record.model: self.model[longid] = record.model.modPath elif type in ['CLOT','ARMO']: if record.maleBody: self.Mmodel[longid] = record.maleBody.modPath if record.maleWorld: self.MGndmodel[longid] = record.maleWorld.modPath if record.femaleBody: self.Fmodel[longid] = record.femaleBody.modPath if record.femaleWorld: self.FGndmodel[longid] = record.femaleWorld.modPath |
alch, ammo, appa, armor, books, clothing, ingredients, keys, lights, misc, sigilstones, soulgems, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','APPA','ARMO','BOOK','CLOT','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP')] | alch, ammo, armor, books, ingredients, keys, lights, misc, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','ARMO','BOOK','INGR','KEYM','LIGH','MISC','WEAP')] | def readFromText(self,textPath): """Reads stats from specified text file.""" alch, ammo, appa, armor, books, clothing, ingredients, keys, lights, misc, sigilstones, soulgems, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','APPA','ARMO','BOOK','CLOT','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP')] aliases = self.aliases ins = bolt.CsvReader(textPath) pack,unpack = struct.pack,struct.unpack sfloat = lambda a: unpack('f',pack('f',float(a)))[0] #--Force standard precision for fields in ins: if len(fields) < 3 or fields[2][:2] != '0x': continue type,modName,objectStr,eid = fields[0:4] modName = GPath(modName) longid = (GPath(aliases.get(modName,modName)),int(objectStr[2:],16)) if type == 'ALCH': alch[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'AMMO': ammo[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, damage, speed, enchantPoints) zip((str,sfloat,int,int,sfloat,int,str),fields[4:11])) elif type == 'ARMO': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, strength) zip((str,sfloat,int,int,int,str,str),fields[4:10])) elif type == 'BOOK': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'CLOT': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((str,sfloat,int,int,str,str),fields[4:10])) elif type == 'INGR': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'KEYM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'LIGH': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, duration) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'MISC': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'SGST': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, uses) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'SLGM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int),fields[4:8])) elif type == 'WEAP': weapons[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, damage, speed, reach, epoints) zip((str,sfloat,int,int,int,sfloat,sfloat,int,str),fields[4:13])) ins.close() |
zip((str,sfloat,int,str),fields[4:8])) | zip((str,sfloat,int,str,str),fields[4:9])) | def readFromText(self,textPath): """Reads stats from specified text file.""" alch, ammo, appa, armor, books, clothing, ingredients, keys, lights, misc, sigilstones, soulgems, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','APPA','ARMO','BOOK','CLOT','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP')] aliases = self.aliases ins = bolt.CsvReader(textPath) pack,unpack = struct.pack,struct.unpack sfloat = lambda a: unpack('f',pack('f',float(a)))[0] #--Force standard precision for fields in ins: if len(fields) < 3 or fields[2][:2] != '0x': continue type,modName,objectStr,eid = fields[0:4] modName = GPath(modName) longid = (GPath(aliases.get(modName,modName)),int(objectStr[2:],16)) if type == 'ALCH': alch[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'AMMO': ammo[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, damage, speed, enchantPoints) zip((str,sfloat,int,int,sfloat,int,str),fields[4:11])) elif type == 'ARMO': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, strength) zip((str,sfloat,int,int,int,str,str),fields[4:10])) elif type == 'BOOK': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'CLOT': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((str,sfloat,int,int,str,str),fields[4:10])) elif type == 'INGR': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'KEYM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'LIGH': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, duration) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'MISC': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'SGST': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, uses) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'SLGM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int),fields[4:8])) elif type == 'WEAP': weapons[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, damage, speed, reach, epoints) zip((str,sfloat,int,int,int,sfloat,sfloat,int,str),fields[4:13])) ins.close() |
zip((str,sfloat,int,int,sfloat,int,str),fields[4:11])) | zip((str,sfloat,int,int,str,str),fields[4:10])) | def readFromText(self,textPath): """Reads stats from specified text file.""" alch, ammo, appa, armor, books, clothing, ingredients, keys, lights, misc, sigilstones, soulgems, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','APPA','ARMO','BOOK','CLOT','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP')] aliases = self.aliases ins = bolt.CsvReader(textPath) pack,unpack = struct.pack,struct.unpack sfloat = lambda a: unpack('f',pack('f',float(a)))[0] #--Force standard precision for fields in ins: if len(fields) < 3 or fields[2][:2] != '0x': continue type,modName,objectStr,eid = fields[0:4] modName = GPath(modName) longid = (GPath(aliases.get(modName,modName)),int(objectStr[2:],16)) if type == 'ALCH': alch[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'AMMO': ammo[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, damage, speed, enchantPoints) zip((str,sfloat,int,int,sfloat,int,str),fields[4:11])) elif type == 'ARMO': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, strength) zip((str,sfloat,int,int,int,str,str),fields[4:10])) elif type == 'BOOK': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'CLOT': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((str,sfloat,int,int,str,str),fields[4:10])) elif type == 'INGR': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'KEYM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'LIGH': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, duration) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'MISC': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'SGST': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, uses) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'SLGM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int),fields[4:8])) elif type == 'WEAP': weapons[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, damage, speed, reach, epoints) zip((str,sfloat,int,int,int,sfloat,sfloat,int,str),fields[4:13])) ins.close() |
zip((str,sfloat,int,int,int,str,str),fields[4:10])) | zip((str,sfloat,int,int,int,str,str,str,str),fields[4:13])) | def readFromText(self,textPath): """Reads stats from specified text file.""" alch, ammo, appa, armor, books, clothing, ingredients, keys, lights, misc, sigilstones, soulgems, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','APPA','ARMO','BOOK','CLOT','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP')] aliases = self.aliases ins = bolt.CsvReader(textPath) pack,unpack = struct.pack,struct.unpack sfloat = lambda a: unpack('f',pack('f',float(a)))[0] #--Force standard precision for fields in ins: if len(fields) < 3 or fields[2][:2] != '0x': continue type,modName,objectStr,eid = fields[0:4] modName = GPath(modName) longid = (GPath(aliases.get(modName,modName)),int(objectStr[2:],16)) if type == 'ALCH': alch[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'AMMO': ammo[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, damage, speed, enchantPoints) zip((str,sfloat,int,int,sfloat,int,str),fields[4:11])) elif type == 'ARMO': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, strength) zip((str,sfloat,int,int,int,str,str),fields[4:10])) elif type == 'BOOK': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'CLOT': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((str,sfloat,int,int,str,str),fields[4:10])) elif type == 'INGR': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'KEYM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'LIGH': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, duration) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'MISC': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'SGST': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, uses) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'SLGM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int),fields[4:8])) elif type == 'WEAP': weapons[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, damage, speed, reach, epoints) zip((str,sfloat,int,int,int,sfloat,sfloat,int,str),fields[4:13])) ins.close() |
zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'CLOT': armor[longid] = (eid,) + tuple(func(field) for func,field in zip((str,sfloat,int,int,str,str),fields[4:10])) | zip((str,sfloat,int,str,str),fields[4:9])) | def readFromText(self,textPath): """Reads stats from specified text file.""" alch, ammo, appa, armor, books, clothing, ingredients, keys, lights, misc, sigilstones, soulgems, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','APPA','ARMO','BOOK','CLOT','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP')] aliases = self.aliases ins = bolt.CsvReader(textPath) pack,unpack = struct.pack,struct.unpack sfloat = lambda a: unpack('f',pack('f',float(a)))[0] #--Force standard precision for fields in ins: if len(fields) < 3 or fields[2][:2] != '0x': continue type,modName,objectStr,eid = fields[0:4] modName = GPath(modName) longid = (GPath(aliases.get(modName,modName)),int(objectStr[2:],16)) if type == 'ALCH': alch[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'AMMO': ammo[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, damage, speed, enchantPoints) zip((str,sfloat,int,int,sfloat,int,str),fields[4:11])) elif type == 'ARMO': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, strength) zip((str,sfloat,int,int,int,str,str),fields[4:10])) elif type == 'BOOK': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'CLOT': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((str,sfloat,int,int,str,str),fields[4:10])) elif type == 'INGR': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'KEYM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'LIGH': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, duration) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'MISC': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'SGST': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, uses) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'SLGM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int),fields[4:8])) elif type == 'WEAP': weapons[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, damage, speed, reach, epoints) zip((str,sfloat,int,int,int,sfloat,sfloat,int,str),fields[4:13])) ins.close() |
zip((str,sfloat,int,str),fields[4:8])) elif type == 'SGST': books[longid] = (eid,) + tuple(func(field) for func,field in zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'SLGM': keys[longid] = (eid,) + tuple(func(field) for func,field in zip((str,sfloat,int),fields[4:8])) | zip((str,sfloat,int,str,str),fields[4:9])) | def readFromText(self,textPath): """Reads stats from specified text file.""" alch, ammo, appa, armor, books, clothing, ingredients, keys, lights, misc, sigilstones, soulgems, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','APPA','ARMO','BOOK','CLOT','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP')] aliases = self.aliases ins = bolt.CsvReader(textPath) pack,unpack = struct.pack,struct.unpack sfloat = lambda a: unpack('f',pack('f',float(a)))[0] #--Force standard precision for fields in ins: if len(fields) < 3 or fields[2][:2] != '0x': continue type,modName,objectStr,eid = fields[0:4] modName = GPath(modName) longid = (GPath(aliases.get(modName,modName)),int(objectStr[2:],16)) if type == 'ALCH': alch[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'AMMO': ammo[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, damage, speed, enchantPoints) zip((str,sfloat,int,int,sfloat,int,str),fields[4:11])) elif type == 'ARMO': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, strength) zip((str,sfloat,int,int,int,str,str),fields[4:10])) elif type == 'BOOK': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'CLOT': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((str,sfloat,int,int,str,str),fields[4:10])) elif type == 'INGR': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'KEYM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'LIGH': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, duration) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'MISC': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'SGST': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, uses) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'SLGM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int),fields[4:8])) elif type == 'WEAP': weapons[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, damage, speed, reach, epoints) zip((str,sfloat,int,int,int,sfloat,sfloat,int,str),fields[4:13])) ins.close() |
zip((str,sfloat,int,int,int,sfloat,sfloat,int,str),fields[4:13])) | zip((str,sfloat,int,int,int,int, sfloat,int,sfloat,sfloat,sfloat,int,int, sfloat,sfloat,sfloat,sfloat,sfloat, sfloat,sfloat,sfloat,sfloat, sfloat,sfloat,sfloat,sfloat,sfloat,sfloat, sfloat,sfloat,int,sfloat,str,str),fields[4:38])) | def readFromText(self,textPath): """Reads stats from specified text file.""" alch, ammo, appa, armor, books, clothing, ingredients, keys, lights, misc, sigilstones, soulgems, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','APPA','ARMO','BOOK','CLOT','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP')] aliases = self.aliases ins = bolt.CsvReader(textPath) pack,unpack = struct.pack,struct.unpack sfloat = lambda a: unpack('f',pack('f',float(a)))[0] #--Force standard precision for fields in ins: if len(fields) < 3 or fields[2][:2] != '0x': continue type,modName,objectStr,eid = fields[0:4] modName = GPath(modName) longid = (GPath(aliases.get(modName,modName)),int(objectStr[2:],16)) if type == 'ALCH': alch[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'AMMO': ammo[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, damage, speed, enchantPoints) zip((str,sfloat,int,int,sfloat,int,str),fields[4:11])) elif type == 'ARMO': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, strength) zip((str,sfloat,int,int,int,str,str),fields[4:10])) elif type == 'BOOK': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'CLOT': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((str,sfloat,int,int,str,str),fields[4:10])) elif type == 'INGR': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'KEYM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'LIGH': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, duration) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'MISC': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int,str),fields[4:8])) elif type == 'SGST': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, uses) zip((str,sfloat,int,int,str),fields[4:9])) elif type == 'SLGM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((str,sfloat,int),fields[4:8])) elif type == 'WEAP': weapons[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, damage, speed, reach, epoints) zip((str,sfloat,int,int,int,sfloat,sfloat,int,str),fields[4:13])) ins.close() |
('ALCH', bolt.csvFormat('ssfiss')+'\n', | ('ALCH', bolt.csvFormat('ssfisss')+'\n', | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
_('Editor Id'),_('Name'),_('Weight'),_('Value'),_('Icon Path'),_('Model'))) + '"\n')), | _('Editor Id'),_('Name'),_('Weight'),_('Value'),_('Large Icon Path'),_('Small Icon Path'),_('Model'))) + '"\n')), | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
('AMMO', bolt.csvFormat('ssfiifiss')+'\n', | ('AMMO', bolt.csvFormat('ssfiisss')+'\n', | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
_('Editor Id'),_('Name'),_('Weight'),_('Value'),_('Damage'),_('Speed'),_('EPoints'),_('Icon Path'),_('Model'))) + '"\n')), | _('Editor Id'),_('Name'),_('Speed'),_('Value'),_('Clip Rounds'),_('Large Icon Path'),_('Small Icon Path'),_('Model'))) + '"\n')), | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
('ARMO', bolt.csvFormat('ssfiiissssss')+'\n', | ('ARMO', bolt.csvFormat('ssfiiissssssss')+'\n', | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
_('Editor Id'),_('Name'),_('Weight'),_('Value'),_('Health'), _('AR'),_('Male Icon Path'),_('Female Icon Path'),_('Male Model Path'), _('Female Model Path'),_('Male World Model Path'),_('Female World Model Path'))) + '"\n')), | _('Editor Id'),_('Name'),_('Weight'),_('Value'),_('Health'),_('AR'), _('Male Large Icon Path'),_('Male Small Icon Path'),_('Female Large Icon Path'),_('Female Small Icon Path'), _('Male Model Path'),_('Female Model Path'),_('Male World Model Path'),_('Female World Model Path'))) + '"\n')), | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
('BOOK', bolt.csvFormat('ssfiiss')+'\n', | ('BOOK', bolt.csvFormat('ssfisss')+'\n', | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
_('Editor Id'),_('Name'),_('Weight'),_('Value'),_('EPoints'),_('Icon Path'),_('Model'))) + '"\n')), ('CLOT', bolt.csvFormat('ssfiissssss')+'\n', ('"' + '","'.join((_('Type'),_('Mod Name'),_('ObjectIndex'), _('Editor Id'),_('Name'),_('Weight'),_('Value'),_('EPoints'), _('Male Icon Path'),_('Female Icon Path'),_('Male Model Path'), _('Female Model Path'),_('Male World Model Path'),_('Female World Model Path'))) + '"\n')), | _('Editor Id'),_('Name'),_('Weight'),_('Value'),_('Large Icon Path'),_('Small Icon Path'),_('Model'))) + '"\n')), | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
('KEYM', bolt.csvFormat('ssfiss')+'\n', | ('KEYM', bolt.csvFormat('ssfisss')+'\n', | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
('MISC', bolt.csvFormat('ssfiss')+'\n', | ('MISC', bolt.csvFormat('ssfisss')+'\n', | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
_('Editor Id'),_('Name'),_('Weight'),_('Value'),_('Icon Path'),_('Model'))) + '"\n')), ('SGST', bolt.csvFormat('ssfiiss')+'\n', | _('Editor Id'),_('Name'),_('Weight'),_('Value'),_('Large Icon Path'),_('Small Icon Path'),_('Model'))) + '"\n')), ('WEAP', bolt.csvFormat('ssfiiiififffiifffffffffffffffffifssssss')+'\n', | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
_('Editor Id'),_('Name'),_('Weight'),_('Value'),_('Uses'),_('Icon Path'),_('Model'))) + '"\n')), ('SLGM', bolt.csvFormat('ssfiss')+'\n', ('"' + '","'.join((_('Type'),_('Mod Name'),_('ObjectIndex'), _('Editor Id'),_('Name'),_('Weight'),_('Value'),_('Icon Path'),_('Model'))) + '"\n')), ('WEAP', bolt.csvFormat('ssfiiiffiss')+'\n', ('"' + '","'.join((_('Type'),_('Mod Name'),_('ObjectIndex'), _('Editor Id'),_('Name'),_('Weight'),_('Value'),_('Health'),_('Damage'), _('Speed'),_('Reach'),_('EPoints'),_('Icon Path'),_('Model'))) + '"\n')), | _('Editor Id'),_('Name'),_('Weight'),_('Value'),_('Health'),_('Damage'),_('Clip Size'), _('Reach'), _('Ammo Use'), _('Min Spread'), _('Spread'), _('Sight Fov'), _('Base VATS To-Hit Chance'), _('Projectile Count'), _('Min Range'), _('Max Range'), _('Fire Rate'), _('Override - Action Point'), _('Rumble - Left Motor Strength'), _('rRmble - Right Motor Strength'), _('Rumble - Duration'), _('Override - Damage To Weapon Mult'), _('Attack Shots/Sec'), _('Reload Time'), _('Jam Time'), _('Aim Arc'), _('Ramble - Wavelangth'), _('Limb Dmg Mult'), _('Sight Usage'), _('Semi-Automatic Fire Delay Min'), _('Semi-Automatic Fire Delay Max'), _('Critical Damage'), _('Crit % Mult'), _('Large Icon Path'),_('Small Icon Path'),_('Model'),_('Shell Casing Model'),_('Scope Model'),_('World Model'))) + '"\n')), | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
if type == 'ARMO' or type == 'CLOT': | if type == 'ARMO': | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
recAttrs_class[recClass] = ('maleBody','maleWorld','maleIconPath','maleIcon','femaleBody','femaleWorld','femaleIconPath','femaleIcon','flags') | recAttrs_class[recClass] = ('maleBody','maleWorld','maleLargeIconPath','maleSmallIconPath','femaleBody','femaleWorld','femaleLargeIconPath','femaleSmallIconPath','flags') | def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self.getConfigChecked() self.isActive = len(self.sourceMods) != 0 self.classestemp = set() #--Type Fields recAttrs_class = self.recAttrs_class = {} for recClass in (MreBsgn,MreLscr, MreClas, MreLtex, MreRegn): recAttrs_class[recClass] = ('iconPath',) for recClass in (MreActi, MreDoor, MreFlor, MreFurn, MreGras, MreStat, MreMstt): recAttrs_class[recClass] = ('model',) for recClass in (MreLigh,): recAttrs_class[recClass] = ('iconPath','model') for recClass in (MreAlch, MreAmmo, MreAppa, MreBook, MreIngr, MreKeym, MreMisc, MreSgst, MreSlgm, MreTree): recAttrs_class[recClass] = ('largeIconPath','smallIconPath','model') for recClass in (MreNote,): recAttrs_class[recClass] = ('largeIconPath','smallIconPath','model','texture') for recClass in (MreWeap,): recAttrs_class[recClass] = ('largeIconPath','smallIconPath','model','shellCasingModel','scopeModel','worldModel','firstPersonModel','animationType','gripAnimation','reloadAnimation') for recClass in (MreArmo, MreClot): recAttrs_class[recClass] = ('maleBody','maleWorld','maleIconPath','maleIcon','femaleBody','femaleWorld','femaleIconPath','femaleIcon','flags') for recClass in (MreCrea,): recAttrs_class[recClass] = ('model','bodyParts','nift_p','bodyPartData','impactDataset') for recClass in (MreMgef,): recAttrs_class[recClass] = ('iconPath','model','effectShader','objectDisplayShader','light') for recClass in (MreEfsh,): recAttrs_class[recClass] = ('particleTexture','fillTexture') for recClass in (MreTxst,): recAttrs_class[recClass] = ('baseImage','normalMap','environmentMapMask','growMap','parallaxMap','environmentMap','decalData','flags') for recClass in (MreExpl,): recAttrs_class[recClass] = ('imageSpaceModifier','light','impactDataset','placedImpactObject') for recClass in (MreTxst,): recAttrs_class[recClass] = ('baseImage','normalMap','environmentMapMask','growMap','parallaxMap','environmentMap','minWidth','maxWidth','minHeight','maxHeight','depth','shininess','parallaxScale','parallaxPasses','decalFlags','red','green','blue','flags') for recClass in (MreIpct,): recAttrs_class[recClass] = ('model','effectDuration','effectOrientation','angleThreshold','placementRadius','flags','minWidth','maxWidth','minHeight','maxHeight','depth','shininess','parallaxScale','parallaxPasses','decalFlags','red','green','blue','textureSet') for recClass in (MreIpds,): recAttrs_class[recClass] = ('stone','dirt','grass','metal','wood','organic','cloth','water','hollowMetal','organicBug','organicGlow') for recClass in (MreProj,): recAttrs_class[recClass] = ('model','light','muzzleFlash','explosion','muzzleFlashDuration','fadeDuration','muzzleFlashPath') #--Needs Longs self.longTypes = set(('BSGN','LSCR','CLAS','LTEX','REGN','ACTI','DOOR','FLOR','FURN','GRAS','STAT','ALCH','AMMO','BOOK','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP','TREE','ARMO','CLOT','CREA','MGEF','EFSH','TXST','EXPL','IPCT','IPDS','PROJ','NOTE','NPC_','DIAL')) |
MelStruct('WLST','IiI', 'Weather', (FID,'weather'), 'chance', (FID,'global')), | MelStructA('WLST','IiI', 'Weather', (FID,'weather'), 'chance', (FID,'global')), | # def loadData(self,record,ins,type,size,readId): |
MelBase('POBA', 'marker'), | MelBase('POBA', 'marker', ''), | def mapFids(self,record,function,save=False): """Applies function to fids. If save is true, then fid is set to result of function.""" if self.subType == 'PLDT' and record.locType != 5: result = function(record.locId) if save: record.locId = result elif self.subType == 'PLD2' and record.locType2 != 5: result = function(record.locId2) if save: record.locId2 = result elif self.subType == 'PTDT' and record.targetType != 2: result = function(record.targetId) if save: record.targetId = result elif self.subType == 'PTD2' and record.targetType2 != 2: result = function(record.targetId2) if save: record.targetId2 = result |
MelBase('POEA', 'marker'), | MelBase('POEA', 'marker', ''), | def mapFids(self,record,function,save=False): """Applies function to fids. If save is true, then fid is set to result of function.""" if self.subType == 'PLDT' and record.locType != 5: result = function(record.locId) if save: record.locId = result elif self.subType == 'PLD2' and record.locType2 != 5: result = function(record.locId2) if save: record.locId2 = result elif self.subType == 'PTDT' and record.targetType != 2: result = function(record.targetId) if save: record.targetId = result elif self.subType == 'PTD2' and record.targetType2 != 2: result = function(record.targetId2) if save: record.targetId2 = result |
MelBase('POCA', 'marker'), | MelBase('POCA', 'marker', ''), | def mapFids(self,record,function,save=False): """Applies function to fids. If save is true, then fid is set to result of function.""" if self.subType == 'PLDT' and record.locType != 5: result = function(record.locId) if save: record.locId = result elif self.subType == 'PLD2' and record.locType2 != 5: result = function(record.locId2) if save: record.locId2 = result elif self.subType == 'PTDT' and record.targetType != 2: result = function(record.targetId) if save: record.targetId = result elif self.subType == 'PTD2' and record.targetType2 != 2: result = function(record.targetId2) if save: record.targetId2 = result |
MelFid('EAMT','enchantment'), | MelOptStruct('EAMT','H', 'enchantment'), | def loadData(self,record,ins,type,size,readId): if size == 102: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 86: #--Else 86 byte record (skips dispVelocity, #-- dispFalloff, dispDampner, dispSize, and damage #-- Two junk? bytes are tacked onto the end #-- Hex editing and the CS confirms that it is NOT #-- damage, so it is probably just filler unpacked = ins.unpack('11f3Bs3Bs3BsB3s6f2s',size,readId) elif size == 62: #--Else 62 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('11f3Bs3Bs3BsB3s2s',size,readId) elif size == 42: #--Else 42 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('10f2s',size,readId) elif size == 2: #--Else 2 byte record (skips everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('2s',size,readId) else: raise "Unexpected size encountered for WATR subrecord: %s" % size unpacked = unpacked[:-1] unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked |
MelFidList('REPL','repairList'), | MelGroup('destructable', MelBase('DEST','header'), MelStructs('DSTD','=4B4I','stages','health','index','damageStage', (_flags,'flags',0L),'selfDamagePerSecond',(FID,'explosion',None), (FID,'debris',None),'debrisCount'), MelBase('DSTF','footer'), ), MelFid('REPL','repairList'), | def loadData(self,record,ins,type,size,readId): if size == 102: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 86: #--Else 86 byte record (skips dispVelocity, #-- dispFalloff, dispDampner, dispSize, and damage #-- Two junk? bytes are tacked onto the end #-- Hex editing and the CS confirms that it is NOT #-- damage, so it is probably just filler unpacked = ins.unpack('11f3Bs3Bs3BsB3s6f2s',size,readId) elif size == 62: #--Else 62 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('11f3Bs3Bs3BsB3s2s',size,readId) elif size == 42: #--Else 42 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('10f2s',size,readId) elif size == 2: #--Else 2 byte record (skips everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('2s',size,readId) else: raise "Unexpected size encountered for WATR subrecord: %s" % size unpacked = unpacked[:-1] unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked |
MelFid('NNAM','embeddedWeaponNode'), | MelString('NNAM','embeddedWeaponNode'), | def loadData(self,record,ins,type,size,readId): if size == 102: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 86: #--Else 86 byte record (skips dispVelocity, #-- dispFalloff, dispDampner, dispSize, and damage #-- Two junk? bytes are tacked onto the end #-- Hex editing and the CS confirms that it is NOT #-- damage, so it is probably just filler unpacked = ins.unpack('11f3Bs3Bs3BsB3s6f2s',size,readId) elif size == 62: #--Else 62 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('11f3Bs3Bs3BsB3s2s',size,readId) elif size == 42: #--Else 42 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('10f2s',size,readId) elif size == 2: #--Else 2 byte record (skips everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('2s',size,readId) else: raise "Unexpected size encountered for WATR subrecord: %s" % size unpacked = unpacked[:-1] unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked |
MelBase('DNAM','_dnam'), MelBase('CRDT','_crdt'), | MelStruct('DNAM','HffBBIBffffIIBIBffBIfffffffffffHBffHfff', 'animationType','animationMultiplier','reach',(_flags1,'flags1',0L), 'gripAnimation','ammoUse','reloadAnimation','minSpread','spread','unknown','sightFov',(FID,'projectile',None), 'baseVatsToHitChance','attackAnimation','projectileCount','embeddedWeaponActorValue','minRange','maxRange', 'onHit',(_flags2,'flags2',0L),'animationAttackMultiplier','fireRate','overrideActionPoint', 'rumbleLeftMotorStrength','rumbleRightMotorStrength','rumbleDuration','overrideDamageToWeaponMult', 'attackShotsPerSec','reloadTime','jamTime','aimArc','skill','rumblePattern','rambleWavelangth','limbDmgMult', 'resistType','sightUsage','semiAutomaticFireDelayMin','semiAutomaticFireDelayMax'), MelStruct('CRDT','IfHI','criticalDamage','criticalMultiplier',(_flags,'flags',0L),(FID,'effect',None)), | def loadData(self,record,ins,type,size,readId): if size == 102: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 86: #--Else 86 byte record (skips dispVelocity, #-- dispFalloff, dispDampner, dispSize, and damage #-- Two junk? bytes are tacked onto the end #-- Hex editing and the CS confirms that it is NOT #-- damage, so it is probably just filler unpacked = ins.unpack('11f3Bs3Bs3BsB3s6f2s',size,readId) elif size == 62: #--Else 62 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('11f3Bs3Bs3BsB3s2s',size,readId) elif size == 42: #--Else 42 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('10f2s',size,readId) elif size == 2: #--Else 2 byte record (skips everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('2s',size,readId) else: raise "Unexpected size encountered for WATR subrecord: %s" % size unpacked = unpacked[:-1] unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked |
recAttrs_class[recClass] = ('iconPath','model') | recAttrs_class[recClass] = ('largeIconPath','smallIconPath','model','shellCasingModel','scopeModel','worldModel','firstPersonModel') | def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self.getConfigChecked() self.isActive = len(self.sourceMods) != 0 #--Type Fields recAttrs_class = self.recAttrs_class = {} for recClass in (MreBsgn,MreLscr, MreClas, MreLtex, MreRegn): recAttrs_class[recClass] = ('iconPath',) for recClass in (MreActi, MreDoor, MreFlor, MreFurn, MreGras, MreStat): recAttrs_class[recClass] = ('model',) for recClass in (MreAlch, MreAmmo, MreAppa, MreBook, MreIngr, MreKeym, MreLigh, MreMisc, MreSgst, MreSlgm, MreWeap, MreTree): recAttrs_class[recClass] = ('iconPath','model') for recClass in (MreArmo, MreClot): recAttrs_class[recClass] = ('maleBody','maleWorld','maleIconPath','maleIcon','femaleBody','femaleWorld','femaleIconPath','femaleIcon','flags') for recClass in (MreCrea,): recAttrs_class[recClass] = ('model','bodyParts','nift_p','bloodSprayPath','bloodDecalPath') for recClass in (MreMgef,): recAttrs_class[recClass] = ('iconPath','model','effectShader','enchantEffect','light') for recClass in (MreEfsh,): recAttrs_class[recClass] = ('particleTexture','fillTexture') for recClass in (MreTxst,): recAttrs_class[recClass] = ('baseImage','normalMap','environmentMapMask','growMap','parallaxMap','environmentMap','decalData','flags') #--Needs Longs self.longTypes = set(('BSGN','LSCR','CLAS','LTEX','REGN','ACTI','DOOR','FLOR','FURN','GRAS','STAT','ALCH','AMMO','BOOK','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP','TREE','ARMO','CLOT','CREA','MGEF','EFSH','TXST')) |
self.type_stats = {'ALCH':{},'AMMO':{},'APPA':{},'ARMO':{},'BOOK':{},'CLOT':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'SGST':{},'SLGM':{},'WEAP':{}} | self.type_stats = {'ALCH':{},'AMMO':{},'ARMO':{},'BOOK':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'WEAP':{}} | def __init__(self,types=None,aliases=None): """Initialize.""" #--type_stats[type] = ... #--AMMO: (eid, weight, value, damage, speed, epoints) #--ARMO: (eid, weight, value, health, strength) #--WEAP: (eid, weight, value, health, damage, speed, reach, epoints) self.type_stats = {'ALCH':{},'AMMO':{},'APPA':{},'ARMO':{},'BOOK':{},'CLOT':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'SGST':{},'SLGM':{},'WEAP':{}} self.type_attrs = { 'ALCH':('eid', 'weight', 'value'), 'AMMO':('eid', 'speed', 'flags', 'value', 'clipRounds'), 'APPA':('eid', 'weight', 'value', 'quality'), 'ARMO':('eid', 'weight', 'value', 'health', 'ar'), 'BOOK':('eid', 'weight', 'value'), 'CLOT':('eid', 'weight', 'value', 'enchantPoints'), 'INGR':('eid', 'weight', 'value'), 'KEYM':('eid', 'weight', 'value'), 'LIGH':('eid', 'weight', 'value', 'duration'), 'MISC':('eid', 'weight', 'value'), 'SGST':('eid', 'weight', 'value', 'uses'), 'SLGM':('eid', 'weight', 'value'), 'WEAP':('eid', 'weight', 'value', 'health', 'damage', 'clipsize', 'minSpread', 'spread', 'baseVatsToHitChance', 'minRange', 'maxRange', 'fireRate', 'overrideActionPoint', 'overrideDamageToWeaponMult', 'attackShotsPerSec', 'reloadTime', 'jamTime', 'criticalDamage', 'criticalMultiplier'), } self.aliases = aliases or {} #--For aliasing mod names |
'AMMO':('eid', 'speed', 'flags', 'value', 'clipRounds'), 'APPA':('eid', 'weight', 'value', 'quality'), | 'AMMO':('eid', 'speed', 'value', 'clipRounds'), | def __init__(self,types=None,aliases=None): """Initialize.""" #--type_stats[type] = ... #--AMMO: (eid, weight, value, damage, speed, epoints) #--ARMO: (eid, weight, value, health, strength) #--WEAP: (eid, weight, value, health, damage, speed, reach, epoints) self.type_stats = {'ALCH':{},'AMMO':{},'APPA':{},'ARMO':{},'BOOK':{},'CLOT':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'SGST':{},'SLGM':{},'WEAP':{}} self.type_attrs = { 'ALCH':('eid', 'weight', 'value'), 'AMMO':('eid', 'speed', 'flags', 'value', 'clipRounds'), 'APPA':('eid', 'weight', 'value', 'quality'), 'ARMO':('eid', 'weight', 'value', 'health', 'ar'), 'BOOK':('eid', 'weight', 'value'), 'CLOT':('eid', 'weight', 'value', 'enchantPoints'), 'INGR':('eid', 'weight', 'value'), 'KEYM':('eid', 'weight', 'value'), 'LIGH':('eid', 'weight', 'value', 'duration'), 'MISC':('eid', 'weight', 'value'), 'SGST':('eid', 'weight', 'value', 'uses'), 'SLGM':('eid', 'weight', 'value'), 'WEAP':('eid', 'weight', 'value', 'health', 'damage', 'clipsize', 'minSpread', 'spread', 'baseVatsToHitChance', 'minRange', 'maxRange', 'fireRate', 'overrideActionPoint', 'overrideDamageToWeaponMult', 'attackShotsPerSec', 'reloadTime', 'jamTime', 'criticalDamage', 'criticalMultiplier'), } self.aliases = aliases or {} #--For aliasing mod names |
'CLOT':('eid', 'weight', 'value', 'enchantPoints'), | def __init__(self,types=None,aliases=None): """Initialize.""" #--type_stats[type] = ... #--AMMO: (eid, weight, value, damage, speed, epoints) #--ARMO: (eid, weight, value, health, strength) #--WEAP: (eid, weight, value, health, damage, speed, reach, epoints) self.type_stats = {'ALCH':{},'AMMO':{},'APPA':{},'ARMO':{},'BOOK':{},'CLOT':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'SGST':{},'SLGM':{},'WEAP':{}} self.type_attrs = { 'ALCH':('eid', 'weight', 'value'), 'AMMO':('eid', 'speed', 'flags', 'value', 'clipRounds'), 'APPA':('eid', 'weight', 'value', 'quality'), 'ARMO':('eid', 'weight', 'value', 'health', 'ar'), 'BOOK':('eid', 'weight', 'value'), 'CLOT':('eid', 'weight', 'value', 'enchantPoints'), 'INGR':('eid', 'weight', 'value'), 'KEYM':('eid', 'weight', 'value'), 'LIGH':('eid', 'weight', 'value', 'duration'), 'MISC':('eid', 'weight', 'value'), 'SGST':('eid', 'weight', 'value', 'uses'), 'SLGM':('eid', 'weight', 'value'), 'WEAP':('eid', 'weight', 'value', 'health', 'damage', 'clipsize', 'minSpread', 'spread', 'baseVatsToHitChance', 'minRange', 'maxRange', 'fireRate', 'overrideActionPoint', 'overrideDamageToWeaponMult', 'attackShotsPerSec', 'reloadTime', 'jamTime', 'criticalDamage', 'criticalMultiplier'), } self.aliases = aliases or {} #--For aliasing mod names |
|
'SGST':('eid', 'weight', 'value', 'uses'), 'SLGM':('eid', 'weight', 'value'), 'WEAP':('eid', 'weight', 'value', 'health', 'damage', 'clipsize', 'minSpread', 'spread', 'baseVatsToHitChance', 'minRange', 'maxRange', 'fireRate', 'overrideActionPoint', 'overrideDamageToWeaponMult', 'attackShotsPerSec', 'reloadTime', 'jamTime', 'criticalDamage', 'criticalMultiplier'), | 'WEAP':('eid', 'weight', 'value', 'health', 'damage','clipsize', 'reach','ammoUse','minSpread','spread','sightFov','baseVatsToHitChance','projectileCount', 'minRange','maxRange','fireRate','overrideActionPoint','rumbleLeftMotorStrength', 'rumbleRightMotorStrength','rumbleDuration','overrideDamageToWeaponMult','attackShotsPerSec', 'reloadTime','jamTime','aimArc','rambleWavelangth','limbDmgMult','sightUsage', 'semiAutomaticFireDelayMin','semiAutomaticFireDelayMax','criticalDamage','criticalMultiplier'), | def __init__(self,types=None,aliases=None): """Initialize.""" #--type_stats[type] = ... #--AMMO: (eid, weight, value, damage, speed, epoints) #--ARMO: (eid, weight, value, health, strength) #--WEAP: (eid, weight, value, health, damage, speed, reach, epoints) self.type_stats = {'ALCH':{},'AMMO':{},'APPA':{},'ARMO':{},'BOOK':{},'CLOT':{},'INGR':{},'KEYM':{},'LIGH':{},'MISC':{},'SGST':{},'SLGM':{},'WEAP':{}} self.type_attrs = { 'ALCH':('eid', 'weight', 'value'), 'AMMO':('eid', 'speed', 'flags', 'value', 'clipRounds'), 'APPA':('eid', 'weight', 'value', 'quality'), 'ARMO':('eid', 'weight', 'value', 'health', 'ar'), 'BOOK':('eid', 'weight', 'value'), 'CLOT':('eid', 'weight', 'value', 'enchantPoints'), 'INGR':('eid', 'weight', 'value'), 'KEYM':('eid', 'weight', 'value'), 'LIGH':('eid', 'weight', 'value', 'duration'), 'MISC':('eid', 'weight', 'value'), 'SGST':('eid', 'weight', 'value', 'uses'), 'SLGM':('eid', 'weight', 'value'), 'WEAP':('eid', 'weight', 'value', 'health', 'damage', 'clipsize', 'minSpread', 'spread', 'baseVatsToHitChance', 'minRange', 'maxRange', 'fireRate', 'overrideActionPoint', 'overrideDamageToWeaponMult', 'attackShotsPerSec', 'reloadTime', 'jamTime', 'criticalDamage', 'criticalMultiplier'), } self.aliases = aliases or {} #--For aliasing mod names |
alch, ammo, appa, armor, books, clothing, ingredients, keys, lights, misc, sigilstones, soulgems, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','APPA','ARMO','BOOK','CLOT','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP')] | alch, ammo, armor, books, ingredients, keys, lights, misc, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','ARMO','BOOK','INGR','KEYM','LIGH','MISC','WEAP')] | def readFromText(self,textPath): """Reads stats from specified text file.""" alch, ammo, appa, armor, books, clothing, ingredients, keys, lights, misc, sigilstones, soulgems, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','APPA','ARMO','BOOK','CLOT','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP')] aliases = self.aliases ins = bolt.CsvReader(textPath) pack,unpack = struct.pack,struct.unpack sfloat = lambda a: unpack('f',pack('f',float(a)))[0] #--Force standard precision for fields in ins: if len(fields) < 3 or fields[2][:2] != '0x': continue type,modName,objectStr,eid = fields[0:4] modName = GPath(modName) longid = (GPath(aliases.get(modName,modName)),int(objectStr[2:],16)) if type == 'ALCH': alch[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'AMMO': ammo[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, damage, speed, enchantPoints) zip((sfloat,int,int,sfloat,int),fields[4:9])) elif type == 'ARMO': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, strength) zip((sfloat,int,int,int),fields[4:8])) elif type == 'BOOK': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((sfloat,int,int,),fields[4:7])) elif type == 'CLOT': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((sfloat,int,int,),fields[4:7])) elif type == 'INGR': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'KEYM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'LIGH': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, duration) zip((sfloat,int,int,),fields[4:7])) elif type == 'MISC': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'SGST': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, uses) zip((sfloat,int,int,),fields[4:7])) elif type == 'SLGM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'WEAP': weapons[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, damage, speed, reach, epoints) zip((sfloat,int,int,int,sfloat,sfloat,int),fields[4:11])) ins.close() |
zip((sfloat,int,int,sfloat,int),fields[4:9])) | zip((sfloat,int,int),fields[4:7])) | def readFromText(self,textPath): """Reads stats from specified text file.""" alch, ammo, appa, armor, books, clothing, ingredients, keys, lights, misc, sigilstones, soulgems, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','APPA','ARMO','BOOK','CLOT','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP')] aliases = self.aliases ins = bolt.CsvReader(textPath) pack,unpack = struct.pack,struct.unpack sfloat = lambda a: unpack('f',pack('f',float(a)))[0] #--Force standard precision for fields in ins: if len(fields) < 3 or fields[2][:2] != '0x': continue type,modName,objectStr,eid = fields[0:4] modName = GPath(modName) longid = (GPath(aliases.get(modName,modName)),int(objectStr[2:],16)) if type == 'ALCH': alch[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'AMMO': ammo[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, damage, speed, enchantPoints) zip((sfloat,int,int,sfloat,int),fields[4:9])) elif type == 'ARMO': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, strength) zip((sfloat,int,int,int),fields[4:8])) elif type == 'BOOK': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((sfloat,int,int,),fields[4:7])) elif type == 'CLOT': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((sfloat,int,int,),fields[4:7])) elif type == 'INGR': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'KEYM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'LIGH': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, duration) zip((sfloat,int,int,),fields[4:7])) elif type == 'MISC': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'SGST': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, uses) zip((sfloat,int,int,),fields[4:7])) elif type == 'SLGM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'WEAP': weapons[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, damage, speed, reach, epoints) zip((sfloat,int,int,int,sfloat,sfloat,int),fields[4:11])) ins.close() |
zip((sfloat,int,int,),fields[4:7])) elif type == 'CLOT': armor[longid] = (eid,) + tuple(func(field) for func,field in zip((sfloat,int,int,),fields[4:7])) | zip((sfloat,int),fields[4:6])) | def readFromText(self,textPath): """Reads stats from specified text file.""" alch, ammo, appa, armor, books, clothing, ingredients, keys, lights, misc, sigilstones, soulgems, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','APPA','ARMO','BOOK','CLOT','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP')] aliases = self.aliases ins = bolt.CsvReader(textPath) pack,unpack = struct.pack,struct.unpack sfloat = lambda a: unpack('f',pack('f',float(a)))[0] #--Force standard precision for fields in ins: if len(fields) < 3 or fields[2][:2] != '0x': continue type,modName,objectStr,eid = fields[0:4] modName = GPath(modName) longid = (GPath(aliases.get(modName,modName)),int(objectStr[2:],16)) if type == 'ALCH': alch[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'AMMO': ammo[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, damage, speed, enchantPoints) zip((sfloat,int,int,sfloat,int),fields[4:9])) elif type == 'ARMO': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, strength) zip((sfloat,int,int,int),fields[4:8])) elif type == 'BOOK': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((sfloat,int,int,),fields[4:7])) elif type == 'CLOT': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((sfloat,int,int,),fields[4:7])) elif type == 'INGR': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'KEYM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'LIGH': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, duration) zip((sfloat,int,int,),fields[4:7])) elif type == 'MISC': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'SGST': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, uses) zip((sfloat,int,int,),fields[4:7])) elif type == 'SLGM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'WEAP': weapons[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, damage, speed, reach, epoints) zip((sfloat,int,int,int,sfloat,sfloat,int),fields[4:11])) ins.close() |
elif type == 'SGST': books[longid] = (eid,) + tuple(func(field) for func,field in zip((sfloat,int,int,),fields[4:7])) elif type == 'SLGM': keys[longid] = (eid,) + tuple(func(field) for func,field in zip((sfloat,int),fields[4:6])) | def readFromText(self,textPath): """Reads stats from specified text file.""" alch, ammo, appa, armor, books, clothing, ingredients, keys, lights, misc, sigilstones, soulgems, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','APPA','ARMO','BOOK','CLOT','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP')] aliases = self.aliases ins = bolt.CsvReader(textPath) pack,unpack = struct.pack,struct.unpack sfloat = lambda a: unpack('f',pack('f',float(a)))[0] #--Force standard precision for fields in ins: if len(fields) < 3 or fields[2][:2] != '0x': continue type,modName,objectStr,eid = fields[0:4] modName = GPath(modName) longid = (GPath(aliases.get(modName,modName)),int(objectStr[2:],16)) if type == 'ALCH': alch[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'AMMO': ammo[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, damage, speed, enchantPoints) zip((sfloat,int,int,sfloat,int),fields[4:9])) elif type == 'ARMO': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, strength) zip((sfloat,int,int,int),fields[4:8])) elif type == 'BOOK': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((sfloat,int,int,),fields[4:7])) elif type == 'CLOT': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((sfloat,int,int,),fields[4:7])) elif type == 'INGR': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'KEYM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'LIGH': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, duration) zip((sfloat,int,int,),fields[4:7])) elif type == 'MISC': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'SGST': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, uses) zip((sfloat,int,int,),fields[4:7])) elif type == 'SLGM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'WEAP': weapons[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, damage, speed, reach, epoints) zip((sfloat,int,int,int,sfloat,sfloat,int),fields[4:11])) ins.close() |
|
zip((sfloat,int,int,int,sfloat,sfloat,int),fields[4:11])) | zip((sfloat,int,int,int,int, sfloat,int,sfloat,sfloat,sfloat,int,int, sfloat,sfloat,sfloat,sfloat,sfloat, sfloat,sfloat,sfloat,sfloat, sfloat,sfloat,sfloat,sfloat,sfloat,sfloat, sfloat,sfloat,int,sfloat),fields[4:35])) | def readFromText(self,textPath): """Reads stats from specified text file.""" alch, ammo, appa, armor, books, clothing, ingredients, keys, lights, misc, sigilstones, soulgems, weapons = [self.type_stats[type] for type in ('ALCH','AMMO','APPA','ARMO','BOOK','CLOT','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP')] aliases = self.aliases ins = bolt.CsvReader(textPath) pack,unpack = struct.pack,struct.unpack sfloat = lambda a: unpack('f',pack('f',float(a)))[0] #--Force standard precision for fields in ins: if len(fields) < 3 or fields[2][:2] != '0x': continue type,modName,objectStr,eid = fields[0:4] modName = GPath(modName) longid = (GPath(aliases.get(modName,modName)),int(objectStr[2:],16)) if type == 'ALCH': alch[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'AMMO': ammo[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, damage, speed, enchantPoints) zip((sfloat,int,int,sfloat,int),fields[4:9])) elif type == 'ARMO': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, strength) zip((sfloat,int,int,int),fields[4:8])) elif type == 'BOOK': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((sfloat,int,int,),fields[4:7])) elif type == 'CLOT': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, echantPoints) zip((sfloat,int,int,),fields[4:7])) elif type == 'INGR': armor[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'KEYM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'LIGH': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, duration) zip((sfloat,int,int,),fields[4:7])) elif type == 'MISC': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'SGST': books[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, uses) zip((sfloat,int,int,),fields[4:7])) elif type == 'SLGM': keys[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value) zip((sfloat,int),fields[4:6])) elif type == 'WEAP': weapons[longid] = (eid,) + tuple(func(field) for func,field in #--(weight, value, health, damage, speed, reach, epoints) zip((sfloat,int,int,int,sfloat,sfloat,int),fields[4:11])) ins.close() |
('AMMO', bolt.csvFormat('sfiifi')+'\n', | ('AMMO', bolt.csvFormat('sfii')+'\n', | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
_('Editor Id'),_('Weight'),_('Value'),_('Damage'),_('Speed'),_('EPoints'))) + '"\n')), | _('Editor Id'),_('Speed'),_('Value'),_('Clip Rounds'))) + '"\n')), | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
('BOOK', bolt.csvFormat('sfii')+'\n', | ('BOOK', bolt.csvFormat('sfi')+'\n', | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
_('Editor Id'),_('Weight'),_('Value'),_('EPoints'))) + '"\n')), ('CLOT', bolt.csvFormat('sfii')+'\n', ('"' + '","'.join((_('Type'),_('Mod Name'),_('ObjectIndex'), _('Editor Id'),_('Weight'),_('Value'),_('EPoints'))) + '"\n')), | _('Editor Id'),_('Weight'),_('Value'))) + '"\n')), | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
('SGST', bolt.csvFormat('sfii')+'\n', | ('WEAP', bolt.csvFormat('sfiiiififffiifffffffffffffffffif')+'\n', | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
_('Editor Id'),_('Weight'),_('Value'),_('Uses'))) + '"\n')), ('SLGM', bolt.csvFormat('sfi')+'\n', ('"' + '","'.join((_('Type'),_('Mod Name'),_('ObjectIndex'), _('Editor Id'),_('Weight'),_('Value'))) + '"\n')), ('WEAP', bolt.csvFormat('sfiiiffi')+'\n', ('"' + '","'.join((_('Type'),_('Mod Name'),_('ObjectIndex'), _('Editor Id'),_('Weight'),_('Value'),_('Health'),_('Damage'), _('Speed'),_('Reach'),_('EPoints'))) + '"\n')), | _('Editor Id'),_('Weight'),_('Value'),_('Health'),_('Damage'),_('Clip Size'), _('Reach'), _('Ammo Use'), _('Min Spread'), _('Spread'), _('Sight Fov'), _('Base VATS To-Hit Chance'), _('Projectile Count'), _('Min Range'), _('Max Range'), _('Fire Rate'), _('Override - Action Point'), _('Rumble - Left Motor Strength'), _('rRmble - Right Motor Strength'), _('Rumble - Duration'), _('Override - Damage To Weapon Mult'), _('Attack Shots/Sec'), _('Reload Time'), _('Jam Time'), _('Aim Arc'), _('Ramble - Wavelangth'), _('Limb Dmg Mult'), _('Sight Usage'), _('Semi-Automatic Fire Delay Min'), _('Semi-Automatic Fire Delay Max'), _('Critical Damage'), _('Crit % Mult'))) + '"\n')), | def getSortedIds(stats): longids = stats.keys() longids.sort(key=lambda a: stats[a][0]) longids.sort(key=itemgetter(0)) return longids |
if isinstance(inName, str): | if isinstance(self.inName, str): | def __str__(self): if self.inName: if isinstance(inName, str): return self.inName+': '+self.message return self.inName.s+': '+self.message else: return _('Unknown File: ')+self.message |
MelBase('VNAM','_vnam','soundLevel'), | MelBase('VNAM','soundLevel'), | def loadData(self,record,ins,type,size,readId): if size == 136: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 124: #--Else 124 byte record (skips sightUsage, semiAutomaticFireDelayMin and semiAutomaticFireDelayMax... unpacked = ins.unpack('Iff4B5fI4BffII11fIIffI',size,readId) elif size == 120: #--Else 120 byte record (skips resistType, sightUsage, semiAutomaticFireDelayMin and semiAutomaticFireDelayMax... unpacked = ins.unpack('Iff4B5fI4BffII11fIIff',size,readId) else: raise "Unexpected size encountered for WEAP:DNAM subrecord: %s" % size unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked |
self.longTypes = set(('MGEF','ACTI','LIGH','WTHR','CONT','DOOR','EXPL','IPCT','PROJ','ASPC','SOUN','REGN')) | self.longTypes = set(('MGEF','ACTI','LIGH','WTHR','CONT','DOOR','EXPL','IPCT','PROJ','ASPC','WEAP','SOUN','REGN')) | def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self.getConfigChecked() self.isActive = len(self.sourceMods) != 0 self.classestemp = set() #--Type Fields recAttrs_class = self.recAttrs_class = {} for recClass in (MreMgef,): recAttrs_class[recClass] = ('castingSound','boltSound','hitSound','areaSound') for recClass in (MreActi,): recAttrs_class[recClass] = ('soundLooping','soundActivation') for recClass in (MreLigh,MreTact): recAttrs_class[recClass] = ('sound',) for recClass in (MreWthr,): recAttrs_class[recClass] = ('sounds',) for recClass in (MreCont,): recAttrs_class[recClass] = ('soundOpen','soundClose') for recClass in (MreDoor,): recAttrs_class[recClass] = ('soundOpen','soundClose','soundLoop') for recClass in (MreExpl,MreIpct,): recAttrs_class[recClass] = ('soundLevel','sound1','sound2') for recClass in (MreProj,): recAttrs_class[recClass] = ('sound','soundCountDown','soundDisable','soundLevel') for recClass in (MreAspc,): recAttrs_class[recClass] = ('soundLooping','useSoundFromRegion','environmentType') for recClass in (MreWeap,): recAttrs_class[recClass] = ('soundGunShot3D','soundGunShot2D','soundGunShot3DLooping','soundLevel') #--Needs Longs self.longTypes = set(('MGEF','ACTI','LIGH','WTHR','CONT','DOOR','EXPL','IPCT','PROJ','ASPC','SOUN','REGN')) |
MelString('ICON','iconPath'), MelFid('ENAM','enchantment'), MelOptStruct('ANAM','H','enchantPoints'), MelStruct('DATA','fB3sIfH','speed',(_flags,'flags',0L),('unused1',null3),'value','weight','damage'), | MelString('ICON','largeIconPath'), MelString('MICO','smallIconPath'), MelGroup('destructable', MelBase('DEST','header'), MelStruct('DEST','IhH','health','count','flags'), MelGroups('stages', MelStruct('DSTD','=4B4I','health','index','damageStage','flags', 'selfDamagePerSecond',(FID,'explosion',None),(FID,'debris',None),'debrisCount'), MelString('DMDL','model'), MelBase('DMDT','_dmdt'), MelBase('DSTF','footer'), ), ), MelFid('YNAM','soundPickup'), MelFid('ZNAM','soundDrop'), MelStruct('DATA','fB3sIB','speed',(_flags,'flags',0L),('unused1',null3),'value','clipRounds'), MelString('ONAM','shortName'), | def getEffectsSummary(self,mgef_school=None,mgef_name=None): """Return a text description of magic effects.""" mgef_school = mgef_school or bush.mgef_school mgef_name = mgef_name or bush.mgef_name buff = cStringIO.StringIO() avEffects = bush.actorValueEffects aValues = bush.actorValues buffWrite = buff.write if self.effects: school = mgef_school[self.effects[0].name] buffWrite(bush.actorValues[20+school] + '\n') for index,effect in enumerate(self.effects): if effect.scriptEffect: effectName = effect.scriptEffect.full or 'Script Effect' else: effectName = mgef_name[effect.name] if effect.name in avEffects: effectName = re.sub(_('(Attribute|Skill)'),aValues[effect.actorValue],effectName) buffWrite('o+*'[effect.recipient]+' '+effectName) if effect.magnitude: buffWrite(' '+`effect.magnitude`+'m') if effect.area: buffWrite(' '+`effect.area`+'a') if effect.duration > 1: buffWrite(' '+`effect.duration`+'d') buffWrite('\n') return buff.getvalue() |
if size == 224: | if size == 308: | def loadData(self,record,ins,type,size,readId): if size == 224: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 96: #--Else 96 byte record (skips particle variables, and color keys # Only used twice in test shaders (0004b6d5, 0004b6d6) unpacked = ins.unpack('B3s3I3Bs9f3Bs8fI',size,readId) else: raise "Unexpected size encountered for EFSH subrecord: %s" % size unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked, record.flags.getTrueAttrs() |
elif size == 96: unpacked = ins.unpack('B3s3I3Bs9f3Bs8fI',size,readId) | elif size == 300: unpacked = ins.unpack('B3s3I3Bs9f3Bs8f5I19f3Bs3Bs3Bs6f5fI5f3BsfII4f',size,readId) elif size == 284: unpacked = ins.unpack('B3s3I3Bs9f3Bs8f5I19f3Bs3Bs3Bs6f5fI5f3BsfII',size,readId) elif size == 248: unpacked = ins.unpack('B3s3I3Bs9f3Bs8f5I19f3Bs3Bs3Bs6f5fI',size,readId) elif size == 244: unpacked = ins.unpack('B3s3I3Bs9f3Bs8f5I19f3Bs3Bs3Bs6f5f',size,readId) elif size == 224: unpacked = ins.unpack('B3s3I3Bs9f3Bs8f5I19f3Bs3Bs3Bs6f',size,readId) | def loadData(self,record,ins,type,size,readId): if size == 224: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 96: #--Else 96 byte record (skips particle variables, and color keys # Only used twice in test shaders (0004b6d5, 0004b6d6) unpacked = ins.unpack('B3s3I3Bs9f3Bs8fI',size,readId) else: raise "Unexpected size encountered for EFSH subrecord: %s" % size unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked, record.flags.getTrueAttrs() |
MelEfshData('DATA','B3s3I3Bs9f3Bs8f5I19f3Bs3Bs3Bs6f',(_flags,'flags'),('unused1',null3),'memSBlend', 'memBlendOp','memZFunc','fillRed','fillGreen','fillBlue',('unused2',null1), 'fillAIn','fillAFull','fillAOut','fillAPRatio','fillAAmp', 'fillAFreq','fillAnimSpdU','fillAnimSpdV','edgeOff','edgeRed', 'edgeGreen','edgeBlue',('unused3',null1),'edgeAIn','edgeAFull', 'edgeAOut','edgeAPRatio','edgeAAmp','edgeAFreq','fillAFRatio', 'edgeAFRatio','memDBlend',('partSBlend',5),('partBlendOp',1), ('partZFunc',4),('partDBlend',6),('partBUp',0.0),('partBFull',0.0),('partBDown',0.0), ('partBFRatio',1.0),('partBPRatio',1.0),('partLTime',1.0),('partLDelta',0.0),('partNSpd',0.0), ('partNAcc',0.0),('partVel1',0.0),('partVel2',0.0),('partVel3',0.0),('partAcc1',0.0), ('partAcc2',0.0),('partAcc3',0.0),('partKey1',1.0),('partKey2',1.0),('partKey1Time',0.0), ('partKey2Time',1.0),('key1Red',255),('key1Green',255),('key1Blue',255),('unused4',null1), ('key2Red',255),('key2Green',255),('key2Blue',255),('unused5',null1),('key3Red',255),('key3Green',255), ('key3Blue',255),('unused6',null1),('key1A',1.0),('key2A',1.0),('key3A',1.0),('key1Time',0.0), ('key2Time',0.5),('key3Time',1.0)), | MelString('NAM7','holesTexture'), MelEfshData('DATA','B3s3I3Bs9f3Bs8f5I19f3Bs3Bs3Bs6f5fI5f3BsfII6f',(_flags,'flags'),('unused1',null3),'memSBlend', 'memBlendOp','memZFunc','fillRed','fillGreen','fillBlue',('unused2',null1), 'fillAIn','fillAFull','fillAOut','fillAPRatio','fillAAmp', 'fillAFreq','fillAnimSpdU','fillAnimSpdV','edgeOff','edgeRed', 'edgeGreen','edgeBlue',('unused3',null1),'edgeAIn','edgeAFull', 'edgeAOut','edgeAPRatio','edgeAAmp','edgeAFreq','fillAFRatio', 'edgeAFRatio','memDBlend',('partSBlend',5),('partBlendOp',1), ('partZFunc',4),('partDBlend',6),('partBUp',0.0),('partBFull',0.0),('partBDown',0.0), ('partBFRatio',1.0),('partBPRatio',1.0),('partLTime',1.0),('partLDelta',0.0),('partNSpd',0.0), ('partNAcc',0.0),('partVel1',0.0),('partVel2',0.0),('partVel3',0.0),('partAcc1',0.0), ('partAcc2',0.0),('partAcc3',0.0),('partKey1',1.0),('partKey2',1.0),('partKey1Time',0.0), ('partKey2Time',1.0),('key1Red',255),('key1Green',255),('key1Blue',255),('unused4',null1), ('key2Red',255),('key2Green',255),('key2Blue',255),('unused5',null1),('key3Red',255),('key3Green',255), ('key3Blue',255),('unused6',null1),('key1A',1.0),('key2A',1.0),('key3A',1.0),('key1Time',0.0), ('key2Time',0.5),('key3Time',1.0), ('partNSpdDelta',0.00000),('partRot',0.00000),('partRotDelta',0.00000),('partRotSpeed',0.00000),('partRotSpeedDelta',0.00000), (FID,'addonModels',None),('holesStartTime',0.00000),('holesEndTime',0.00000),('holesStartVal',0.00000),('holesEndVal',0.00000), ('edgeWidth',0.00000),('edgeRed',255),('edgeGreen',255),('edgeBlue',255),('unused7',null1), ('explosionWindSpeed',0.00000),('textureCountU',1),('textureCountV',1), ('addonModelsFadeInTime',1.00000),('addonModelsFadeOutTime',1.00000), ('addonModelsScaleStart',1.00000),('addonModelsScaleEnd',1.00000), ('addonModelsScaleInTime',1.00000),('addonModelsScaleOutTime',1.00000), ), | def loadData(self,record,ins,type,size,readId): if size == 224: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 96: #--Else 96 byte record (skips particle variables, and color keys # Only used twice in test shaders (0004b6d5, 0004b6d6) unpacked = ins.unpack('B3s3I3Bs9f3Bs8fI',size,readId) else: raise "Unexpected size encountered for EFSH subrecord: %s" % size unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked, record.flags.getTrueAttrs() |
target = record.__getattribute__(self.attr,None) | target = record.__getattribute__(self.attr) | def dumpData(self,record,out): target = record.__getattribute__(self.attr,None) if not target: return if record.type == 0: format,attrs = ('II',('quest','queststage')) elif record.type == 1: format,attrs = ('I',('ability',)) elif record.type == 2: format,attrs = ('HB',('entrypoint','function')) else: raise ModError(ins.inName,_('Unexpected type: %d') % record.type) values = [] valuesAppend = values.append getter = target.__getattribute__ for attr in attrs: value = getter(attr) valuesAppend(value) try: out.packSub(self.subType,format,*values) except struct.error: print self.subType,format,values raise |
target = record.__getattribute__(self.attr,None) | target = record.__getattribute__(self.attr) | def mapFids(self,record,function,save=False): target = record.__getattribute__(self.attr,None) if not target: return if record.type == 0: result = function(target.quest) if save: target.quest = result elif record.type == 1: result = function(target.ability) if save: target.ability = result |
target = self.getDefault() record.__getattribute__(self.attr).append(target) | if type in ('EPFD','EPFT','EPF2','EPF3','SCHR'): target = self.getDefault() record.__getattribute__(self.attr).append(target) else: target = record.__getattribute__(self.attr)[-1] | def loadData(self,record,ins,type,size,readId): target = self.getDefault() record.__getattribute__(self.attr).append(target) element = self.loaders[type] slots = ['recordType'] slots.extend(element.getSlotsUsed()) target.__slots__ = slots target.recordType = type element.loadData(target,ins,type,size,readId) |
target = record.__getattribute__(self.attr) if not target: return element = self.loaders[target.recordType] if not element: raise ModError(ins.inName,_('Unexpected type: %d') % target.recordType) element.dumpData(target,out) | for target in record.__getattribute__(self.attr): element = self.loaders[target.recordType] if not element: raise ModError(ins.inName,_('Unexpected type: %d') % target.recordType) element.dumpData(target,out) | def dumpData(self,record,out): target = record.__getattribute__(self.attr) if not target: return element = self.loaders[target.recordType] if not element: raise ModError(ins.inName,_('Unexpected type: %d') % target.recordType) element.dumpData(target,out) |
Subsets and Splits