Skip to content

Commit

Permalink
Updated support for Patch 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
flibdev committed Sep 19, 2022
1 parent 3ce5909 commit 2c0ff3d
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 188 deletions.
30 changes: 30 additions & 0 deletions UI-Improvements/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Changelog

## [1.6.0] - 2022-09-14

Support for Cyberpunk 2077 Patch 1.6

### Changed

Updated Vendor Fast Sell to work with the new vendor logic
- Now supports buyback logic, no money loss going back and forth
- No fast selling of iconic items

### Removed

Removed iconic item sale prevention, CDPR added confirmation dialog

Removed because they were fixed by CDPR:
- Max ammo crafting
- Vendor quantity picker limits

### Unchanged

- Dialer Menu ordering *(CDPR impl still sorts by hash)*
- Iconic Items - Disassembly prevented
- Quantity Picker - Default to max
- RipperDoc - Only show unowned in UI totals
- Messages/Quests/Shards custom sorting *(CDPR impl still sorts by hash)*

---

## [1.5.0] - 2022-02-24

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

---

## [1.3.0] - 2021-09-02

Support for Cyberpunk 2077 Patch 1.3
Expand Down
85 changes: 0 additions & 85 deletions UI-Improvements/r6/scripts/flib/Crafting-MaxAmmo.reds

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

@wrapMethod(CraftingSystem)
public final const func CanItemBeDisassembled(itemData: wref<gameItemData>) -> Bool {
if IsDefined(itemData) {
return !RPGManager.IsItemIconic(itemData) && wrappedMethod(itemData);
}
return false;
}
19 changes: 0 additions & 19 deletions UI-Improvements/r6/scripts/flib/IconicItems-PreventRemoval.reds

This file was deleted.

