public void UpdateMaterials() { try { lock (MaterialList) { MaterialList.Clear(); List <CastSpellAction> castSpellList = CastSpellAction.GetCastSpellActionList(CurrentProfile.Branch); if (castSpellList != null) { foreach (CastSpellAction ca in castSpellList) { if (ca.IsRecipe) { foreach (var ingred in ca.Recipe.Ingredients) { MaterialList[ingred.ID] = MaterialList.ContainsKey(ingred.ID) ? MaterialList[ingred.ID] + (ca.CalculatedRepeat > 0 ? (int)ingred.Required * (ca.CalculatedRepeat - ca.Casted) : 0) : (ca.CalculatedRepeat > 0 ? (int)ingred.Required * (ca.CalculatedRepeat - ca.Casted) : 0); } } } } } } catch (Exception ex) { Err(ex.ToString()); } }
public void UpdateMaterials() { if (!_init) { return; } try { lock (MaterialList) { MaterialList.Clear(); List <CastSpellAction> castSpellList = CastSpellAction.GetCastSpellActionList(PbBehavior); if (castSpellList != null) { foreach (CastSpellAction ca in castSpellList) { if (ca.IsRecipe && ca.RepeatType != CastSpellAction.RepeatCalculationType.Craftable) { foreach (Ingredient ingred in ca.Recipe.Ingredients) { MaterialList[ingred.ID] = MaterialList.ContainsKey(ingred.ID) ? MaterialList[ingred.ID] + (ca.CalculatedRepeat > 0 ? (int)ingred.Required * (ca.CalculatedRepeat - ca.Casted) : 0) : (ca.CalculatedRepeat > 0 ? (int)ingred.Required * (ca.CalculatedRepeat - ca.Casted) : 0); } } } } } } catch (Exception ex) { Err(ex.ToString()); } }