Okay maybe I just get this wrong, but even with this mods, I only get the parts I negotiated, like 4/17. I thought this is so you always get the complete loot?
I don't see this AutoSell feature working in my game. I've removed all other mods that could interfere with the salvage screen and got a last-turn save game to test this. When I set ItemsToKeep to 1 in the mod.json, my inventory still has more than that in all kind of categories, no matter if items were among the recent battle salvage or not. E.g. there were 3 M Lasers among the recent battle salvage claimed but all of them were added into my inventory of 7 either.
I normally use Loot Magnet (v8) which also features quicksell and the inventory in the salvage screen, so I guess both mods aren't that compatible to each other, although I haven't noticed any error/warning in the log or game. I'm mainly interested in auto-selling stuff, as constantly manually selling useless items is a major bummer in the game.
How do you list exceptions in BlackList: [x, y, z]?
These two are not compatible. This is a fork based on Loot Magnet where some people wanted quicksell and inventory with autosell but not all the contract stuff.
I've replaced some mods with your Better Simulation mod to increase a bit the compatibility. I don't need that contract stuff of Loot Magnet either so much if I can get a working auto-sell feature in return. However, I still get built-in blacklisted gear like Vectored Thruster Kits in the salvage list when Better Salvage is running.
Is auto-selling always updating the inventory according to ItemToKeep right after the salvage screen? If I set this to 2 for a change, I still see plenty item stacks higher than that after the salvage screen. If I can't get this working properly then I sadly must play without this mod, as built-in gear shouldn't drop at all to be used in other mechs either.
SalvageUnlock: just checked your code and see you remove the blacklisted tag by that. Okay, I'm going to set it this to false, as it isn't mentioned in the mod description. One problem solved! Maybe exclude built-in gear from dopping there, although it's surely nice to have spare-parts of such sensitive built-in gear that can get destroyed like anything else I guess. Too bad you can't restrict items to certain mechs.
However, I still get built-in blacklisted gear like Vectored Thruster Kits in the salvage list when Better Salvage is running.
You'll need to set Salvage Unlock to false in the mod.json. I've updated the mod description to include this. Thanks for the report.
Is auto-selling always updating the inventory according to ItemToKeep right after the salvage screen? If I set this to 2 for a change, I still see plenty item stacks higher than that after the salvage screen. If I can't get this working properly then I sadly must play without this mod, as built-in gear shouldn't drop at all to be used in other mechs either.
There was a bug in the code since most people just left it to 10 it was never reported. A new version has been updated which corrects this. Let me know if you are still seeing the issue.
I'm not sure if auto-selling is really working now as some stacks of my inventory are still above my set limit. I let it run now with my setting and observe it for future battles. Loot Magnet and this mod still seem to work fine together otherwise, as it even shows both hold-left/shift-click messages above each other in the salvage list. A neglectable ui issue as long as the selling and buttons works. As LM doesn't have any post-salvage calculation, I doubt it could interfere with auto-selling. I still like the salvage-stacks of LM, making such piles more worthy than single cheap items picks.
Any chance you can get selling mech parts working again? It was working for a while, but something about the 1.9.1 update borked up the code paths and no one ever got around to fixing it.
If I'm understanding the code right (no guarantee there), the old SellMechParts mod basically reverse engineered engineered the price based on the MechDef, then divided it by the number of parts and the sell price multiplier in the SimGameConstants: [HarmonyPatch(typeof(Shop), "GetAllInventoryShopItems")] public static class Shop_GetAllInventoryShopItems_Patch { static void Postfix(Shop __instance, ref List<ShopDefItem> __result) { try {
"this mod is completely useless by now, since you can now scrap/sell mechparts in vanilla." - Comment from the old SellMechParts mod. You can scrap mech parts directly from the storage bin, because of that I won't be adding it to the shop, but you can now sell directly from the salvage screen.
12 comments
I've removed all other mods that could interfere with the salvage screen and got a last-turn save game to test this.
When I set ItemsToKeep to 1 in the mod.json, my inventory still has more than that in all kind of categories, no matter if items were among the recent battle salvage or not.
E.g. there were 3 M Lasers among the recent battle salvage claimed but all of them were added into my inventory of 7 either.
I normally use Loot Magnet (v8) which also features quicksell and the inventory in the salvage screen, so I guess both mods aren't that compatible to each other, although I haven't noticed any error/warning in the log or game.
I'm mainly interested in auto-selling stuff, as constantly manually selling useless items is a major bummer in the game.
How do you list exceptions in BlackList: [x, y, z]?
I don't need that contract stuff of Loot Magnet either so much if I can get a working auto-sell feature in return.
However, I still get built-in blacklisted gear like Vectored Thruster Kits in the salvage list when Better Salvage is running.
Is auto-selling always updating the inventory according to ItemToKeep right after the salvage screen?
If I set this to 2 for a change, I still see plenty item stacks higher than that after the salvage screen.
If I can't get this working properly then I sadly must play without this mod, as built-in gear shouldn't drop at all to be used in other mechs either.
SalvageUnlock: just checked your code and see you remove the blacklisted tag by that. Okay, I'm going to set it this to false, as it isn't mentioned in the mod description. One problem solved!
Maybe exclude built-in gear from dopping there, although it's surely nice to have spare-parts of such sensitive built-in gear that can get destroyed like anything else I guess. Too bad you can't restrict items to certain mechs.
You'll need to set Salvage Unlock to false in the mod.json. I've updated the mod description to include this. Thanks for the report.
There was a bug in the code since most people just left it to 10 it was never reported. A new version has been updated which corrects this. Let me know if you are still seeing the issue.
Loot Magnet and this mod still seem to work fine together otherwise, as it even shows both hold-left/shift-click messages above each other in the salvage list. A neglectable ui issue as long as the selling and buttons works.
As LM doesn't have any post-salvage calculation, I doubt it could interfere with auto-selling.
I still like the salvage-stacks of LM, making such piles more worthy than single cheap items picks.
Would be a logical addition to this mod.
[HarmonyPatch(typeof(Shop), "GetAllInventoryShopItems")]
public static class Shop_GetAllInventoryShopItems_Patch {
static void Postfix(Shop __instance, ref List<ShopDefItem> __result) {
try {
SimGameState Sim = (SimGameState)ReflectionHelper.GetPrivateField(__instance, "Sim");
DataManager dataManager = Sim.DataManager;
List<ChassisDef> allInventoryMechDefs = (List<ChassisDef>)ReflectionHelper.InvokePrivateMethode(Sim, "GetAllInventoryMechParts", null);
foreach (ChassisDef chassisDef in allInventoryMechDefs) {
ShopDefItem shopDefItem = new ShopDefItem();
shopDefItem.ID = chassisDef.Description.Id.Replace("chassisdef", "mechdef");
MechDef def = Sim.DataManager.MechDefs.Get(shopDefItem.ID);
shopDefItem.Count = chassisDef.MechPartCount;
float num = (float)def.SimGameMechPartCost;
shopDefItem.SellCost = Mathf.FloorToInt(num * Sim.Constants.Finances.ShopSellModifier);
shopDefItem.Type = ShopItemType.MechPart;
__result.Add(shopDefItem);
}
}
catch (Exception e) {
Logger.LogError(e);
}
}
}