Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- scn TunaSCMSCScr
- float fSCVer
- ref rThis
- ref rHI
- ref rTgt
- ref rSlv
- ref rDty
- ref rObj
- ref rDSB
- ref rPrs
- ;Catchalls
- ref cWeap
- ref cArmo
- ref cAlch
- ref cMisc
- ref cAmmo
- int iFlg
- int iRtrF
- int iFunc
- int iIdx
- int iFoo
- int iBar
- int iBaz
- float fWgt
- Begin OnActivate
- if TunaSCVRQ.iNVSE
- if rHI == 0
- set rThis to This
- set rTgt to GetFirstRef 27 1 0
- Label 1
- if rTgt.IsScripted
- if rTgt.GetScript == TunaSCHIScr
- if rTgt.GetDisabled == 0
- set rHI to rTgt
- endif
- endif
- endif
- if rHI == 0
- set rTgt to Pencil01
- set rTgt to GetNextRef
- if rTgt
- Goto 1
- endif
- endif
- if rHI == 0
- ; printc "OnActivate Fail! No Homeless Items box for MSC=%n" rThis
- Activate
- return
- endif
- endif
- if GetGameLoaded
- set iFlg to LogicalOr iFlg 16;Set CellEntry
- if fSCVer < TunaSCVRQ.fSCVer
- set iFlg to LogicalOr iFlg 32;Set DoUpdate
- endif
- elseif TunaSCVRQ.rMSC != rThis
- set iFlg to LogicalOr iFlg 16;Set CellEntry
- endif
- set iFlg to LogicalAnd iFlg 2147483640;Clear isPlayer+isRemote+isCatchAll
- if IsActionRef rThis
- set iFunc to TunaSCVRQ.iFunc
- set TunaSCVRQ.iFunc to 0
- set rSlv to TunaSCVRQ.rSlv
- ; printc "MSC Func=%.0f" iFunc
- if iFunc <= 10
- ;Designer
- if iFunc == 5
- set iFlg to LogicalOr iFlg 192;Set DoQBlank+DoDDScan
- elseif iFunc == 6
- set iFlg to LogicalOr iFlg 256;Set DoDDShow
- endif
- elseif iFunc <= 40
- ;11 to 40
- if rSlv.gpc != gpc
- set iFlg to LogicalOr iFlg 2;Set isRemote
- endif
- if iFunc <= 20
- ;MenuS
- if iFunc == 13
- set iFlg to LogicalOr iFlg 8454656;Set DoRead+DoRtrvSlv+DoSort
- elseif iFunc == 18
- set iFlg to LogicalOr iFlg 8192;Set DoWrite
- endif
- else
- ;Slave Container
- if iFunc == 33
- ; printc "MSC - Slave Closing"
- if LogicalAnd iFlg 33554432;Test PrsEnabled
- set iFlg to LogicalOr iFlg 2097152;Set DoSlvOpen
- set rSlv to 0
- else
- return
- endif
- else
- if iFunc == 35
- set iFlg to LogicalOr iFlg 2097152;Set DoSlvOpen
- elseif iFunc == 34
- set iFlg to LogicalOr iFlg 2228224;Set DtySlvLoc+DoSlvOpen
- endif
- if rSlv == cWeap
- set iFlg to LogicalOr iFlg 4;Set isCatchAll
- elseif rSlv == cArmo
- set iFlg to LogicalOr iFlg 4;Set isCatchAll
- elseif rSlv == cAlch
- set iFlg to LogicalOr iFlg 4;Set isCatchAll
- elseif rSlv == cMisc
- set iFlg to LogicalOr iFlg 4;Set isCatchAll
- elseif rSlv == cAmmo
- set iFlg to LogicalOr iFlg 4;Set isCatchAll
- endif
- endif
- endif
- elseif iFunc < 90
- ;41 to 89
- ;General remote calls.Used 44,45,46,50,70,80,81,85
- if iFunc == 80
- set iFlg to LogicalOr iFlg 2097152;Set DoSlvOpen
- set rSlv to 0
- ; elseif iFunc == 81;Make quest up to date
- elseif iFunc == 85
- set iFlg to LogicalOr iFlg 8388608;Set DoSort
- elseif iFunc <= 50
- ;Prs routines. 45 - Register rPrs from rSlv. 46/7 MenuM Enable/Disable. 50 - Perk grab. ref of clicked item in TunaSCVRQ.rObj
- if iFunc == 50
- set iFlg to LogicalOr iFlg 134217728;Set PerkGrab
- elseif iFunc == 45
- set rPrs to rSlv
- return
- elseif iFunc == 46
- set iFlg to LogicalOr iFlg 100663296;Set PrsEnabled+PrsChanged
- elseif iFunc == 47
- set iFlg to LogicalOr iFlg 67108864;Set PrsChanged
- set iFlg to LogicalAnd iFlg 2113929215;Clear PrsEnabled
- elseif iFunc == 44
- ;DOB completion callback
- if rDSB.GetNumItems == 0
- rDSB.MarkForDelete
- set rDSB to 0
- endif
- set iFlg to LogicalOr iFlg 32768;Set DtyDSB
- endif
- elseif iFunc == 70
- set iFlg to LogicalXor iFlg 1073741824;Toggle One-Touch
- return
- endif
- elseif iFunc < 100
- ;90 to 99
- ;General remote calls.Used 90,91,92-96,99
- if iFunc == 99
- set iRtrF to TunaSCVRQ.bBtn0
- if LogicalAnd iRtrF 4;Test DoOTF
- set iFlg to LogicalOr iFlg 262144;Set DoOTF
- endif
- elseif iFunc == 90
- if rDSB == 0
- set rDSB to PlaceAtMe TunaSCDSB
- rDSB.Disable
- if rDSB == 0
- ; printc "MSC Fail! No Spawned DSB"
- return
- endif
- endif
- set TunaSCVRQ.rSlv to rThis
- set TunaSCVRQ.rObj to rDSB
- set TunaSCVRQ.iSlvM to 5
- PlaceAtMe TunaSCDOB
- return
- elseif iFunc == 91
- if rDSB
- if rDSB.IsFormValid
- rDSB.MarkForDelete
- endif
- set rDSB to 0
- endif
- set iFlg to LogicalOr iFlg 32768;Set DtyDSB
- elseif iFunc < 97
- ;92 - 96 via MenuM
- if rDSB
- set iRtrF to 1072693272;Set ForgetMem+MoveToHI+EFL*
- else
- set iRtrF to 9;Set Everything+ForgetMem
- endif
- if iFunc == 92
- set iRtrF to LogicalOr iRtrF 128;Set Sort
- elseif iFunc == 93
- set iFlg to LogicalOr iFlg 64;Set DoQBlank
- set iRtrF to LogicalOr iRtrF 16;Set MoveToHI
- elseif iFunc == 94
- set iFlg to LogicalOr iFlg 2048;Set DStoDD
- set iRtrF to LogicalOr iRtrF 128;Set Sort
- endif
- endif
- endif
- elseif IsActionRef player
- if TunaSCVRQ.iFunc == 200
- return
- endif
- set iFlg to LogicalOr iFlg 1;Set isPlayer
- set iFunc to 0
- set rSlv to 0
- set TunaSCVRQ.rSlv to 0
- set iFoo to GetControl 27;Grab
- if player.IsSneaking
- set iFlg to LogicalOr iFlg 17039360;Set DoOTF+DoMenu
- elseif IsKeyPressed iFoo
- set iFlg to LogicalOr iFlg 17039360;Set DoOTF+DoMenu
- elseif LogicalAnd iFlg 1073741824 == 0;Test One-Touch
- set iFlg to LogicalOr iFlg 17039360;Set DoOTF+DoMenu
- endif
- else
- return
- endif
- if LogicalAnd iFlg 16;Test CellEntry
- set iFlg to LogicalAnd iFlg 2147483631;Clear CellEntry
- if GetHasNote TunaSCHlp == 0
- AN TunaSCHlp
- endif
- set TunaSCVRQ.iPSt to 0
- if LogicalAnd iFlg 33554432;Test PrsEnabled
- if rPrs.IsFormValid == 0
- set iFlg to LogicalAnd iFlg 1107296255;Clear PrsEnabled+PrsChanged+PerkGrab+DoPerkList+DoFormLists
- set rPrs to 0
- endif
- endif
- if TunaSCVRQ.rMSC != rThis
- set TunaSCVRQ.rMSC to rThis
- set TunaSCVRQ.rHI to rHI
- set TunaSCVRQ.rRCell1 to gpc
- set TunaSCVRQ.rRCell2 to 0
- set TunaSCVRQ.rRCell3 to 0
- set TunaSCVRQ.iStt to 10
- if LogicalAnd iFlg 33554432;Test PrsEnabled
- set iFlg to LogicalOr iFlg 268435456;Set DoPerkList
- endif
- endif
- if rThis != ListGetNthForm TunaSCOwner 0
- ListRemoveNth TunaSCOwner 0
- ListAddRef TunaSCOwner 0
- set iFlg to LogicalOr iFlg 4882432;Set DtyDSB+DtySlvLoc+DtyOTF+DtyArrays
- set iFlg to LogicalAnd iFlg 2146435071;Clear DoMemWipe
- SetStage TunaSCFRQ 4
- if LogicalAnd iFlg 33554432;Test PrsEnabled
- set iFlg to LogicalOr iFlg 536870912;Set DoFormLists
- endif
- endif
- endif
- if TunaSCVRQ.iStt > 1
- if TunaSCVRQ.iStt == 2
- set iFlg to LogicalOr iFlg 512;Set DoRead
- elseif TunaSCVRQ.iStt == 3
- set iFlg to LogicalOr iFlg 4608;Set DoRead+DoEnabled
- elseif TunaSCVRQ.iStt > 3
- set iFlg to LogicalOr iFlg 8192;Set DoWrite
- endif
- endif
- if LogicalAnd iFlg 32736;Test DoUpdate+DoQBlank+DoDDScan+DoDDShow+DoRead+DDtoDS+DStoDD+DoEnabled+DoWrite+DoCache
- if LogicalAnd iFlg 32;Test DoUpdate
- if fSCVer == 0.0
- ;Cell has never been used.
- set iFlg to LogicalOr iFlg 192;Set DoQBlank+DoDDScan
- if iFunc != 5
- set iFlg to LogicalOr iFlg 256;Set DoDDShow
- endif
- endif
- set fSCVer to TunaSCVRQ.fSCVer
- endif
- if LogicalAnd iFlg 64;Test DoQBlank
- set iFlg to LogicalOr iFlg 16896;Set DoRead+DoCache
- SetStage TunaSCFRQ 15
- endif
- if LogicalAnd iFlg 128;Test DoDDScan
- set iBar to TunaSCVRQ.iSlvM
- set rTgt to GetFirstRef 27 1 0
- Label 1
- if rTgt.IsScripted
- if rTgt.GetScript == TunaSCSlvScr
- set iFoo to rTgt.GetWeight
- if iFoo
- if LogicalAND iFoo 1
- rTgt.SetWeight 0.0
- else
- set TunaSCVRQ.rSlv to rTgt
- set TunaSCVRQ.iSlvM to iFoo
- SetStage TunaSCFRQ 5
- endif
- endif
- endif
- endif
- set rTgt to Pencil01
- set rTgt to GetNextRef
- if rTgt
- Goto 1
- endif
- set TunaSCVRQ.rSlv to rSlv
- set TunaSCVRQ.iSlvM to iBar
- endif
- if LogicalAnd iFlg 256;Test DoDDShow
- if iFunc == 6
- SetStage TunaSCFRQ 7
- endif
- ;Set Q.iHasDD
- SetStage TunaSCFRQ 6
- if TunaSCVRQ.iHasDD
- ; printc "=== MSC - Designer Defaults Loaded"
- SetStage TunaSCFRQ 11
- set iFlg to LogicalOr iFlg 1536;Set DoRead+DDtoDS
- else
- ; printc "MSC - No Designer Defaults Set"
- endif
- endif
- if LogicalAnd iFlg 512;Test DoRead
- set iFlg to LogicalAnd iFlg 2147475455;Clear DoWrite
- set iFlg to LogicalOr iFlg 16384;Set DoCache
- if TunaSCVRQ.iStt > 1
- set TunaSCVRQ.iStt to 1
- endif
- set TunaSCVRQ.iFunc to 1
- rHI.Activate rHI 1
- endif
- if LogicalAnd iFlg 1024;Test DDtoDS
- set iFlg to LogicalOr iFlg 4096;Set DoEnabled
- set TunaSCVRQ.iFunc to 2
- rHI.Activate rHI 1
- endif
- if LogicalAnd iFlg 2048;Test DStoDD
- set iFlg to LogicalOr iFlg 4096;Set DoEnabled
- set TunaSCVRQ.iFunc to 3
- rHI.Activate rHI 1
- endif
- if LogicalAnd iFlg 4096;Test DoEnabled
- set iFlg to LogicalOr iFlg 24576;Set DoWrite+DoCache
- set TunaSCVRQ.iFunc to 4
- rHI.Activate rHI 1
- endif
- if LogicalAnd iFlg 8192;Test DoWrite
- set TunaSCVRQ.iFunc to 5
- rHI.Activate rHI 1
- endif
- if LogicalAnd iFlg 16384;Test DoCache
- set iFlg to LogicalOr iFlg 4194304;Set DtyArrays
- set cWeap to TunaSCVRQ.cWeap
- set cArmo to TunaSCVRQ.cArmo
- set cAlch to TunaSCVRQ.cAlch
- set cMisc to TunaSCVRQ.cMisc
- set cAmmo to TunaSCVRQ.cAmmo
- endif
- set iFlg to LogicalAnd iFlg 2147450911;Clear DoUpdate+DoQBlank+DoDDScan+DoDDShow+DoRead+DDtoDS+DStoDD+DoEnabled+DoWrite+DoCache
- endif
- ;All vars in MSC, HI and Quest should be valid.
- if iRtrF
- set iFlg to LogicalOr iFlg 512;Set DoRead
- endif
- if LogicalAnd iFlg 1017184769 == 0;Test isPlayer+DoRead+DoRtrvSlv+DoSlvOpen+DoSort+PrsChanged+PerkGrab+DoPerkList+DoFormLists
- return
- endif
- if LogicalAnd iFlg 98304;Test DtyDSB+DoRtrvSlv
- if LogicalAnd iFlg 32768;Test DtyDSB
- Label 1
- if ListGetCount TunaSCEFLS
- ListRemoveNth TunaSCEFLS 0
- Goto 1
- endif
- if rDSB
- if rDSB.IsFormValid
- set iIdx to rDSB.GetNumItems
- Label 1
- if iIdx
- set iIdx to iIdx - 1
- set rObj to rDSB.GetInventoryObject iIdx
- ListAddForm TunaSCEFLS rObj
- Goto 1
- endif
- else
- set rDSB to 0
- endif
- endif
- endif
- if LogicalAnd iFlg 65536;Test DoRtrvSlv
- set iFlg to LogicalOr iFlg 1048576;Set DoMemWipe
- if rDSB
- if rSlv.GetItemCount TunaSCEFLS
- ;Must Avoid Specials
- rSlv.RemoveAllTypedItems rThis 1 1 40 TunaSCEFLS
- rSlv.RemoveAllTypedItems rThis 1 1 24 TunaSCEFLS
- rSlv.RemoveAllTypedItems rThis 1 1 47 TunaSCEFLS
- rSlv.RemoveAllTypedItems rThis 1 1 31 TunaSCEFLS
- rSlv.RemoveAllTypedItems rThis 1 1 41 TunaSCEFLS
- rSlv.RemoveAllTypedItems rThis 1 1 25 TunaSCEFLS
- rSlv.RemoveAllTypedItems rThis 1 1 103 TunaSCEFLS
- rSlv.RemoveAllTypedItems rThis 1 1 108 TunaSCEFLS
- rSlv.RemoveAllTypedItems rThis 1 1 116 TunaSCEFLS
- else
- ;nothing needs avoiding.
- rSlv.RemoveAllItems rThis 1
- endif
- else
- rSlv.RemoveAllItems rThis 1
- endif
- endif
- set iFlg to LogicalAnd iFlg 2147385343;Clear DtyDSB+DoRtrvSlv
- endif
- if LogicalAnd iFlg 2;Test isRemote
- return
- endif
- if LogicalAnd iFlg 1017119233 == 0;Test isPlayer+DoRead+DoSlvOpen+DoSort+PrsChanged+PerkGrab+DoPerkList+DoFormLists
- return
- endif
- ;The array of local slaves. This will remake the FL's
- ;Used in menuM for retrieving. Initialising Memory, and for iRtrF
- if LogicalAnd iFlg 131072;Test DtySlvLoc
- set iFlg to LogicalAnd iFlg 2147352575;Clear DtySlvLoc
- Label 1
- if ListGetCount TunaSCSlvCrft
- ListRemoveNth TunaSCSlvCrft 0
- Goto 1
- endif
- Label 1
- if ListGetCount TunaSCSlv
- ListRemoveNth TunaSCSlv 0
- Goto 1
- endif
- set rTgt to GetFirstRef 27 1 0
- if rTgt.gpc == gpc
- set iBar to 0
- else
- set iBar to 2
- endif
- Label 1
- if rTgt.IsScripted
- if rTgt.GetScript == TunaSCSlvScr
- if rTgt.GetDisabled
- ;Slave Flags: 1 BitMode, 2 Remote, 4 Disabled
- ;set TunaSCVRQ.iFunc to (1 + iBar + 4)
- set TunaSCVRQ.iFunc to (5 + iBar)
- else
- set TunaSCVRQ.iFunc to (1+ iBar)
- set iFoo to rTgt.GetWeight
- if iFoo
- if iFoo > 301
- if iFoo < 331
- rTgt.ListAddRef TunaSCSlvCrft
- endif
- endif
- endif
- rTgt.ListAddRef TunaSCSlv
- endif
- if rTgt != TunaSCVRQ.rSlv
- rTgt.Activate rTgt 1
- endif
- endif
- endif
- set rTgt to Pencil01
- set rTgt to GetNextRef
- if rTgt
- Goto 1
- endif
- set TunaSCVRQ.iFunc to 0
- endif
- if LogicalAnd iFlg 262144;Test DoOTF
- if LogicalAnd iFlg 524288;Test DtyOTF
- set rTgt to GetFirstRef 27 1 0
- Label 1
- set iIdx to rTgt.GetNumItems
- Label 2
- if iIdx
- set iIdx to iIdx - 1
- set rObj to rTgt.GetInventoryObject iIdx
- set iFoo to GetType rObj
- if iFoo == 40
- if ListGetFormIndex TunaSCScnWeap rObj < 0
- ListAddForm TunaSCScnWeap rObj
- set iBaz to GetWeaponSkill rObj
- if iBaz == 45
- ListAddForm TunaSCDSWeapFist rObj
- elseif iBaz == 38
- ListAddForm TunaSCDSWeapMele rObj
- elseif iBaz == 41
- ListAddForm TunaSCDSWeapGuns rObj
- elseif iBaz == 34
- ListAddForm TunaSCDSWeapNRG rObj
- elseif iBaz == 35
- ListAddForm TunaSCDSWeapExpl rObj
- endif
- endif
- elseif iFoo == 24
- if ListGetFormIndex TunaSCScnArmo rObj < 0
- ListAddForm TunaSCScnArmo rObj
- if IsPA rObj
- ListAddForm TunaSCDSArmoPwr rObj
- endif
- if GetEquipType rObj == 8
- ListAddForm TunaSCDSArmoHead rObj
- else
- set fWgt to GetWeight rObj
- if fWgt > 0
- if GetArmorDT rObj <= 2
- ListAddForm TunaSCDSArmoClot rObj
- elseif fWgt <= 15.0
- ListAddForm TunaSCDSArmoLgt rObj
- elseif fWgt < 30.0
- ListAddForm TunaSCDSArmoMed rObj
- else
- ListAddForm TunaSCDSArmoHvy rObj
- endif
- endif
- endif
- endif
- elseif iFoo == 47
- if ListGetFormIndex TunaSCScnAlch rObj < 0
- ListAddForm TunaSCScnAlch rObj
- set iBaz to GetEquipType rObj
- if iBaz == 10
- ListAddForm TunaSCDSAlchChem rObj
- elseif iBaz == 11
- ListAddForm TunaSCDSAlchAid rObj
- elseif iBaz == 12
- ListAddForm TunaSCDSAlchFood rObj
- elseif iBaz == 13
- ListAddForm TunaSCDSAlchAlco rObj
- endif
- endif
- endif
- Goto 2
- endif
- set rTgt to Pencil01
- set rTgt to GetNextRef
- if rTgt
- Goto 1
- endif
- endif
- set iFlg to LogicalAnd iFlg 2146697215;Clear DoOTF+DtyOTF
- endif
- if iRtrF
- set iFlg to LogicalAnd iFlg 2147483135;Clear DoRead
- if LogicalAnd iRtrF 1;Test Everything
- set iIdx to ListGetCount TunaSCSlv
- Label 1
- if iIdx
- set iIdx to iIdx - 1
- set rTgt to ListGetNthForm TunaSCSlv iIdx
- rTgt.RemoveAllItems rThis 1
- Goto 1
- endif
- rHI.RemoveAllItems rThis 1
- if LogicalAnd iRtrF 8;Test ForgetMem
- ; if LogicalAnd iFlg 33554432;Test PrsEnabled
- ; set iFlg to LogicalOr iFlg 1048576;Set DoMemWipe
- ; else
- set iFlg to LogicalAnd iFlg 2146435071;Clear DoMemWipe
- SetStage TunaSCFRQ 4
- ListAddRef TunaSCMem
- set rDty to 0
- ; endif
- endif
- else;!Everything
- ;Clear Homeless boxes when it makes sense
- if cWeap
- if LogicalAnd iRtrF 1074791424;Test FiltWeap+EFLWeap+UseMem
- cWeap.RemoveAllItems rHI 1
- endif
- endif
- if cArmo
- if LogicalAnd iRtrF 1075841024;Test FiltArmo+EFLArmo+UseMem
- cArmo.RemoveAllItems rHI 1
- endif
- endif
- if cAlch
- if LogicalAnd iRtrF 1077940224;Test FiltAlch+EFLAlch+UseMem
- cAlch.RemoveAllItems rHI 1
- endif
- endif
- if cMisc
- if LogicalAnd iRtrF 1082138624;Test FiltMisc+EFLMisc+UseMem
- cMisc.RemoveAllItems rHI 1
- endif
- endif
- if cAmmo
- if LogicalAnd iRtrF 1090535424;Test FiltAmmo+EFLAmmo+UseMem
- cAmmo.RemoveAllItems rHI 1
- endif
- endif
- if LogicalAnd iRtrF 2;Test UseTmp
- set rSlv to TunaSCTmp
- endif
- if LogicalAnd iRtrF 1073741824;Test UseMem
- set iIdx to ListGetCount rSlv
- Label 1
- if iIdx
- set iIdx to iIdx - 1
- set rObj to ListGetNthForm rSlv iIdx
- set iFoo to ListGetFormIndex TunaSCMem rObj
- if iFoo > -1
- ;Found in mem - increase iFoo until we find a locker ref
- set iBar to ListGetCount TunaSCMem
- Label 2
- set iFoo to iFoo + 1
- if iFoo < iBar
- set rTgt to ListGetNthForm TunaSCMem iFoo
- if GetType rTgt == 27
- set iBaz to rTgt.GetItemCount rObj
- if iBaz
- AddItem rObj iBaz 1
- rTgt.RemoveItem rObj iBaz 1
- set iBar to 0
- endif
- endif
- Goto 2
- endif
- else
- set iBaz to rHI.GetItemCount rObj
- if iBaz
- AddItem rObj iBaz 1
- rHI.RemoveItem rObj iBaz 1
- endif
- endif
- Goto 1
- endif
- elseif LogicalAnd iRtrF 1073740800;Test Filt* & EFL Masks
- RemoveAllItems rHI 1
- ;Whole Category
- set iFoo to LogicalAnd iRtrF 1072693248;EFL* Mask
- if iFoo
- set iFoo to RightShift iFoo 20
- set iBaz to iFoo
- endif
- ;Filtered
- set iBar to LogicalAnd iRtrF 1047552;Filt* Mask
- if iBar
- set iBar to RightShift iBar 10
- ;don't do filtered of those done by cat
- set iBaz to LogicalXor 2147483647 iFoo;Bug workaround for "LogicalNot iFoo"
- set iBar to LogicalAnd iBar iBaz
- ;common to filtered and by cat.
- set iBaz to LogicalOr iFoo iBar
- endif
- ;Loop containers - Cats
- if iFoo
- set iIdx to ListGetCount TunaSCSlv
- Label 1
- if iIdx
- set iIdx to iIdx - 1
- set rTgt to ListGetNthForm TunaSCSlv iIdx
- if LogicalAnd iFoo 1
- rTgt.RemoveAllTypedItems rThis 1 1 40 TunaSCEFLS
- endif
- if LogicalAnd iFoo 2
- rTgt.RemoveAllTypedItems rThis 1 1 24 TunaSCEFLS
- endif
- if LogicalAnd iFoo 4
- rTgt.RemoveAllTypedItems rThis 1 1 47 TunaSCEFLS
- endif
- if LogicalAnd iFoo 8
- rTgt.RemoveAllTypedItems rThis 1 1 31 TunaSCEFLS
- endif
- if LogicalAnd iFoo 16
- rTgt.RemoveAllTypedItems rThis 1 1 41 TunaSCEFLS
- endif
- if LogicalAnd iFoo 32
- rTgt.RemoveAllTypedItems rThis 1 1 25 TunaSCEFLS
- endif
- if LogicalAnd iFoo 64
- rTgt.RemoveAllTypedItems rThis 1 1 103 TunaSCEFLS
- endif
- if LogicalAnd iFoo 128
- rTgt.RemoveAllTypedItems rThis 1 1 108 TunaSCEFLS
- endif
- if LogicalAnd iFoo 256
- rTgt.RemoveAllTypedItems rThis 1 1 116 TunaSCEFLS
- endif
- Goto 1
- endif
- endif;cat
- ;Loop containers - Filtered
- if iBar
- set iIdx to ListGetCount TunaSCSlv
- Label 1
- if iIdx
- set iIdx to iIdx - 1
- set rTgt to ListGetNthForm TunaSCSlv iIdx
- if rTgt.GetItemCount rSlv
- if LogicalAnd iBar 1
- rTgt.RemoveAllTypedItems rThis 1 1 40 TunaSCEFLS
- RemoveAllTypedItems rTgt 1 1 40 rSlv
- endif
- if LogicalAnd iBar 2
- rTgt.RemoveAllTypedItems rThis 1 1 24 TunaSCEFLS
- RemoveAllTypedItems rTgt 1 1 24 rSlv
- endif
- if LogicalAnd iBar 4
- rTgt.RemoveAllTypedItems rThis 1 1 47 TunaSCEFLS
- RemoveAllTypedItems rTgt 1 1 47 rSlv
- endif
- if LogicalAnd iBar 8
- rTgt.RemoveAllTypedItems rThis 1 1 31 TunaSCEFLS
- RemoveAllTypedItems rTgt 1 1 31 rSlv
- endif
- if LogicalAnd iBar 16
- rTgt.RemoveAllTypedItems rThis 1 1 41 TunaSCEFLS
- RemoveAllTypedItems rTgt 1 1 41 rSlv
- endif
- if LogicalAnd iBar 32
- rTgt.RemoveAllTypedItems rThis 1 1 25 TunaSCEFLS
- RemoveAllTypedItems rTgt 1 1 25 rSlv
- endif
- if LogicalAnd iBar 64
- rTgt.RemoveAllTypedItems rThis 1 1 103 TunaSCEFLS
- RemoveAllTypedItems rTgt 1 1 103 rSlv
- endif
- if LogicalAnd iBar 128
- rTgt.RemoveAllTypedItems rThis 1 1 108 TunaSCEFLS
- RemoveAllTypedItems rTgt 1 1 108 rSlv
- endif
- if LogicalAnd iBar 256
- rTgt.RemoveAllTypedItems rThis 1 1 116 TunaSCEFLS
- RemoveAllTypedItems rTgt 1 1 116 rSlv
- endif
- endif
- Goto 1
- endif
- endif;filter
- if LogicalAnd iRtrF 16 == 0;Test MoveToHI unset
- ;Common Post
- if LogicalAnd iBaz 1
- rHI.RemoveAllTypedItems rThis 1 1 40 TunaSCEFL
- endif
- if LogicalAnd iBaz 2
- rHI.RemoveAllTypedItems rThis 1 1 24 TunaSCEFL
- endif
- if LogicalAnd iBaz 4
- rHI.RemoveAllTypedItems rThis 1 1 47 TunaSCEFL
- endif
- if LogicalAnd iBaz 8
- rHI.RemoveAllTypedItems rThis 1 1 31 TunaSCEFL
- endif
- if LogicalAnd iBaz 16
- rHI.RemoveAllTypedItems rThis 1 1 41 TunaSCEFL
- endif
- if LogicalAnd iBaz 32
- rHI.RemoveAllTypedItems rThis 1 1 25 TunaSCEFL
- endif
- if LogicalAnd iBaz 64
- rHI.RemoveAllTypedItems rThis 1 1 103 TunaSCEFL
- endif
- if LogicalAnd iBaz 128
- rHI.RemoveAllTypedItems rThis 1 1 108 TunaSCEFL
- endif
- if LogicalAnd iBaz 256
- rHI.RemoveAllTypedItems rThis 1 1 116 TunaSCEFL
- endif
- if iBar
- ;Filter post
- if LogicalAnd iBar 1
- RemoveAllTypedItems rHI 1 1 40 rSlv
- endif
- if LogicalAnd iBar 2
- RemoveAllTypedItems rHI 1 1 24 rSlv
- endif
- if LogicalAnd iBar 4
- RemoveAllTypedItems rHI 1 1 47 rSlv
- endif
- if LogicalAnd iBar 8
- RemoveAllTypedItems rHI 1 1 31 rSlv
- endif
- if LogicalAnd iBar 16
- RemoveAllTypedItems rHI 1 1 41 rSlv
- endif
- if LogicalAnd iBar 32
- RemoveAllTypedItems rHI 1 1 25 rSlv
- endif
- if LogicalAnd iBar 64
- RemoveAllTypedItems rHI 1 1 103 rSlv
- endif
- if LogicalAnd iBar 128
- RemoveAllTypedItems rHI 1 1 108 rSlv
- endif
- if LogicalAnd iBar 256
- RemoveAllTypedItems rHI 1 1 116 rSlv
- endif
- endif
- endif;!MoveToHI
- if LogicalAnd iRtrF 8;Test ForgetMem
- set iFlg to LogicalOr iFlg 1048576;Set DoMemWipe
- endif
- endif;by cat & filter
- if LogicalAnd iRtrF 34 == 2;Test UseTmp == 1 && LeaveTmp == 0
- Label 1
- if ListGetCount TunaSCTmp
- ListRemoveNth TunaSCTmp 0
- Goto 1
- endif
- endif
- endif;!Everything
- if LogicalAnd iRtrF 16;Test MoveToHI
- RemoveAllItems rHI 1
- elseif LogicalAnd iRtrF 64;Test OpenMSC
- set iRtrF to 0
- SetStage TunaSCFRQ 200
- return
- endif
- ;The Sort would stomp on TunaSCTmp
- if LogicalAnd iRtrF 160 == 128;Test Sort == 1 && LeaveTmp == 0
- set iFlg to LogicalOr iFlg 8388608;Set DoSort
- endif
- set iRtrF to 0
- endif
- if LogicalAnd iFlg 1017118721 == 0;Test isPlayer+DoSlvOpen+DoSort+PrsChanged+PerkGrab+DoPerkList+DoFormLists
- return
- endif
- if LogicalAnd iFlg 1048576;Test DoMemWipe
- set iFlg to LogicalAnd iFlg 2146435071;Clear DoMemWipe
- SetStage TunaSCFRQ 4
- endif
- if ListGetCount TunaSCMem == 0
- set rDty to 0
- if LogicalAnd iFlg 4;Test isCatchAll
- return
- endif
- set iFoo to ListGetCount TunaSCSlv
- Label 1
- if iFoo
- set iFoo to iFoo - 1
- set rTgt to ListGetNthForm TunaSCSlv iFoo
- if rTgt == cWeap
- Goto 1
- elseif rTgt == cArmo
- Goto 1
- elseif rTgt == cAlch
- Goto 1
- elseif rTgt == cMisc
- Goto 1
- elseif rTgt == cAmmo
- Goto 1
- endif
- set iBaz to 0
- set iIdx to rTgt.GetNumItems
- Label 2
- if iIdx
- set iIdx to iIdx - 1
- set rObj to rTgt.GetInventoryObject iIdx
- set iBar to GetType rObj
- if iBar == 24
- set iBaz to LogicalOr iBaz 4;Set AddArmo
- ListAddForm TunaSCMem2 rObj
- elseif iBar == 40
- if ListGetFormIndex TunaSCDSWeapThrw rObj > -1
- set iBaz to LogicalOr iBaz 1;Set AddMain
- ListAddForm TunaSCMem rObj
- else
- set iBaz to LogicalOr iBaz 2;Set AddWeap
- ListAddForm TunaSCMem1 rObj
- endif
- else
- set iBaz to LogicalOr iBaz 1;Set AddMain
- ListAddForm TunaSCMem rObj
- endif
- Goto 2
- endif
- if LogicalAnd iBaz 1;Test AddMain
- rTgt.ListAddRef TunaSCMem
- endif
- if LogicalAnd iBaz 2;Test AddWeap
- rTgt.ListAddRef TunaSCMem1
- endif
- if LogicalAnd iBaz 4;Test AddArmo
- rTgt.ListAddRef TunaSCMem2
- endif
- Goto 1
- endif
- if ListGetCount TunaSCMem == 0
- ListAddRef TunaSCMem
- endif
- if LogicalAnd iFlg 33554432;Test PrsEnabled
- set iFlg to LogicalOr iFlg 32;Set DoUpdate
- endif
- endif
- if rDty
- if LogicalAnd iFlg 8;Test DtyCatchAll
- set iIdx to rDty.GetNumItems
- Label 1
- if iIdx
- set iIdx to iIdx - 1
- set rObj to rDty.GetInventoryObject iIdx
- set iFoo to GetType rObj
- if iFoo == 24
- ListRemoveForm TunaSCMem2 rObj
- elseif iFoo == 40
- if ListGetFormIndex TunaSCDSWeapThrw rObj > -1
- ListRemoveForm TunaSCMem rObj
- else
- ListRemoveForm TunaSCMem1 rObj
- endif
- else
- ListRemoveForm TunaSCMem rObj
- endif
- Goto 1
- endif
- else
- set iIdx to rDty.GetNumItems
- Label 1
- if iIdx
- set iIdx to iIdx - 1
- set rObj to rDty.GetInventoryObject iIdx
- set iFoo to GetType rObj
- if iFoo == 24
- ListRemoveForm TunaSCMem2 rObj
- ListAddForm TunaSCTmp2 rObj
- elseif iFoo == 40
- if ListGetFormIndex TunaSCDSWeapThrw rObj > -1
- ListRemoveForm TunaSCMem rObj
- ListAddForm TunaSCTmp rObj
- else
- ListRemoveForm TunaSCMem1 rObj
- ListAddForm TunaSCTmp1 rObj
- endif
- else
- ListRemoveForm TunaSCMem rObj
- ListAddForm TunaSCTmp rObj
- endif
- Goto 1
- endif
- if ListGetCount TunaSCTmp
- ;Find out if a reference to thisbox is already in the formlist... and grab its index
- set iBar to -1
- set iIdx to ListGetCount TunaSCMem
- Label 1
- if iIdx
- set iIdx to iIdx - 1
- set rObj to ListGetNthForm TunaSCMem iIdx
- if GetType rObj == 27
- ;Found a locker reference
- if rObj == rDty
- set iBar to iIdx
- set iIdx to 0
- endif
- endif
- Goto 1
- endif
- if iBar < 0
- ;Add this locker to front of the list
- set iBar to 0
- rDty.ListAddRef TunaSCMem 0
- endif
- ;Add all the Objects to this lockers record
- Label 1
- set rObj to ListRemoveNth TunaSCTmp 0
- ListAddForm TunaSCMem rObj iBar
- if ListGetCount TunaSCTmp
- Goto 1
- endif
- endif
- if ListGetCount TunaSCTmp1
- set iBar to -1
- set iIdx to ListGetCount TunaSCMem1
- Label 1
- if iIdx
- set iIdx to iIdx - 1
- set rObj to ListGetNthForm TunaSCMem1 iIdx
- if GetType rObj == 27
- if rObj == rDty
- set iBar to iIdx
- set iIdx to 0
- endif
- endif
- Goto 1
- endif
- if iBar < 0
- set iBar to 0
- rDty.ListAddRef TunaSCMem1 0
- endif
- Label 1
- set rObj to ListRemoveNth TunaSCTmp1 0
- ListAddForm TunaSCMem1 rObj iBar
- if ListGetCount TunaSCTmp1
- Goto 1
- endif
- endif
- if ListGetCount TunaSCTmp2
- set iBar to -1
- set iIdx to ListGetCount TunaSCMem2
- Label 1
- if iIdx
- set iIdx to iIdx - 1
- set rObj to ListGetNthForm TunaSCMem2 iIdx
- if GetType rObj == 27
- if rObj == rDty
- set iBar to iIdx
- set iIdx to 0
- endif
- endif
- Goto 1
- endif
- if iBar < 0
- set iBar to 0
- rDty.ListAddRef TunaSCMem2 0
- endif
- Label 1
- set rObj to ListRemoveNth TunaSCTmp2 0
- ListAddForm TunaSCMem2 rObj iBar
- if ListGetCount TunaSCTmp2
- Goto 1
- endif
- endif
- endif
- if LogicalAnd iFlg 33554432;Test PrsEnabled
- set iFlg to LogicalOr iFlg 128;Set DoDDScan
- set TunaSCVRQ.rRCell2 to rDty
- endif
- set rDty to 0
- endif
- ;rPrs Calls
- if LogicalAnd iFlg 33554432;Test PrsEnabled
- if LogicalAnd iFlg 1015021728;Test DoUpdate+DoDDScan+DoSort+PrsChanged+PerkGrab+DoPerkList+DoFormLists
- set TunaSCVRQ.iSlvM to iFlg
- if LogicalAnd iFlg 134217728;Test PerkGrab
- set iFlg to LogicalAnd iFlg 1140850527;Clear DoUpdate+DoDDScan+PrsChanged+PerkGrab+DoPerkList+DoFormLists
- set TunaSCVRQ.rSlv to rPrs
- set TunaSCVRQ.iFunc to 450
- SetStage TunaSCFRQ 201
- return
- else
- set iFlg to LogicalAnd iFlg 1140850527;Clear DoUpdate+DoDDScan+PrsChanged+PerkGrab+DoPerkList+DoFormLists
- set TunaSCVRQ.iFunc to 50
- rPrs.Activate rPrs 1
- endif
- endif
- endif
- if LogicalAnd iFlg 2097152;Test DoSlvOpen
- ; printc "DoSlvOpen"
- set rDty to rSlv
- if LogicalAnd iFlg 4;Test isCatchAll
- set iFlg to LogicalOr iFlg 8;Set DtyCatchAll
- set iFlg to LogicalAnd iFlg 2145386495;Clear DoSlvOpen
- else
- set iFlg to LogicalAnd iFlg 2145386487;Clear DtyCatchAll+DoSlvOpen
- endif
- if rSlv
- ;User may add new items
- set iFlg to LogicalOr iFlg 524288;Set DtyOTF
- endif
- return
- endif
- if LogicalAnd iFlg 8388608;Test DoSort
- if LogicalAnd iFlg 4194304;Test DtyArrays
- set TunaSCVRQ.iFunc to 9
- rHI.Activate rHI 1
- endif
- set iFlg to LogicalAnd iFlg 2134900735;Clear DtyArrays+DoSort
- set TunaSCVRQ.iFunc to 20
- rHI.Activate rHI 1
- endif
- if LogicalAnd iFlg 1 == 0;Test !isPlayer
- return
- endif
- if LogicalAnd iFlg 16777216;Test DoMenu
- set iFlg to LogicalAnd iFlg 2130706431;Clear DoMenu
- if rDSB
- set TunaSCVRQ.iIdx to 1
- set TunaSCVRQ.rObj to rDSB
- else
- set TunaSCVRQ.iIdx to 0
- endif
- if rPrs
- if LogicalAnd iFlg 33554432;Test PrsEnabled
- set TunaSCVRQ.bBtn1 to 2
- else
- set TunaSCVRQ.bBtn1 to 1
- endif
- else
- set TunaSCVRQ.bBtn1 to 0
- endif
- player.AddItem TunaSCMenuMTok 1 1
- return
- endif
- endif
- Activate
- End
- Begin OnClose
- if TunaSCVRQ.iNVSE
- if rHI == 0
- return
- endif
- if LogicalAnd iFlg 4194304;Test DtyArrays
- set TunaSCVRQ.iFunc to 9
- rHI.Activate rHI 1
- endif
- if LogicalAnd iFlg 33554432;Test PrsEnabled
- set TunaSCVRQ.iFunc to 51
- rPrs.Activate rPrs 1
- endif
- set iFlg to LogicalAnd iFlg 2134900735;Clear DtyArrays+DoSort
- set TunaSCVRQ.iFunc to 20
- rHI.Activate rHI 1
- endif
- End
- Begin OnLoad
- if TunaSCVRQ.iNVSE
- set iFlg to LogicalOr iFlg 16;Set CellEntry
- if TunaSCVRQ.fSCVer > fSCVer
- set iFlg to LogicalOr iFlg 32;Set DoUpdate
- endif
- endif
- End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement