records.py module

Changed the import position otherwise only skyrim loads (oblivion module not
seen)

--------------------- Mopy/bash/game/oblivion/__init__.py ---------------------
index b11775d..d8f7cf0 100644
@@ -25,7 +25,6 @@
 """This modules defines static data for use by bush, when
    TES IV: Oblivion is set at the active game."""

-from game.oblivion.records import RecordHeader
 from oblivion_const import bethDataFiles, allBethFiles
 from ... import brec
 from ... import bush
@@ -1678,6 +1677,7 @@ class esp:

     recordTypes = set(topTypes + 'GRUP,TES4,ROAD,REFR,ACHR,ACRE,PGRD,LAND,INFO'.split(','))

+from records import * # MUST BE HERE otherwise all hell breaks loose
 #------------------------------------------------------------------------------
 # Record Elements    ----------------------------------------------------------
 #------------------------------------------------------------------------------
Couple more records ripped

This is the 2nd commit message:

I think I finally got the imports right (relative imports to the rescue from
bash/bash)

---------------------- Mopy/bash/game/oblivion/records.py ----------------------
 from . import esp

 #--Mod I/O
-from bash.bolt import StateError, Flags
-from bash.brec import MelRecord
+from ...bolt import StateError, Flags
+from ...brec import MelRecord, BaseRecordHeader, ModError

-class RecordHeader(bash.brec.BaseRecordHeader):
+class RecordHeader(BaseRecordHeader):
     size = 20

     def __init__(self,recType='TES4',size=0,arg1=0,arg2=0,arg3=0,*extra):
@@ -54,7 +54,7 @@ def unpack(ins):
         type,size,uint0,uint1,uint2 = ins.unpack('=4s4I',20,'REC_HEADER')
         #--Bad?
         if type not in esp.recordTypes:
-            raise bash.brec.ModError(ins.inName,u'Bad header type: '+repr(type))
+            raise ModError(ins.inName,u'Bad header type: '+repr(type))
         #--Record
         if type != 'GRUP':
             pass
@@ -66,7 +66,7 @@ def unpack(ins):
             elif str0 in esp.topIgTypes:
                 uint0 = esp.topIgTypes[str0]
             else:
-                raise bash.brec.ModError(ins.inName,u'Bad Top GRUP type: '+repr(str0))
+                raise ModError(ins.inName,u'Bad Top GRUP type: '+repr(str0))
         return RecordHeader(type,size,uint0,uint1,uint2)

     def pack(self):
@@ -100,7 +100,7 @@ class MelBipedFlags(bash.bolt.Flags):
     """Biped flags element. Includes biped flag set by default."""
     mask = 0xFFFF
     def __init__(self,default=0L,newNames=None):
-        names = bolt.Flags.getNames('head', 'hair', 'upperBody', 'lowerBody', 'hand', 'foot', 'rightRing', 'leftRing', 'amulet', 'weapon', 'backWeapon', 'sideWeapon', 'quiver', 'shield', 'torch', 'tail')
+        names = Flags.getNames('head', 'hair', 'upperBody', 'lowerBody', 'hand', 'foot', 'rightRing', 'leftRing', 'amulet', 'weapon', 'backWeapon', 'sideWeapon', 'quiver', 'shield', 'torch', 'tail')
         if newNames: names.update(newNames)
         Flags.__init__(self,default,names)
More records - moved stuff to constants to get rid of cyclic imports

Was getting AttributeError: 'module' object has no attribute 'init'
Diffs from vanilla rip (excluding the move)
@@ -27,4 +27,2 @@
 import struct
-import bash
-import bash.brec
 from . import esp
@@ -32,4 +30,3 @@
 #--Mod I/O
-from ...bolt import StateError, Flags
-import bolt
+from ...bolt import StateError, Flags, BoltError, sio
 from ...brec import MelRecord, BaseRecordHeader, ModError, MelStructs, null3, \
@@ -38,4 +35,4 @@
     MelFids
-import bush
-from game.oblivion import allConditions, fid1Conditions, fid2Conditions
+from ...bush import genericAVEffects, mgef_school, mgef_basevalue, actorValues
+from oblivion_const import allConditions, fid1Conditions, fid2Conditions

@@ -105,3 +102,3 @@ def mergeFilter(self,modSet):
 #------------------------------------------------------------------------------
-class MelBipedFlags(bash.bolt.Flags):
+class MelBipedFlags(Flags):
     """Biped flags element. Includes biped flag set by default."""
@@ -150,3 +147,3 @@ def loadData(self,record,ins,type,size,readId):
         if ifunc not in allConditions:
-            raise bolt.BoltError(u'Unknown condition function: %d' % ifunc)
+            raise BoltError(u'Unknown condition function: %d' % ifunc)
         form1 = 'iI'[ifunc in fid1Conditions]
@@ -191,3 +188,3 @@ class MelEffects(MelGroups):
     #--Class Data
-    seFlags = bolt.Flags(0x0L,bolt.Flags.getNames('hostile'))
+    seFlags = Flags(0x0L,Flags.getNames('hostile'))
     class MelEffectsScit(MelStruct):
