-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRBB_Utilities.py
186 lines (151 loc) · 9.82 KB
/
RBB_Utilities.py
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 8 01:57:25 2021
@author: Administrator
"""
import RBB
import RBB_General_Excel_Patch as GEP
ClassUnit = "TUniteAuSolDescriptor"
ClassModule = "TModuleSelector"
ClassWeaponManager = "TWeaponManagerModuleDescriptor"
#RBB.TurretType___
ClassMountedWeapon = "TMountedWeaponDescriptor"
ClassAmmo = "TAmmunition"
GCRB = RBB.GeneralConditionReferencedBy
GCR = RBB.GeneralConditionReference
controller = {
"ScannerConfiguration": "ScannerConfigurationController",
"Position": "PositionController",
"Fuel": "FuelController",
"MouvementHandler": "MouvementHandlerController",
"Supply": "ModernWarfareSupplyController"
}
def ConditionTurret(WeaponManagerCondition = None, WeaponHash = None):
ret = ""
if WeaponManagerCondition:
ret += GCRB(table = ClassWeaponManager, tableConditions = WeaponManagerCondition)
if WeaponHash:
ret += GCR(table = ClassMountedWeapon,
tableConditions = GCR(table = ClassAmmo,
tableConditions = RBB.TAmmuConditions(Name = WeaponHash)))
return ret
def ConditionWeaponManager(unitHash = None, weaponHash = None, turretType = RBB.TurretTypeAxis,
weaponManagerName = None):
ret = ""
if unitHash:
RBB.checkHashValue(unitHash)
ret += GCRB(table = ClassModule,
tableConditions = GCRB(table = ClassUnit,
tableConditions = ConditionUnitHash(unitHash)))
if weaponHash:
RBB.checkHashValue(weaponHash)
ret += GCR(table = turretType,
tableConditions = GCR(table = ClassMountedWeapon,
tableConditions = GCR(table = ClassAmmo,
tableConditions = RBB.TAmmuConditions(Name = weaponHash))))
if weaponManagerName:
ret += RBB.GeneralConditions(_ShortDatabaseName = "WeaponDescriptor_Unit_"+weaponManagerName)
return ret
def ConditionUnitIdentifier(unitIdentifier):
ret = ""
if "Descriptor" in unitIdentifier:
ret += ConditionDBName(unitIdentifier)
elif "-" in unitIdentifier:
ret += ConditionGUID(unitIdentifier)
else:
ret += ConditionUnitHash(unitIdentifier)
return ret
def ConditionModuleByUnitIdentifier(unitIdentifier, moduleKey = None):
ret = ""
moduleNameCondition = ""
if moduleKey in controller.keys():
moduleNameCondition += RBB.GeneralConditions(ControllerName = controller[moduleKey])
ret += RBB.GeneralConditionReferencedBy(table = "TModuleSelector",
tableConditions = (moduleNameCondition+
RBB.GeneralConditionReferencedBy(table = "TUniteAuSolDescriptor",
tableConditions = ConditionUnitIdentifier(unitIdentifier))
)
)
return ret
def ChangeModuleByUnitHash(targetUnitHash, moduleKey = "MouvementHandler", tableRefered = "TMouvementHandlerLandVehicleDescriptor"):
ret = ""
if moduleKey == "ApparenceModel":
ret += RBB.GeneralChangeDictValueObject(prop = "Modules", key = moduleKey, table = tableRefered,
tableConditions = RBB.GeneralConditionReferencedBy(table = "TUniteAuSolDescriptor",
tableConditions = ConditionUnitHash(targetUnitHash)))
else:
ret += RBB.GeneralChangeDictValueObject(prop = "Modules", key = moduleKey, table = "TModuleSelector",
tableConditions = RBB.GeneralConditionReference(table = tableRefered,
tableConditions = RBB.GeneralConditionReferencedBy(table = "TModuleSelector",
tableConditions = RBB.GeneralConditionReferencedBy(table = "TUniteAuSolDescriptor",
tableConditions = ConditionUnitHash(targetUnitHash)))))
return ret
def ChangeModuleByUnitHashAppend(targetUnitHash, moduleKey = "MissileCarriage", tableRefered = "TMissileCarriageModuleDescriptor"):
ret = ""
if moduleKey == "TurretSkeleton":
ret += RBB.GeneralChangeDictValueObjectAppendKey(prop = "Modules", keyType = "TableString", key = moduleKey, table = tableRefered,
tableConditions = RBB.GeneralConditionReferencedBy(table = "TUniteAuSolDescriptor",
tableConditions = ConditionUnitHash(targetUnitHash)))
else:
ret += RBB.GeneralChangeDictValueObjectAppendKey(prop = "Modules", keyType = "TableString", key = moduleKey, table = "TModuleSelector",
tableConditions = RBB.GeneralConditionReference(table = tableRefered,
tableConditions = RBB.GeneralConditionReferencedBy(table = "TModuleSelector",
tableConditions = RBB.GeneralConditionReferencedBy(table = "TUniteAuSolDescriptor",
tableConditions = ConditionUnitHash(targetUnitHash)))))
return ret
def ConditionUnitHash(unitHash):
ret = ""
RBB.checkHashValue(unitHash)
ret += RBB.GeneralConditions(NameInMenuToken = unitHash)
return ret
def ConditionGUID(GUID):
ret = ""
ret += RBB.GeneralConditions(DescriptorId = GUID)
return ret
def ConditionDBName(DBName):
ret = ""
ret += RBB.GeneralConditions(_ShortDatabaseName = DBName)
return ret
def ConditionInstanceFirst():
ret = ""
ret += RBB.GeneralConditions(__order = "first")
return ret
def ConditionInstanceLast():
ret = ""
ret += RBB.GeneralConditions(__order = "last")
return ret
def ChangeMissileModuleByMissileDBName(targetMissileName, moduleKey = "MouvementHandler", tableRefered = "TMouvementHandler_GuidedMissileDescriptor"):
ret = ""
if moduleKey == "Damage":
ret += RBB.GeneralChangeDictValueObject(prop = "Modules", key = moduleKey, table = "TModuleSelector",
tableConditions = (
RBB.GeneralConditions(ControllerName = "DamageController")
+RBB.GeneralConditionReferencedBy(table = "TUniteDescriptor",
tableConditions = ConditionDBName(targetMissileName))
)
)
elif moduleKey in ["MouvementHandler", "ApparenceModel"]:
ret += RBB.GeneralChangeDictValueObject(prop = "Modules", key = moduleKey, table = tableRefered,
tableConditions = RBB.GeneralConditionReferencedBy(table = "TUniteDescriptor",
tableConditions = ConditionDBName(targetMissileName))
)
else:
raise KeyError("Uncategorized module key = "+ moduleKey)
return ret
def ChangeUnitModuleByUnitDBName(targetUnitDBName, moduleKey = "ScannerConfiguration", tableRefered = "TScannerConfigurationDescriptor"):
ret = ""
if moduleKey in controller.keys():
ret += RBB.GeneralChangeDictValueObject(prop = "Modules", key = moduleKey, table = "TModuleSelector",
tableConditions = (
RBB.GeneralConditions(ControllerName = controller[moduleKey])
+RBB.GeneralConditionReferencedBy(table = "TUniteAuSolDescriptor",
tableConditions = ConditionDBName(targetUnitDBName))
)
)
else:
raise KeyError("Uncategorized module key = "+ moduleKey)
ret += RBB.GeneralChangeDictValueObject(prop = "Modules", key = moduleKey, table = tableRefered,
tableConditions = RBB.GeneralConditionReferencedBy(table = "TUniteAuSolDescriptor",
tableConditions = ConditionDBName(targetUnitDBName))
)
return ret