private double GetSkillMultiplier(UInt32 a_SkillID, RefiningMutators a_Mutators) { UInt32 skillLevel = DictionaryGetValue(m_Settings.Refining.Skills, a_SkillID, (UInt32)0); double skillMutator = DictionaryGetValue(a_Mutators, a_SkillID, 0.0); return(1 + (skillLevel * skillMutator)); }
public bool LoadDatabase(String a_DBPath, out Hashtable a_Items, out RefiningMutators a_RefiningMutators) { a_Items = new Hashtable(); a_RefiningMutators = new RefiningMutators(); try { SQLiteConnectionStringBuilder connBuilder = new SQLiteConnectionStringBuilder(); connBuilder.FailIfMissing = true; connBuilder.DataSource = a_DBPath; connBuilder.ReadOnly = true; m_DbConnection = new SQLiteConnection(); m_DbConnection.ConnectionString = connBuilder.ToString(); m_DbConnection.Open(); if (!TestEveDatabaseTables()) { return(false); } LoadMineralCompositions(a_Items); LoadItemsProperties(a_Items); LoadRefiningMutators(a_RefiningMutators); } catch (System.Exception a_Exception) { System.Diagnostics.Debug.WriteLine(a_Exception.Message); return(false); } return(true); }
public double GetItemRefinedPrice(ItemRecord a_Item, RefiningMutators a_Mutators, UInt32 a_Quantity) { double result = 0; for (UInt32 i = 0; i < (UInt32)Materials.MaxMaterials; i++) { double refinedAmount = GetEffectiveRefineQuota(a_Item, a_Mutators, a_Quantity * a_Item.MaterialAmount[i]); result += (refinedAmount * m_Settings.MaterialPrices[i]); } return(result / a_Item.BatchSize); }
private double GetRefiningSkillBonus(ItemRecord a_Item, RefiningMutators a_Mutators) { if (0 == a_Item.RefineSkill) { return(GetSkillMultiplier((UInt32)EveSkills.ScrapmetalProcessing, a_Mutators)); } double result = 1; result *= GetSkillMultiplier((UInt32)EveSkills.Reprocessing, a_Mutators); result *= GetSkillMultiplier((UInt32)EveSkills.ReprocessingEfficiency, a_Mutators); result *= GetSkillMultiplier(a_Item.RefineSkill, a_Mutators); return(result); }
private void LoadRefiningMutators(RefiningMutators a_Result) { String sqlText = "SELECT\n" + " "+ DbField(Tables.dgmTypeAttributes, "typeID") + ",\n" + // 0 " "+ DbField(Tables.dgmTypeAttributes, "valueInt") + ",\n" + // 1 " "+ DbField(Tables.dgmTypeAttributes, "valueFloat") + "\n" + // 2 "FROM\n" + " "+ Tables.dgmTypeAttributes + "\n" + "WHERE\n" + " ("+ DbField(Tables.dgmTypeAttributes, "attributeID") + " = " + (int)EveAttributes.RefiningMutator + ")"; SQLiteCommand sqlCommand = new SQLiteCommand(sqlText, m_DbConnection); SQLiteDataReader dataReader = sqlCommand.ExecuteReader(); while (dataReader.Read()) { UInt32 typeID = (UInt32)dataReader.GetInt32(0); double value = !dataReader.IsDBNull(1) ? dataReader.GetInt32(1) : dataReader.GetFloat(2); a_Result[typeID] = value / 100.0; } }
/// <summary> /// Gets various prices and colors for an item /// </summary> /// <param name="a_Item">Item in question</param> /// <param name="a_Quantity">Quantity of the item</param> /// <param name="a_QuantityOK">true means that quantity is valid (ie assets mode + use quantities enabled)</param> /// <returns>Prices and color</returns> public ItemPrice GetItemPrices(ItemRecord a_Item, RefiningMutators a_Mutators, UInt32 a_Quantity) { ItemPrice result = new ItemPrice(); result.RefinedCost = GetItemRefinedPrice(a_Item, a_Mutators, a_Quantity); result.MarketPrice = a_Quantity * a_Item.Price; bool isError = false; if (0 == a_Item.MarketGroupID) { result.MarketPrice = ItemPrice.NonMarket; isError = true; } else if (0 == result.MarketPrice) { result.MarketPrice = ItemPrice.Unknown; isError = true; } else if (!a_Item.IsPricesOk(m_Settings.PriceLoad.Items.ExpiryDays)) { result.MarketPrice = ItemPrice.Outdated; isError = true; } else { result.PriceDelta = result.RefinedCost - result.MarketPrice; } if (isError) { result.PriceDelta = ItemPrice.Empty; } return(result); }
/// <summary> /// Gets amount of material after refining with your efficiency and skill /// Refines incomplete batches too /// </summary> public double GetEffectiveRefineQuota(ItemRecord a_Item, RefiningMutators a_Mutators, UInt32 a_Quantity, Materials a_Material) { double perfectRefinedAmount = GetPerfectRefiningQuota(a_Item, a_Quantity, a_Material); return(GetEffectiveRefineQuota(a_Item, a_Mutators, perfectRefinedAmount)); }
public double GetEffectiveRefineQuota(ItemRecord a_Item, RefiningMutators a_Mutators, double a_PerfectAmount) { return(a_PerfectAmount * GetEffectiveYield(a_Item, a_Mutators)); }
public double GetEffectiveYield(ItemRecord a_Item, RefiningMutators a_Mutators) { double skillBonus = GetRefiningSkillBonus(a_Item, a_Mutators); return(m_Settings.Refining.BaseYield * skillBonus * m_Settings.Refining.TaxMultiplier); }