public static void SaveReactivePricing(ReactivePricingStruct pricingData) { TextWriter writer = MyAPIGateway.Utilities.WriteFileInWorldStorage(WorldStoragePricescaleFilename, typeof(ReactivePricingStruct)); writer.Write(MyAPIGateway.Utilities.SerializeToXML <ReactivePricingStruct>(pricingData)); writer.Flush(); writer.Close(); }
private static ReactivePricingStruct InitPricing() { ReactivePricingStruct pricing = new ReactivePricingStruct(); // This entire section should instead load / create the list at server start so that nothing but simple maths is performed in reactive pricing so there is // negligable performance impact to lcds pricing.Prices.Add(new PricingStruct(10, 1.1m, "Critical stock 10 or less 10% increase")); pricing.Prices.Add(new PricingStruct(50, 1.1m, "Low Stock 11 to 50 10% increase")); pricing.Prices.Add(new PricingStruct(100, 1.05m, "Could be better 51 to 100 5% increase")); pricing.Prices.Add(new PricingStruct(1000, 1m, "About right 101 to 5000 no change")); pricing.Prices.Add(new PricingStruct(5000, 0.95m, "Bit high 5001- 10000 drop price 5%")); pricing.Prices.Add(new PricingStruct(10000, 0.95m, "Getting fuller 10001 to 50000 drop another 5%")); pricing.Prices.Add(new PricingStruct(50000, 0.90m, "Way too much now drop another 10%")); pricing.Prices.Add(new PricingStruct(100000, 0.50m, "Getting out of hand drop another 50%")); pricing.Prices.Add(new PricingStruct(200000, 0.25m, "Ok we need to dump this stock now 75% price drop")); return(pricing); }