Skip to content

Commit 837a74c

Browse files
committed
Support for 1.3 patch. Expanded FastSell logic
1 parent beb376d commit 837a74c

File tree

10 files changed

+158
-260
lines changed

10 files changed

+158
-260
lines changed

UI-Improvements/CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Changelog
2+
3+
## [1.3.0] - 2021-09-02
4+
5+
Support for Cyberpunk 2077 Patch 1.3
6+
7+
### Added
8+
9+
- Vendor - Fast Buy & Sell
10+
- Allows you to sell entire stacks or expensive items without any additional dialogs
11+
- Limits sales to vendor money total
12+
- Also limits all buy/sell actions to player/vendor money total
13+
- Fast Sell is bound to the "Activate Secondary" input event, right click by default
14+
- Button hint text works in English and Russian, currently unsure about other languages
15+
- RPGManager - Mod Slots
16+
- Fixes LMG mods slots
17+
18+
19+
### Changed
20+
21+
- Requires redscript 0.3 or newer
22+
- Changed all method replacements to wraps where possible
23+
- Reduces issues caused by patch changes
24+
- Should improve compatibility between mods
25+
- Added names to the multiple "Other" shard groups
26+
- Fixed minor issue with phone dialer menu sorting
27+
28+
### Removed
29+
30+
- Quest - Vehicle Previews
31+
- Feature was added by CDPR in Patch 1.3
32+
- Dialer Menu - By Timestamp
33+
- Removed redundant version of phone menu sorting.
34+
- Plan is to reenable this variant when Mod Settings are available

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

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,10 @@ protected func flibGetAmmoCraftingMaximum(itemData: wref<gameItemData>) -> Int32
3434
}
3535

