Skip to content

Commit 2c0ff3d

Browse files
committed
Updated support for Patch 1.6
1 parent 3ce5909 commit 2c0ff3d

File tree

7 files changed

+124
-188
lines changed

7 files changed

+124
-188
lines changed

UI-Improvements/CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
# Changelog
22

3+
## [1.6.0] - 2022-09-14
4+
5+
Support for Cyberpunk 2077 Patch 1.6
6+
7+
### Changed
8+
9+
Updated Vendor Fast Sell to work with the new vendor logic
10+
- Now supports buyback logic, no money loss going back and forth
11+
- No fast selling of iconic items
12+
13+
### Removed
14+
15+
Removed iconic item sale prevention, CDPR added confirmation dialog
16+
17+
Removed because they were fixed by CDPR:
18+
- Max ammo crafting
19+
- Vendor quantity picker limits
20+
21+
### Unchanged
22+
23+
- Dialer Menu ordering *(CDPR impl still sorts by hash)*
24+
- Iconic Items - Disassembly prevented
25+
- Quantity Picker - Default to max
26+
- RipperDoc - Only show unowned in UI totals
27+
- Messages/Quests/Shards custom sorting *(CDPR impl still sorts by hash)*
28+
29+
---
30+
331
## [1.5.0] - 2022-02-24
432

533
Support for Cyberpunk 2077 Patch 1.5
@@ -20,6 +48,8 @@ Removed because they were fixed by CDPR in Patch 1.5
2048
- Missing shard group names
2149
- Vehicle quest preview images (albiet fixed poorly)
2250

51+
---
52+
2353
## [1.3.0] - 2021-09-02
2454

2555
Support for Cyberpunk 2077 Patch 1.3

UI-Improvements/r6/scripts/flib/Crafting-MaxAmmo.reds

Lines changed: 0 additions & 85 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
@wrapMethod(CraftingSystem)
3+
public final const func CanItemBeDisassembled(itemData: wref<gameItemData>) -> Bool {
4+
if IsDefined(itemData) {
5+
return !RPGManager.IsItemIconic(itemData) && wrappedMethod(itemData);
6+
}
7+
return false;
8+
}

UI-Improvements/r6/scripts/flib/IconicItems-PreventRemoval.reds

Lines changed: 0 additions & 19 deletions
This file was deleted.

