|
1 | 1 |
|
2 | | -@replaceMethod(CraftingSystem) |
| 2 | +@wrapMethod(CraftingSystem) |
3 | 3 | 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); |
9 | 6 | }; |
10 | 7 | return false; |
11 | 8 | } |
12 | 9 |
|
13 | | -@replaceMethod(Vendor) |
| 10 | +@wrapMethod(Vendor) |
14 | 11 | 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); |
29 | 14 | // Prevent any sale of iconic items |
30 | | - if RPGManager.IsItemIconic(itemData) { |
| 15 | + if IsDefined(itemData) && RPGManager.IsItemIconic(itemData) { |
31 | 16 | return false; |
32 | 17 | } |
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); |
57 | 19 | } |
0 commit comments