32 changes: 16 additions & 16 deletions UI-Improvements/r6/scripts/flib/Shards-CustomSort.reds
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ protected cb func flibOnPostOnRelease(evt: ref<inkPointerEvent>) -> Bool {

@replaceMethod(ShardsMenuGameController)
private final func PopulateData() -> Void {
let groupData: ref<ShardEntryData>;
let groupVirtualListData: ref<VirutalNestedListData>;
let encryptedGroup: ref<ShardEntryData>;
let encryptedList: ref<VirutalNestedListData>;
let newEntries: array<Int32>;
let items: array<InventoryItemData>;
let data: array<ref<VirutalNestedListData>>;
Expand All @@ -154,29 +154,29 @@ private final func PopulateData() -> Void {
}
if counter > 0 {
groupData = new ShardEntryData();
groupData.m_title = "[" + GetLocalizedTextByKey(n"Story-base-journal-codex-tutorials-Endryptedshards_title") + "]";
groupData.m_activeDataSync = this.m_activeData;
groupData.m_counter = counter;
groupData.m_isNew = this.m_hasNewCryptedEntries;
groupData.f_group = null;
groupData.m_newEntries = newEntries;
groupVirtualListData = new VirutalNestedListData();
groupVirtualListData.m_level = level;
groupVirtualListData.m_widgetType = 1u;
groupVirtualListData.m_isHeader = true;
groupVirtualListData.m_data = groupData;
encryptedGroup = new ShardEntryData();
encryptedGroup.m_title = "[" + GetLocalizedTextByKey(n"Story-base-journal-codex-tutorials-Endryptedshards_title") + "]";
encryptedGroup.m_activeDataSync = this.m_activeData;
encryptedGroup.m_counter = counter;
encryptedGroup.m_isNew = this.m_hasNewCryptedEntries;
encryptedGroup.f_group = null;
encryptedGroup.m_newEntries = newEntries;
encryptedList = new VirutalNestedListData();
encryptedList.m_level = level;
encryptedList.m_widgetType = 1u;
encryptedList.m_isHeader = true;
encryptedList.m_data = encryptedGroup;
for shardListData in data {
if !shardListData.m_isHeader {
let shard = shardListData.m_data as ShardEntryData;
if IsDefined(shard) && shard.m_isCrypted {
shard.f_group = groupData;
shard.f_group = encryptedGroup;
}
}
}
ArrayPush(data, groupVirtualListData);
ArrayPush(data, encryptedList);
}
if ArraySize(data) > 0 {
Expand Down
93 changes: 70 additions & 23 deletions UI-Improvements/r6/scripts/flib/Vendor-FastSell.reds
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,19 @@ private final func Init() -> Void {

@wrapMethod(FullscreenVendorGameController)
protected cb func OnInventoryItemHoverOver(evt: ref<ItemDisplayHoverOverEvent>) -> Bool {
let targetItem: InventoryItemData = evt.itemData;
let wrapped: Bool = wrappedMethod(evt);
let sellStackLocalizedText: String;
let controller = inkWidgetRef.GetController(this.m_sortingDropdown) as DropdownListController;
if !IsDefined(this.m_storageUserData) && IsDefined(this.m_vendorUserData) {
if InventoryItemData.IsVendorItem(targetItem) {
this.m_buttonHintsController.AddButtonHint(this.fFastButton, this.fFastBuyText);
}
else {
if this.m_VendorDataManager.CanPlayerSellItem(InventoryItemData.GetID(targetItem)) {
this.m_buttonHintsController.AddButtonHint(this.fFastButton, this.fFastSellText);
// Bugfix by CDPR: Ignore hover over event when the sorting dropdown is open
if !controller.IsOpened() {
if !IsDefined(this.m_storageUserData) && IsDefined(this.m_vendorUserData) {
if Equals(evt.displayContextData.GetDisplayContext(), ItemDisplayContext.Vendor) {
this.m_buttonHintsController.AddButtonHint(this.fFastButton, this.fFastBuyText);
}
else {
if this.m_VendorDataManager.CanPlayerSellItem(evt.uiInventoryItem.GetID()) && !evt.uiInventoryItem.IsIconic() {
this.m_buttonHintsController.AddButtonHint(this.fFastButton, this.fFastSellText);
}
}
}
}
Expand All @@ -51,23 +53,68 @@ protected cb func OnInventoryItemHoverOut(evt: ref<ItemDisplayHoverOutEvent>) ->
}

@wrapMethod(FullscreenVendorGameController)
private final func HandleVendorSlotInput(evt: ref<ItemDisplayClickEvent>, itemData: InventoryItemData) -> Void {
wrappedMethod(evt, itemData);
private final func HandleVendorSlotInput(evt: ref<ItemDisplayClickEvent>) -> Void {
let targetItem: wref<UIInventoryItem> = evt.uiInventoryItem;
let vendorNotification: ref<UIMenuNotificationEvent>;
if evt.actionName.IsAction(this.fFastButton) {
let maxQty: Int32;
wrappedMethod(evt);
if (InventoryItemData.IsVendorItem(itemData)) {
maxQty = this.flibGetMaxQuantity(itemData, QuantityPickerActionType.Buy);
this.BuyItem(InventoryItemData.GetGameItemData(itemData), maxQty);
this.PlaySound(n"Item", n"OnBuy");
}
else {
maxQty = this.flibGetMaxQuantity(itemData, QuantityPickerActionType.Sell);
this.SellItem(InventoryItemData.GetGameItemData(itemData), maxQty);
this.PlaySound(n"Item", n"OnSell");
if evt.actionName.IsAction(this.fFastButton) && IsDefined(targetItem) {
let maxQty: Int32 = 0;
switch evt.displayContextData.GetDisplayContext() {
case ItemDisplayContext.Vendor:
maxQty = this.flibGetMaxPurchasable(targetItem, QuantityPickerActionType.Buy);
// CDPR new logic for ammo limits
if (maxQty == 0) {
vendorNotification = new UIMenuNotificationEvent();
vendorNotification.m_notificationType = UIMenuNotificationType.CraftingAmmoCap;
GameInstance.GetUISystem(this.m_player.GetGame()).QueueEvent(vendorNotification);
this.PlaySound(n"MapPin", n"OnDelete");
}
else {
this.BuyItem(targetItem.GetItemData(), maxQty, evt.isBuybackStack);
this.PlaySound(n"Item", n"OnBuy");
this.m_TooltipsManager.HideTooltips();
}
break;
case ItemDisplayContext.VendorPlayer:
// Don't fast sell iconics
if targetItem.IsIconic() {
this.OpenConfirmationPopup(targetItem, targetItem.GetQuantity(), QuantityPickerActionType.Sell);
}
else {
maxQty = this.flibGetMaxPurchasable(targetItem, QuantityPickerActionType.Sell);
this.SellItem(targetItem.GetItemData(), maxQty);
this.PlaySound(n"Item", n"OnSell");
}
break;
default:
break;
}
}
}

@addMethod(FullscreenVendorGameController)
private func flibGetMaxPurchasable(item: wref<UIInventoryItem>, actionType: QuantityPickerActionType) -> Int32 {
let price: Int32 = this.GetPrice(item.GetItemData(), actionType, 1);
let maxQty: Int32 = this.GetMaxQuantity(item, Equals(actionType, QuantityPickerActionType.Sell));
let money: Int32 = 0;
this.m_TooltipsManager.HideTooltips();
if (price <= 0) {
return maxQty;
}
switch (actionType) {
case QuantityPickerActionType.Sell:
money = MarketSystem.GetVendorMoney(this.m_VendorDataManager.GetVendorInstance());
break;
case QuantityPickerActionType.Buy:
money = this.m_VendorDataManager.GetLocalPlayerCurrencyAmount();
break;
default:
return maxQty;
}
return Min(maxQty, money / price);
}
45 changes: 0 additions & 45 deletions UI-Improvements/r6/scripts/flib/shared/Vendors.reds

This file was deleted.

0 comments on commit 2c0ff3d

Please sign in to comment.