UI-Improvements/r6/scripts/flib/Shards-CustomSort.reds

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ protected cb func flibOnPostOnRelease(evt: ref<inkPointerEvent>) -> Bool {
131131

132132
@replaceMethod(ShardsMenuGameController)
133133
private final func PopulateData() -> Void {
134-
let groupData: ref<ShardEntryData>;
135-
let groupVirtualListData: ref<VirutalNestedListData>;
134+
let encryptedGroup: ref<ShardEntryData>;
135+
let encryptedList: ref<VirutalNestedListData>;
136136
let newEntries: array<Int32>;
137137
let items: array<InventoryItemData>;
138138
let data: array<ref<VirutalNestedListData>>;
@@ -154,29 +154,29 @@ private final func PopulateData() -> Void {
154154
}
155155
156156
if counter > 0 {
157-
groupData = new ShardEntryData();
158-
groupData.m_title = "[" + GetLocalizedTextByKey(n"Story-base-journal-codex-tutorials-Endryptedshards_title") + "]";
159-
groupData.m_activeDataSync = this.m_activeData;
160-
groupData.m_counter = counter;
161-
groupData.m_isNew = this.m_hasNewCryptedEntries;
162-
groupData.f_group = null;
163-
groupData.m_newEntries = newEntries;
164-
groupVirtualListData = new VirutalNestedListData();
165-
groupVirtualListData.m_level = level;
166-
groupVirtualListData.m_widgetType = 1u;
167-
groupVirtualListData.m_isHeader = true;
168-
groupVirtualListData.m_data = groupData;
157+
encryptedGroup = new ShardEntryData();
158+
encryptedGroup.m_title = "[" + GetLocalizedTextByKey(n"Story-base-journal-codex-tutorials-Endryptedshards_title") + "]";
159+
encryptedGroup.m_activeDataSync = this.m_activeData;
160+
encryptedGroup.m_counter = counter;
161+
encryptedGroup.m_isNew = this.m_hasNewCryptedEntries;
162+
encryptedGroup.f_group = null;
163+
encryptedGroup.m_newEntries = newEntries;
164+
encryptedList = new VirutalNestedListData();
165+
encryptedList.m_level = level;
166+
encryptedList.m_widgetType = 1u;
167+
encryptedList.m_isHeader = true;
168+
encryptedList.m_data = encryptedGroup;
169169
170170
for shardListData in data {
171171
if !shardListData.m_isHeader {
172172
let shard = shardListData.m_data as ShardEntryData;
173173
if IsDefined(shard) && shard.m_isCrypted {
174-
shard.f_group = groupData;
174+
shard.f_group = encryptedGroup;
175175
}
176176
}
177177
}
178178
179-
ArrayPush(data, groupVirtualListData);
179+
ArrayPush(data, encryptedList);
180180
}
181181
182182
if ArraySize(data) > 0 {

UI-Improvements/r6/scripts/flib/Vendor-FastSell.reds

Lines changed: 70 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,19 @@ private final func Init() -> Void {
2626

2727
@wrapMethod(FullscreenVendorGameController)
2828
protected cb func OnInventoryItemHoverOver(evt: ref<ItemDisplayHoverOverEvent>) -> Bool {
29-
let targetItem: InventoryItemData = evt.itemData;
3029
let wrapped: Bool = wrappedMethod(evt);
31-
let sellStackLocalizedText: String;
30+
let controller = inkWidgetRef.GetController(this.m_sortingDropdown) as DropdownListController;
3231
33-
if !IsDefined(this.m_storageUserData) && IsDefined(this.m_vendorUserData) {
34-
if InventoryItemData.IsVendorItem(targetItem) {
35-
this.m_buttonHintsController.AddButtonHint(this.fFastButton, this.fFastBuyText);
36-
}
37-
else {
38-
if this.m_VendorDataManager.CanPlayerSellItem(InventoryItemData.GetID(targetItem)) {
39-
this.m_buttonHintsController.AddButtonHint(this.fFastButton, this.fFastSellText);
32+
// Bugfix by CDPR: Ignore hover over event when the sorting dropdown is open
33+
if !controller.IsOpened() {
34+
if !IsDefined(this.m_storageUserData) && IsDefined(this.m_vendorUserData) {
35+
if Equals(evt.displayContextData.GetDisplayContext(), ItemDisplayContext.Vendor) {
36+
this.m_buttonHintsController.AddButtonHint(this.fFastButton, this.fFastBuyText);
37+
}
38+
else {
39+
if this.m_VendorDataManager.CanPlayerSellItem(evt.uiInventoryItem.GetID()) && !evt.uiInventoryItem.IsIconic() {
40+
this.m_buttonHintsController.AddButtonHint(this.fFastButton, this.fFastSellText);
41+
}
4042
}
4143
}
4244
}
@@ -51,23 +53,68 @@ protected cb func OnInventoryItemHoverOut(evt: ref<ItemDisplayHoverOutEvent>) ->
5153
}
5254

5355
@wrapMethod(FullscreenVendorGameController)
54-
private final func HandleVendorSlotInput(evt: ref<ItemDisplayClickEvent>, itemData: InventoryItemData) -> Void {
55-
wrappedMethod(evt, itemData);
56+
private final func HandleVendorSlotInput(evt: ref<ItemDisplayClickEvent>) -> Void {
57+
let targetItem: wref<UIInventoryItem> = evt.uiInventoryItem;
58+
let vendorNotification: ref<UIMenuNotificationEvent>;
5659
57-
if evt.actionName.IsAction(this.fFastButton) {
58-
let maxQty: Int32;
60+
wrappedMethod(evt);
5961
60-
if (InventoryItemData.IsVendorItem(itemData)) {
61-
maxQty = this.flibGetMaxQuantity(itemData, QuantityPickerActionType.Buy);
62-
this.BuyItem(InventoryItemData.GetGameItemData(itemData), maxQty);
63-
this.PlaySound(n"Item", n"OnBuy");
64-
}
65-
else {
66-
maxQty = this.flibGetMaxQuantity(itemData, QuantityPickerActionType.Sell);
67-
this.SellItem(InventoryItemData.GetGameItemData(itemData), maxQty);
68-
this.PlaySound(n"Item", n"OnSell");
62+
if evt.actionName.IsAction(this.fFastButton) && IsDefined(targetItem) {
63+
let maxQty: Int32 = 0;
64+
65+
switch evt.displayContextData.GetDisplayContext() {
66+
case ItemDisplayContext.Vendor:
67+
maxQty = this.flibGetMaxPurchasable(targetItem, QuantityPickerActionType.Buy);
68+
// CDPR new logic for ammo limits
69+
if (maxQty == 0) {
70+
vendorNotification = new UIMenuNotificationEvent();
71+
vendorNotification.m_notificationType = UIMenuNotificationType.CraftingAmmoCap;
72+
GameInstance.GetUISystem(this.m_player.GetGame()).QueueEvent(vendorNotification);
73+
this.PlaySound(n"MapPin", n"OnDelete");
74+
}
75+
else {
76+
this.BuyItem(targetItem.GetItemData(), maxQty, evt.isBuybackStack);
77+
this.PlaySound(n"Item", n"OnBuy");
78+
this.m_TooltipsManager.HideTooltips();
79+
}
80+
break;
81+
case ItemDisplayContext.VendorPlayer:
82+
// Don't fast sell iconics
83+
if targetItem.IsIconic() {
84+
this.OpenConfirmationPopup(targetItem, targetItem.GetQuantity(), QuantityPickerActionType.Sell);
85+
}
86+
else {
87+
maxQty = this.flibGetMaxPurchasable(targetItem, QuantityPickerActionType.Sell);
88+
this.SellItem(targetItem.GetItemData(), maxQty);
89+
this.PlaySound(n"Item", n"OnSell");
90+
}
91+
break;
92+
default:
93+
break;
6994
}
95+
}
96+
}
97+
98+
@addMethod(FullscreenVendorGameController)
99+
private func flibGetMaxPurchasable(item: wref<UIInventoryItem>, actionType: QuantityPickerActionType) -> Int32 {
100+
let price: Int32 = this.GetPrice(item.GetItemData(), actionType, 1);
101+
let maxQty: Int32 = this.GetMaxQuantity(item, Equals(actionType, QuantityPickerActionType.Sell));
102+
let money: Int32 = 0;
70103
71-
this.m_TooltipsManager.HideTooltips();
104+
if (price <= 0) {
105+
return maxQty;
72106
}
107+
108+
switch (actionType) {
109+
case QuantityPickerActionType.Sell:
110+
money = MarketSystem.GetVendorMoney(this.m_VendorDataManager.GetVendorInstance());
111+
break;
112+
case QuantityPickerActionType.Buy:
113+
money = this.m_VendorDataManager.GetLocalPlayerCurrencyAmount();
114+
break;
115+
default:
116+
return maxQty;
117+
}
118+
119+
return Min(maxQty, money / price);
73120
}

UI-Improvements/r6/scripts/flib/shared/Vendors.reds

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)