Skip to content

Commit

Permalink
disassemble items will be added to wardrobe
Browse files Browse the repository at this point in the history
  • Loading branch information
p-marques committed Nov 20, 2022
1 parent 510e0ae commit 707ee08
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
28 changes: 26 additions & 2 deletions r6/scripts/DALC/dalc_base.reds
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Disassemble As Looting Choice by pMarK
// v1.2
// v1.3

module DALC.Base

Expand All @@ -10,6 +10,7 @@ public class DALC {
private let player: ref<PlayerPuppet>;
private let blackboard: ref<IBlackboard>;
private let craftingSystem: ref<CraftingSystem>;
private let wardrobeSystem: ref<WardrobeSystem>;
private let customChoice: InteractionChoiceData;
private let settings: DALCDefaultSettings;
Expand Down Expand Up @@ -133,15 +134,38 @@ public class DALC {
this.AwardExperience(listOfIngredients, amount);
this.HandleWardrobeSystem(itemID);
this.craftingSystem.UpdateBlackboard(CraftingCommands.DisassemblingFinished, itemID, listOfIngredients);
if (this.ShouldPlaySound()) {
this.PlayDisassembleSound();
}
}
private func HandleWardrobeSystem(itemID: ItemID) -> Void {
let itemRecord: ref<Item_Record>;
let itemData: wref<gameItemData>;
let name: String;
if !IsDefined(this.wardrobeSystem) {
this.wardrobeSystem = GameInstance.GetWardrobeSystem(this.gameInstance);
}
if Equals(RPGManager.GetItemCategory(itemID), gamedataItemCategory.Clothing) && !this.wardrobeSystem.IsItemBlacklisted(itemID) {
this.wardrobeSystem.StoreUniqueItemIDAndMarkNew(this.gameInstance, itemID);
itemRecord = TweakDBInterface.GetItemRecord(ItemID.GetTDBID(itemID));
itemData = RPGManager.GetItemData(this.gameInstance, this.lootingController.GetLootOwner(), itemID);
name = UIItemsHelper.GetItemName(itemRecord, itemData);
LogChannel(n"DALC", "Added [" + EnumValueToString("gamedataItemType", Cast<Int64>(EnumInt(itemData.GetItemType()))) + "] " + name);
}
}
private func AwardExperience(ingredients: array<IngredientData>, amount: Int32) -> Void {
RPGManager.AwardXP(this.gameInstance, Cast<Float>(8), gamedataProficiencyType.Crafting);
RPGManager.AwardXP(this.gameInstance, 8.0, gamedataProficiencyType.Crafting);
}
private func IsDisassembleChoiceShowing(data: LootData) -> Bool {
Expand Down
25 changes: 25 additions & 0 deletions r6/scripts/DALC/dalc_commands.reds
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Disassemble As Looting Choice by pMarK
// v1.3

public static exec func DALCListWardrobe(gi: GameInstance) -> Void {
let wardrobeSys: wref<WardrobeSystem>;
let stored: array<ItemID>;
let itemData: wref<gameItemData>;
wardrobeSys = GameInstance.GetWardrobeSystem(gi);
stored = wardrobeSys.GetStoredItemIDs();
LogChannel(n"DALC", "======================");
LogChannel(n"DALC", "== LISTING WARDROBE ==");
LogChannel(n"DALC", "======================");
LogChannel(n"DALC", "=> Count: " + ArraySize(stored));
for el in stored {
itemData = RPGManager.GetItemData(gi, GameInstance.GetPlayerSystem(gi).GetLocalPlayerMainGameObject(), el);
LogChannel(n"DALC", "=> [" + EnumValueToString("gamedataItemType", Cast<Int64>(EnumInt(itemData.GetItemType()))) + "] " + UIItemsHelper.GetItemName(TweakDBInterface.GetItemRecord(ItemID.GetTDBID(el)), itemData));
}
LogChannel(n"DALC", "== DONE ==");
}
2 changes: 1 addition & 1 deletion r6/scripts/DALC/dalc_overrides.reds
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Disassemble As Looting Choice by pMarK
// v1.2
// v1.3

module DALC.Overrides
import DALC.Base.DALC
Expand Down
2 changes: 1 addition & 1 deletion r6/scripts/DALC_Menu/dalc_menu.reds
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class DALCWithMenu extends DALC {
protected func SetupSettings() -> Void {
this.menuSettings = new DALCMenuSettings();
ModSettings.RegisterListenerToClass(this.menuSettings); // Hard "Mod Settings" dependency
ModSettings.RegisterListenerToClass(this.menuSettings);
}
public func GetIsEnabled() -> Bool {
Expand Down

0 comments on commit 707ee08

Please sign in to comment.