Added an item type price multiplier override to GetFleaBasePriceMultiplier
All keycards now use a `2.5` multiplier, not just the red keycard
This commit is contained in:
@@ -348,9 +348,11 @@
|
||||
"useHandbookPrice": true,
|
||||
"priceMultiplier": 1.5,
|
||||
"itemTplMultiplierOverride": {
|
||||
"5780cf7f2459777de4559322": 1.8,
|
||||
"5c1d0efb86f7744baf2e7b7b": 2.5
|
||||
"5780cf7f2459777de4559322": 1.8
|
||||
},
|
||||
"itemTypeMultiplierOverride": {
|
||||
"5c164d2286f774194c5e69fa": 2.5
|
||||
},
|
||||
"preventPriceBeingBelowTraderBuyPrice": true
|
||||
}
|
||||
},
|
||||
|
||||
@@ -254,6 +254,9 @@ public record GenerateFleaPrices
|
||||
|
||||
[JsonPropertyName("itemTplMultiplierOverride")]
|
||||
public Dictionary<MongoId, double> ItemTplMultiplierOverride { get; set; }
|
||||
|
||||
[JsonPropertyName("itemTypeMultiplierOverride")]
|
||||
public Dictionary<MongoId, double> ItemTypeMultiplierOverride { get; set; }
|
||||
}
|
||||
|
||||
public record PriceRanges
|
||||
|
||||
@@ -76,18 +76,12 @@ public class RagfairPriceService(
|
||||
foreach (var (itemTpl, handbookPrice) in StaticPrices)
|
||||
{
|
||||
// Get new price to use
|
||||
var newBasePrice = handbookPrice * RagfairConfig.Dynamic.GenerateBaseFleaPrices.PriceMultiplier;
|
||||
var newBasePrice = handbookPrice * GetFleaBasePriceMultiplier(itemTpl);
|
||||
if (newBasePrice == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Specific item multiplier may exist, check for it
|
||||
if (RagfairConfig.Dynamic.GenerateBaseFleaPrices.ItemTplMultiplierOverride.TryGetValue(itemTpl, out var specificItemMultiplier))
|
||||
{
|
||||
newBasePrice = handbookPrice * specificItemMultiplier;
|
||||
}
|
||||
|
||||
if (RagfairConfig.Dynamic.GenerateBaseFleaPrices.PreventPriceBeingBelowTraderBuyPrice)
|
||||
{
|
||||
// Check if item can be sold to trader for a higher price than what we're going to set
|
||||
@@ -103,6 +97,31 @@ public class RagfairPriceService(
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the multiplier to apply to a handbook price to create the base flea price of an item
|
||||
/// </summary>
|
||||
/// <param name="itemTpl">Item to look up multiplier of</param>
|
||||
/// <returns>Multiplier value</returns>
|
||||
protected double GetFleaBasePriceMultiplier(MongoId itemTpl)
|
||||
{
|
||||
// Specific item multiplier may exist, check for it
|
||||
if (RagfairConfig.Dynamic.GenerateBaseFleaPrices.ItemTplMultiplierOverride.TryGetValue(itemTpl, out var specificItemMultiplier))
|
||||
{
|
||||
return specificItemMultiplier;
|
||||
}
|
||||
|
||||
// Check if tpl is of each time, if it is, use that multi
|
||||
foreach (var (itemType, multiplier) in RagfairConfig.Dynamic.GenerateBaseFleaPrices.ItemTypeMultiplierOverride)
|
||||
{
|
||||
if (itemHelper.IsOfBaseclass(itemTpl, itemType))
|
||||
{
|
||||
return multiplier;
|
||||
}
|
||||
}
|
||||
|
||||
return RagfairConfig.Dynamic.GenerateBaseFleaPrices.PriceMultiplier;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the dynamic price for an item. If value doesn't exist, use static (handbook) value.
|
||||
/// if no static value, return 1
|
||||
|
||||
Reference in New Issue
Block a user