Exemplo n.º 1
0
 static void Postfix(RefinementVM __instance, Hero currentCraftingHero, ref RefinementActionItemVM ____currentSelectedAction)
 {
     if (repeating)
     {
         return;
     }
     if (____currentSelectedAction != null && Input.IsKeyDown(InputKey.LeftControl))
     {
         repeating = true;
         int maxfailsafe = 100;
         while (maxfailsafe-- > 0 && ____currentSelectedAction != null)
         {
             __instance.ExecuteSelectedRefinement(currentCraftingHero);
         }
         repeating = false;
     }
 }
Exemplo n.º 2
0
 private static bool Prefix(RefinementVM __instance, Hero currentCraftingHero)
 {
     if (__instance.CurrentSelectedAction != null)
     {
         ICraftingCampaignBehavior craftingBehavior = (ICraftingCampaignBehavior)Traverse.Create(__instance).Field("_craftingBehavior").GetValue();
         var formula    = __instance.CurrentSelectedAction.RefineFormula;
         var itemRoster = MobileParty.MainParty.ItemRoster;
         if (craftingBehavior != null)
         {
             if (Input.IsKeyDown(InputKey.LeftShift))
             {
                 if (Input.IsKeyDown(InputKey.LeftControl))
                 {
                     while (craftingBehavior.GetHeroCraftingStamina(currentCraftingHero) >= Campaign.Current.Models.SmithingModel.GetEnergyCostForRefining(ref formula, currentCraftingHero) &&
                            HasEnoughCraftingMaterial(itemRoster, formula))
                     {
                         craftingBehavior.DoRefinement(currentCraftingHero, __instance.CurrentSelectedAction.RefineFormula);
                     }
                 }
                 else
                 {
                     for (int i = 0; i < 10 &&
                          craftingBehavior.GetHeroCraftingStamina(currentCraftingHero) >= Campaign.Current.Models.SmithingModel.GetEnergyCostForRefining(ref formula, currentCraftingHero) &&
                          HasEnoughCraftingMaterial(itemRoster, formula); i++)
                     {
                         craftingBehavior.DoRefinement(currentCraftingHero, __instance.CurrentSelectedAction.RefineFormula);
                     }
                 }
             }
             else
             {
                 craftingBehavior.DoRefinement(currentCraftingHero, __instance.CurrentSelectedAction.RefineFormula);
             }
         }
         __instance.RefreshRefinementActionsList(currentCraftingHero);
         RefinementActionItemVM currentSelectedAction = __instance.CurrentSelectedAction;
         if (currentSelectedAction != null && !currentSelectedAction.IsEnabled)
         {
             currentSelectedAction = null;
         }
     }
     return(false);
 }