forked from Sairion350/OBody
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOBodyScript.psc
More file actions
134 lines (106 loc) · 2.88 KB
/
OBodyScript.psc
File metadata and controls
134 lines (106 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
ScriptName OBodyScript extends Quest
import outils
bool Property ORefitEnabled
bool Function Get()
Return (Game.GetFormFromFile(0x001802, "OBody.esp") as GlobalVariable).GetValueInt() == 1
EndFunction
EndProperty
bool Property NippleRandEnabled
bool Function Get()
Return (Game.GetFormFromFile(0x001803, "OBody.esp") as GlobalVariable).GetValueInt() == 1
EndFunction
EndProperty
bool Property GenitalRandEnabled
bool Function Get()
Return (Game.GetFormFromFile(0x001804, "OBody.esp") as GlobalVariable).GetValueInt() == 1
EndFunction
EndProperty
int Property PresetKey
int Function Get()
Return (Game.GetFormFromFile(0x001805, "OBody.esp") as GlobalVariable).GetValueInt()
EndFunction
EndProperty
Actor PlayerRef
Actor Property TargetOrPlayer
Actor Function Get()
Actor ret = Game.GetCurrentCrosshairRef() as Actor
If !ret
ret = PlayerRef
EndIf
Return ret
EndFunction
EndProperty
Event OnInit()
PlayerRef = Game.GetPlayer()
Int femaleSize = OBodyNative.GetFemaleDatabaseSize()
Int maleSize = OBodyNative.GetMaleDatabaseSize()
Debug.Notification("OBody Installed: [F: " + femaleSize + "] [M: " + maleSize + "]")
OUtils.getOStim().RegisterForGameLoadEvent(self)
RegisterForOUpdate(self)
OnLoad()
EndEvent
Function OnLoad()
RegisterForKey(PresetKey)
OBodyNative.SetORefit(ORefitEnabled)
OBodyNative.SetNippleRand(NippleRandEnabled)
OBodyNative.SetGenitalRand(GenitalRandEnabled)
EndFunction
Event OnGameLoad()
OnLoad()
EndEvent
Event OnKeyDown(int KeyPress)
If outils.MenuOpen()
Return
EndIf
if KeyPress == PresetKey
ShowPresetMenu(TargetOrPlayer)
endif
EndEvent
Function ShowPresetMenu(Actor act)
Debug.Notification("Editing " + act.GetDisplayName())
UIListMenu listMenu = UIExtensions.GetMenu("UIListMenu") as UIListMenu
listMenu.ResetMenu()
string[] title = new String[1]
title[0] = "- OBody -"
string[] presets = OBodyNative.GetAllPossiblePresets(act)
int l = presets.Length
Console((l) + " presets found")
int pagesNeeded
If l > 125
pagesNeeded = (l / 125) + 1
;Console("Pages needed: " + pagesNeeded)
int i = 0
While i < pagesNeeded
listMenu.AddEntryItem("OBody set " + (i + 1))
i += 1
EndWhile
listMenu.OpenMenu(act)
int num = listMenu.GetResultInt()
If num < 0
Return
EndIf
int startingPoint = num * 125
int endPoint
If num == (pagesNeeded - 1) ; last set
endPoint = presets.Length - 1
Else
endPoint = startingPoint + 124
EndIf
listMenu.ResetMenu()
presets = PapyrusUtil.SliceStringArray(presets, startingPoint, endPoint)
EndIf
presets = PapyrusUtil.MergeStringArray(title, presets)
int i = 0
int max = presets.length
While (i < max)
listMenu.AddEntryItem(presets[i])
i += 1
EndWhile
listMenu.OpenMenu(act)
string result = listMenu.GetResultString()
int num = listMenu.GetResultInt()
If !(num < 1)
OBodyNative.ApplyPresetByName(act, result)
Console("Applying: " + result)
EndIf
EndFunction