Skip to content

Commit 0cf836c

Browse files
Now shift smelting will only smelt selected weapons. (#5)
Now shift smelting will only smelt selected weapons.
1 parent 2838f47 commit 0cf836c

2 files changed

Lines changed: 6 additions & 39 deletions

File tree

TLSmithingFasterMod/TLSmithingFasterCraftingCampaignBehaviorDoSmeltingPatch.cs

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,54 +20,21 @@ public static void Postfix(ref CraftingCampaignBehavior __instance, Hero hero, E
2020
TLSmithingFasterOperationCounts.Flag = true;
2121
int maxcounts = TLSmithingFasterOperationCounts.GetMaxCounts(ref __instance, hero, equipmentElement);
2222
maxcounts = Math.Min(maxcounts, 4);
23-
IEnumerable<EquipmentElement> locks = Campaign.Current.GetCampaignBehavior<InventoryLockTracker>().GetLocks();
24-
ItemRoster itemRoster = MobileParty.MainParty.ItemRoster;
25-
ItemRosterElement[] ItemRosterElements = itemRoster.GetCopyOfAllElements();
26-
bool IsLocked = false;
27-
int max_item_count = ItemRosterElements.Length;
28-
for (int i = 0; i < max_item_count && maxcounts > 0; i++)
23+
for (int i = 0;i < maxcounts; i++)
2924
{
30-
itemRoster = MobileParty.MainParty.ItemRoster;
31-
ItemRosterElements = itemRoster.GetCopyOfAllElements();
32-
foreach (EquipmentElement EquipmentElement in locks)
33-
{
34-
if (EquipmentElement.IsEqualTo(ItemRosterElements[i].EquipmentElement))
35-
{
36-
IsLocked = true;
37-
break;
38-
}
39-
}
40-
int item_num = ItemRosterElements[i].Amount;
41-
int j;
42-
for (j = 0; j < item_num && !IsLocked && ItemRosterElements[i].EquipmentElement.Item.IsCraftedWeapon; j++)
43-
{
44-
__instance.DoSmelting(hero, ItemRosterElements[i].EquipmentElement);
45-
maxcounts--;
46-
if (maxcounts <= 0)
47-
{
48-
TLSmithingFasterOperationCounts.Flag = false;
49-
return;
50-
}
51-
}
52-
if (j == item_num)
53-
{
54-
i--;
55-
max_item_count--;
56-
}
57-
IsLocked = false;
25+
__instance.DoSmelting(hero, equipmentElement);
5826
}
5927
TLSmithingFasterOperationCounts.Flag = false;
6028
}
6129
if (topScreen != null && Input.IsKeyDown(InputKey.LeftControl) && !TLSmithingFasterOperationCounts.Flag)
6230
{
6331
TLSmithingFasterOperationCounts.Flag = true;
64-
int maxcounts = TLSmithingFasterOperationCounts.GetMaxCounts(ref __instance, hero, equipmentElement);
6532
IEnumerable<EquipmentElement> locks = Campaign.Current.GetCampaignBehavior<InventoryLockTracker>().GetLocks();
6633
ItemRoster itemRoster = MobileParty.MainParty.ItemRoster;
6734
ItemRosterElement[] ItemRosterElements = itemRoster.GetCopyOfAllElements();
6835
bool IsLocked = false;
6936
int max_item_count = ItemRosterElements.Length;
70-
for (int i = 0; i < max_item_count && maxcounts > 0; i++)
37+
for (int i = 0; i < max_item_count; i++)
7138
{
7239
itemRoster = MobileParty.MainParty.ItemRoster;
7340
ItemRosterElements = itemRoster.GetCopyOfAllElements();
@@ -83,13 +50,13 @@ public static void Postfix(ref CraftingCampaignBehavior __instance, Hero hero, E
8350
int j;
8451
for (j = 0; j < item_num && !IsLocked && ItemRosterElements[i].EquipmentElement.Item.IsCraftedWeapon; j++)
8552
{
86-
__instance.DoSmelting(hero, ItemRosterElements[i].EquipmentElement);
87-
maxcounts--;
53+
int maxcounts = TLSmithingFasterOperationCounts.GetMaxCounts(ref __instance, hero, ItemRosterElements[i].EquipmentElement);
8854
if (maxcounts <= 0)
8955
{
9056
TLSmithingFasterOperationCounts.Flag = false;
9157
return;
9258
}
59+
__instance.DoSmelting(hero, ItemRosterElements[i].EquipmentElement);
9360
}
9461
if (j == item_num)
9562
{

TLSmithingFasterMod/TLSmithingFasterSubModule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ protected override void OnSubModuleLoad()
1515
protected override void OnBeforeInitialModuleScreenSetAsRoot()
1616
{
1717
base.OnBeforeInitialModuleScreenSetAsRoot();
18-
InformationManager.DisplayMessage(new InformationMessage("TLSmithingFasterMod e1.3.0.1 is successfully loaded."));
18+
InformationManager.DisplayMessage(new InformationMessage("TLSmithingFasterMod e1.3.0.2 is successfully loaded."));
1919
}
2020
}
2121
}

0 commit comments

Comments
 (0)