SimCMinMax / AutoSimC

Python script to create multiple profiles for Simcraft to find Best-in-Slot and best enchants/gems/talents combination.
GNU General Public License v3.0
54 stars 17 forks source link

AutoSimC crashes importing from SimC Addon 1.10.7 if no offhand #38

Open redi-tormeyd opened 5 years ago

redi-tormeyd commented 5 years ago

SimC Addon will not provide an offhand= line when exporting a profile for a user with a two-handed item equipped leading to an AutoSimC crash. The following diff will allow AutoSimC to parse a SimC Addon export where a gear slot has been left empty -- such as off_hand when a two-handed item in main_hand

diff --git a/main.py b/main.py
index 2cd0926..7ccb249 100644
--- a/main.py
+++ b/main.py
@@ -742,7 +742,7 @@ def build_profile_simc_addon(args):
                             "potion",
                             "flask",
                             "food",
-                            "augmentation"]
+                            "augmentation", "bfa.reorigination_array_stacks"]

     # will contain any gear in file for each slot, divided by |
     gear = {}
@@ -957,7 +957,7 @@ def permutate(args, player_profile):

     # concatenate gear in bags to normal gear-list
     for b in gearInBags:
-        if b in gear:
+        if b in gear and gear[b]:
             currentGear = gear[b][0]
             if b == "finger" or b == "trinket":
                 currentGear = currentGear + "|" + gear[b][1]
@@ -969,7 +969,7 @@ def permutate(args, player_profile):
         slot_base_name = gear_slot[0]  # First mentioned "correct" item name
         parsed_gear[slot_base_name] = []
         for entry in gear_slot:
-            if entry in gear:
+            if entry in gear and gear[entry]:
                 for s in gear[entry].split("|"):
                     parsed_gear[slot_base_name].append(Item(slot_base_name, s))
         if len(parsed_gear[slot_base_name]) == 0:`
theoneandlonely commented 5 years ago

Thanks redi-tormeyd,

i just fixed that, unrelated to your ticket :)