@@ -239,3 +236,3 @@ def getEffects(self):
         effects = []
-        avEffects = bush.genericAVEffects
+        avEffects = genericAVEffects
         effectsAppend = effects.append
@@ -248,3 +245,3 @@ def getEffects(self):

-    def getSpellSchool(self,mgef_school=bush.mgef_school):
+    def getSpellSchool(self,mgef_school=mgef_school):
         """Returns the school based on the highest cost spell effect."""
@@ -253,3 +250,3 @@ def getSpellSchool(self,mgef_school=bush.mgef_school):
             school = mgef_school[effect.name]
-            effectValue = bush.mgef_basevalue[effect.name]
+            effectValue = mgef_basevalue[effect.name]
             if effect.magnitude:
@@ -266,7 +263,7 @@ 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
-        with bolt.sio() as buff:
-            avEffects = bush.genericAVEffects
-            aValues = bush.actorValues
+        mgef_school = mgef_school or mgef_school
+        mgef_name = mgef_name or mgef_name
+        with sio() as buff:
+            avEffects = genericAVEffects
+            aValues = actorValues
             buffWrite = buff.write
@@ -274,3 +271,3 @@ def getEffectsSummary(self,mgef_school=None,mgef_name=None):
                 school = self.getSpellSchool(mgef_school)
-                buffWrite(bush.actorValues[20+school] + u'\n')
+                buffWrite(actorValues[20+school] + u'\n')
             for index,effect in enumerate(self.effects):
@@ -364,2 +361 @@ def mapFids(self,record,function,save=False):
                 if save: scrxen[index] = (isFid,result)
-
Started ripping "Oblivion records"

Loads skyrim (no crash but oblivion module not seen) - fix:

--------------------- Mopy/bash/game/oblivion/__init__.py ---------------------
index 2da33c2..7725b87 100644
@@ -24,12 +24,11 @@

 """This modules defines static data for use by bush, when
    TES IV: Oblivion is set at the active game."""
-from game.oblivion.records import MreHeader

 from oblivion_const import bethDataFiles, allBethFiles
 from ... import brec
 from ...brec import *
-from ...bolt import DataDict
+from ...bolt import Flags, DataDict, StateError

 # Util Constants ---------------------------------------------------------------
 #--Null strings (for default empty byte arrays)
More records

AttributeError: 'module' object has no attribute 'init' - fix:

---------------------- Mopy/bash/game/oblivion/records.py ----------------------
index 2789d4c..9734cf5 100644
@@ -31,3 +31,2 @@
 from ...bolt import StateError, Flags, BoltError, sio
-import bolt
 from ...brec import MelRecord, BaseRecordHeader, ModError, MelStructs, null3, \
@@ -384,3 +383,3 @@ class MreAchr(MelRecord): # Placed NPC
     classType = 'ACHR'
-    _flags = bolt.Flags(0L,bolt.Flags.getNames('oppositeParent'))
+    _flags = Flags(0L,Flags.getNames('oppositeParent'))
     melSet=MelSet(
@@ -401,3 +400,3 @@ class MreAcre(MelRecord): # Placed Creature
     classType = 'ACRE'
-    _flags = bolt.Flags(0L,bolt.Flags.getNames('oppositeParent'))
+    _flags = Flags(0L,Flags.getNames('oppositeParent'))
     melSet=MelSet(
@@ -429,3 +428,3 @@ class MreAlch(MelRecord,MreHasEffects):
     classType = 'ALCH'
-    _flags = bolt.Flags(0L,bolt.Flags.getNames('autoCalc','isFood'))
+    _flags = Flags(0L,Flags.getNames('autoCalc','isFood'))
     melSet = MelSet(
@@ -445,3 +444,3 @@ class MreAmmo(MelRecord):
     classType = 'AMMO'
-    _flags = bolt.Flags(0L,bolt.Flags.getNames('notNormalWeapon'))
+    _flags = Flags(0L,Flags.getNames('notNormalWeapon'))
     melSet = MelSet(
@@ -483,3 +482,3 @@ class MreArmo(MelRecord):
     classType = 'ARMO'
-    _flags = MelBipedFlags(0L,bolt.Flags.getNames((16,'hideRings'),(17,'hideAmulet'),(22,'notPlayable'),(23,'heavyArmor')))
+    _flags = MelBipedFlags(0L,Flags.getNames((16,'hideRings'),(17,'hideAmulet'),(22,'notPlayable'),(23,'heavyArmor')))
     melSet = MelSet(
@@ -504,3 +503,3 @@ class MreBook(MelRecord):
     classType = 'BOOK'
-    _flags = bolt.Flags(0,bolt.Flags.getNames('isScroll','isFixed'))
+    _flags = Flags(0,Flags.getNames('isScroll','isFixed'))
     melSet = MelSet(
@@ -529,2 +528 @@ class MreBsgn(MelRecord):
     __slots__ = MelRecord.__slots__ + melSet.getSlotsUsed()
-
Wrapping
More records
Wrapping
More records
Wrapping and typos
More records
Bish ?
Wrapping
Finalizing:

- Set litteraals warnings
- (little) wrapping