3636
/// Added ammo max check
37-
@replaceMethod(CraftingSystem)
37+
@wrapMethod(CraftingSystem)
3838
public final const func GetMaxCraftingAmount(itemData: wref<gameItemData>) -> Int32 {
39-
let currentQuantity: Int32;
40-
let currentResult: Int32;
41-
let transactionSystem: ref<TransactionSystem> = GameInstance.GetTransactionSystem(this.GetGameInstance());
42-
let requiredIngredients: array<IngredientData> = this.GetItemCraftingCost(itemData);
43-
let result: Int32 = 10000000;
44-
let i: Int32 = 0;
45-
while i < ArraySize(requiredIngredients) {
46-
currentQuantity = transactionSystem.GetItemQuantity(this.m_playerCraftBook.GetOwner(), ItemID.CreateQuery(requiredIngredients[i].id.GetID()));
47-
if currentQuantity > requiredIngredients[i].quantity {
48-
result = Min(result, currentQuantity / requiredIngredients[i].quantity);
49-
} else {
50-
return 0;
51-
};
52-
i += 1;
53-
};
39+
let result: Int32 = wrappedMethod(itemData);
40+
5441
if (itemData.HasTag(n"Ammo")) {
5542
return Min(result, this.flibGetAmmoCraftingMaximum(itemData));
5643
}

UI-Improvements/r6/scripts/flib/DialerMenu-ByName.reds

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ public func SortItem(left: ref<IScriptable>, right: ref<IScriptable>) -> Bool {
99
return this.m_compareBuilder
1010
.BoolTrue(leftData.questRelated, rightData.questRelated)
1111
.BoolTrue(ArraySize(leftData.unreadMessages) > 0, ArraySize(rightData.unreadMessages) > 0)
12-
.UnicodeStringAsc(GetLocalizedText(leftData.localizedName), GetLocalizedText(rightData.localizedName))
12+
.StringAsc(GetLocalizedText(leftData.localizedName), GetLocalizedText(rightData.localizedName))
1313
.GetBool();
1414
}

UI-Improvements/r6/scripts/flib/DialerMenu-ByTimestamp.reds

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 8 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,19 @@
11

2-
@replaceMethod(CraftingSystem)
2+
@wrapMethod(CraftingSystem)
33
public final const func CanItemBeDisassembled(itemData: wref<gameItemData>) -> Bool {
4-
if NotEquals(itemData, null) {
5-
return !itemData.HasTag(n"Quest")
6-
&& !itemData.HasTag(n"UnequipBlocked")
7-
&& !RPGManager.IsItemIconic(itemData)
8-
&& NotEquals(ItemActionsHelper.GetDisassembleAction(itemData.GetID()), null);
4+
if IsDefined(itemData) {
5+
return !RPGManager.IsItemIconic(itemData) && wrappedMethod(itemData);
96
};
107
return false;
118
}
129

13-
@replaceMethod(Vendor)
10+
@wrapMethod(Vendor)
1411
public final const func PlayerCanSell(itemID: ItemID, allowQuestItems: Bool, excludeEquipped: Bool) -> Bool {
15-
let hasInverseTag: Bool;
16-
let i: Int32;
17-
let inverseFilterTags: array<CName>;
18-
let itemData: wref<gameItemData>;
19-
let itemTags: array<CName>;
20-
let player: wref<GameObject>;
21-
let filterTags: array<CName> = this.m_vendorRecord.CustomerFilterTags();
22-
if allowQuestItems {
23-
ArrayRemove(filterTags, n"Quest");
24-
};
25-
inverseFilterTags = TDB.GetCNameArray(this.m_vendorRecord.GetID() + t".customerInverseFilterTags");
26-
itemTags = RPGManager.GetItemRecord(itemID).Tags();
27-
player = GetPlayer(this.m_gameInstance);
28-
itemData = GameInstance.GetTransactionSystem(this.m_gameInstance).GetItemData(player, itemID);
12+
let player: wref<GameObject> = GetPlayer(this.m_gameInstance);
13+
let itemData: wref<gameItemData> = GameInstance.GetTransactionSystem(this.m_gameInstance).GetItemData(player, itemID);
2914
// Prevent any sale of iconic items
30-
if RPGManager.IsItemIconic(itemData) {
15+
if IsDefined(itemData) && RPGManager.IsItemIconic(itemData) {
3116
return false;
3217
}
33-
if excludeEquipped && EquipmentSystem.GetInstance(player).IsEquipped(player, itemID) {
34-
return false;
35-
};
36-
if ArraySize(inverseFilterTags) > 0 {
37-
i = 0;
38-
while i < ArraySize(inverseFilterTags) {
39-
if itemData.HasTag(inverseFilterTags[i]) {
40-
hasInverseTag = true;
41-
} else {
42-
i += 1;
43-
};
44-
};
45-
if !hasInverseTag {
46-
return false;
47-
};
48-
};
49-
i = 0;
50-
while i < ArraySize(filterTags) {
51-
if itemData.HasTag(filterTags[i]) {
52-
return false;
53-
};
54-
i += 1;
55-
};
56-
return true;
18+
return wrappedMethod(itemID, allowQuestItems, excludeEquipped);
5719
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
Implementation of custom sorting at runtime for the Messages screen
44

55
@see file:shared/VirtualNestedList.reds
6-
7-
86
*/
97

108
/// @section MessengerContactDataView

UI-Improvements/r6/scripts/flib/Quests-VehiclePreview.reds

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

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

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,7 @@ protected func PreSortItems(compareBuilder: ref<CompareBuilder>, left: ref<Virut
1414
let rightShard = ShardsNestedListDataView.flibGetShardGroupFromListData(right);
1515
1616
if IsDefined(leftShard) && IsDefined(leftShard) {
17-
switch this.f_sortOrder {
18-
case flibSortOrder.Timestamp:
19-
compareBuilder
20-
.BoolTrue(leftShard.m_isNew, rightShard.m_isNew)
21-
.GameTimeDesc(leftShard.m_timeStamp, rightShard.m_timeStamp);
22-
break;
23-
case flibSortOrder.Name:
24-
compareBuilder.StringAsc(GetLocalizedText(leftShard.m_title), GetLocalizedText(rightShard.m_title));
25-
break;
26-
default:
27-
break;
28-
}
17+
compareBuilder.StringAsc(GetLocalizedText(leftShard.m_title), GetLocalizedText(rightShard.m_title));
2918
}
3019
}
3120

@@ -158,7 +147,7 @@ private final func PopulateData() -> Void {
158147
159148
i = 0;
160149
while i < ArraySize(items) {
161-
if this.ProcessItem(items[i], data, level, AsRef(newEntries)) {
150+
if this.ProcessItem(items[i], data, level, newEntries) {
162151
counter += 1;
163152
}
164153
i += 1;

0 commit comments

Comments
 (0)