This repository has been archived by the owner on Oct 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
/
legend.lua
192 lines (164 loc) · 7.25 KB
/
legend.lua
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
186
187
188
189
190
191
192
local Legend = {}
local Utilities = require("utility")
function Legend.UpgradeWeapons()
local moduleName = "All Equipped Weapons Are Now Legendary With Max Stats"
player = Game.GetPlayer()
ssc = Game.GetScriptableSystemsContainer()
ts = Game.GetTransactionSystem()
ss = Game.GetStatsSystem()
es = ssc:Get(CName.new('EquipmentSystem'))
espd = es:GetPlayerData(player)
espd['GetItemInEquipSlot2'] = espd['GetItemInEquipSlot;gamedataEquipmentAreaInt32']
playerPLValue = ss:GetStatValue(player:GetEntityID(), 'PowerLevel')
local slots = {
Weapon = 3
}
for k,v in pairs(slots) do
for i=1,v do
print('Upgrading item in ' .. k .. ' slot ' .. (i - 1))
itemid = espd:GetItemInEquipSlot2(k, i - 1)
if itemid.tdbid.hash ~= 0 then
itemdata = ts:GetItemData(player, itemid)
statObj = itemdata:GetStatsObjectID() end
itemLevel = ss:GetStatValue(statObj, 'ItemLevel')
powerLevel = ss:GetStatValue(statObj, 'PowerLevel')
addItemLevel = 0 if itemLevel < math.floor(playerPLValue) * 10 then
addItemLevel = math.floor(playerPLValue - powerLevel) * 10 + 5
levelMod = Game['gameRPGManager::CreateStatModifier;gamedataStatTypegameStatModifierTypeFloat']('ItemLevel', 'Additive', addItemLevel)
ss:AddSavedModifier(statObj, levelMod) end
itemQuality = ss:GetStatValue(statObj, 'Quality')
newItemQuality = itemQuality if itemQuality < 5 then
newItemQuality = 4 ss:RemoveAllModifiers(statObj, 'Quality', true)
qualityMod = Game['gameRPGManager::CreateStatModifier;gamedataStatTypegameStatModifierTypeFloat']('Quality', 'Additive', newItemQuality)
ss:AddSavedModifier(statObj, qualityMod)
end
end
end
Utilities.FinishProtocol(moduleName)
end
function Legend.UpgradeArmor()
local moduleName = "All Equipped Armor Are Now Legendary With Max Stats"
player = Game.GetPlayer()
ssc = Game.GetScriptableSystemsContainer()
ts = Game.GetTransactionSystem()
ss = Game.GetStatsSystem()
es = ssc:Get(CName.new('EquipmentSystem'))
espd = es:GetPlayerData(player)
espd['GetItemInEquipSlot2'] = espd['GetItemInEquipSlot;gamedataEquipmentAreaInt32']
playerPLValue = ss:GetStatValue(player:GetEntityID(), 'PowerLevel')
local slots = {
Head = 1,
Face = 1,
InnerChest = 1,
OuterChest = 1,
Feet = 1,
Legs = 1,
Outfit = 1
}
for k,v in pairs(slots) do
for i=1,v do
print('Upgrading item in ' .. k .. ' slot ' .. (i - 1))
itemid = espd:GetItemInEquipSlot2(k, i - 1)
if itemid.tdbid.hash ~= 0 then
itemdata = ts:GetItemData(player, itemid)
statObj = itemdata:GetStatsObjectID() end
itemLevel = ss:GetStatValue(statObj, 'ItemLevel')
powerLevel = ss:GetStatValue(statObj, 'PowerLevel')
addItemLevel = 0 if itemLevel < math.floor(playerPLValue) * 10 then
addItemLevel = math.floor(playerPLValue - powerLevel) * 10 + 5
levelMod = Game['gameRPGManager::CreateStatModifier;gamedataStatTypegameStatModifierTypeFloat']('ItemLevel', 'Additive', addItemLevel)
ss:AddSavedModifier(statObj, levelMod) end
itemQuality = ss:GetStatValue(statObj, 'Quality')
newItemQuality = itemQuality if itemQuality < 5 then
newItemQuality = 4 ss:RemoveAllModifiers(statObj, 'Quality', true)
qualityMod = Game['gameRPGManager::CreateStatModifier;gamedataStatTypegameStatModifierTypeFloat']('Quality', 'Additive', newItemQuality)
ss:AddSavedModifier(statObj, qualityMod)
end
end
end
Utilities.FinishProtocol(moduleName)
end
function Legend.UpgradeMods()
local moduleName = "All Non-Equipped Mods Are Now Legendary With Max Stats"
player = Game.GetPlayer()
ssc = Game.GetScriptableSystemsContainer()
ts = Game.GetTransactionSystem()
cs = ssc:Get(CName.new('CraftingSystem')) ok,
backpack_items = ts:GetItemList(player)
local modType = {
Prt_FabricEnhancer = true,
Prt_Mod = true,
Prt_Fragment = true,
Prt_Scope = true,
Prt_Muzzle = true
}
for i, v in ipairs(backpack_items) do
itemid = v:GetID()
itemdata = ts:GetItemData(player, v:GetID())
vType = Game["gameRPGManager::GetItemType;ItemID"](itemid) if
modType[vType.value] then
cs['SetItemLevel2'] = cs['SetItemLevel;gameItemData']
cs:SetItemLevel2(itemdata) Game['gameRPGManager::ForceItemQuality;GameObjectgameItemDataCName'](player, itemdata, CName.new('Legendary'))
end
end
Utilities.FinishProtocol(moduleName)
end
function Legend.UpgradeCW()
local moduleName = "All Equipped Cyberware Are Now Legendary. NOTE: This is just for aesthetics. You should add the real items, from the other commands"
player = Game.GetPlayer()
ssc = Game.GetScriptableSystemsContainer()
ts = Game.GetTransactionSystem()
ss = Game.GetStatsSystem()
es = ssc:Get(CName.new('EquipmentSystem'))
espd = es:GetPlayerData(player)
espd['GetItemInEquipSlot2'] = espd['GetItemInEquipSlot;gamedataEquipmentAreaInt32']
playerPLValue = ss:GetStatValue(player:GetEntityID(), 'PowerLevel')
local slots = {
FrontalCortexCW = 3,
EyesCW = 1,
CardiovascularSystemCW = 3,
ImmuneSystemCW = 2,
NervousSystemCW = 2,
IntegumentarySystemCW = 3,
SystemReplacementCW = 1,
MusculoskeletalSystemCW = 2,
HandsCW = 2,
ArmsCW = 2,
LegsCW = 3,
PersonalLink = 1,
Splinter = 1,
Gadget = 1,
AbilityCW = 6
}
for k,v in pairs(slots) do
for i=1,v do
print('Upgrading item in ' .. k .. ' slot ' .. (i - 1))
itemid = espd:GetItemInEquipSlot2(k, i - 1)
if itemid.tdbid.hash ~= 0 then
itemdata = ts:GetItemData(player, itemid)
statObj = itemdata:GetStatsObjectID() end
itemLevel = ss:GetStatValue(statObj, 'ItemLevel')
powerLevel = ss:GetStatValue(statObj, 'PowerLevel')
addItemLevel = 0 if itemLevel < math.floor(playerPLValue) * 10
then addItemLevel = math.floor(playerPLValue - powerLevel) * 10 + 5
levelMod = Game['gameRPGManager::CreateStatModifier;gamedataStatTypegameStatModifierTypeFloat']('ItemLevel', 'Additive', addItemLevel)
ss:AddSavedModifier(statObj, levelMod) end
itemQuality = ss:GetStatValue(statObj, 'Quality')
newItemQuality = itemQuality if itemQuality < 5 then
newItemQuality = 4 ss:RemoveAllModifiers(statObj, 'Quality', true)
qualityMod = Game['gameRPGManager::CreateStatModifier;gamedataStatTypegameStatModifierTypeFloat']('Quality', 'Additive', newItemQuality)
ss:AddSavedModifier(statObj, qualityMod)
end
end
end
Utilities.FinishProtocol(moduleName)
end
function Legend.UpgradeAll()
local moduleName = "Make all equipped gear Legendary with max stats - except equipped mods"
Legend.UpgradeWeapons()
Legend.UpgradeArmor()
Legend.UpgradeMods()
--Legend.UpgradeCW()
Utilities.FinishProtocol(moduleName)
end
return Legend