-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.cs
107 lines (80 loc) · 3.09 KB
/
Config.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using HamstarHelpers.Classes.UI.ModConfig;
using HamstarHelpers.Helpers.User;
using Newtonsoft.Json;
using System;
using System.ComponentModel;
using Terraria;
using Terraria.ModLoader.Config;
namespace Capitalism {
class MyFloatInputElement : FloatInputElement { }
public class CapitalismConfig : ModConfig {
public override ConfigScope Mode => ConfigScope.ServerSide;
////////////////
[DefaultValue( true )]
public bool Enabled { get; set; } = true;
[Header( "Formula for computing markup:\n"+
" b=base value\n" +
" t=total purchases\n"+
" a=exponent value (default 0.8)\n"+
" c=divsor value (default 50)\n \n"+
"b + (b * t)^a / c" )]
[JsonIgnore]
[Label("Markup (+copper) for item (cost: 10 silv), bought 20x")]
public float MarkupResult1000 { get {
return 1000 + ( (float)Math.Pow(1000 * 20, this.MarkupExponent) / this.MarkupDivisor );
} }
[JsonIgnore]
[Label("Markup (+copper) for item (cost: 1 plat), bought 20x")]
public float MarkupResult1000000 { get {
return 1000000 + ( (float)Math.Pow(1000000 * 20, this.MarkupExponent) / this.MarkupDivisor );
} }
[Tooltip( "A factor for computing markup." )]
[Range( 0f, 5f )]
[DefaultValue( 0.8f )]
[CustomModConfigItem( typeof( MyFloatInputElement ) )]
public float MarkupExponent { get; set; } = 0.8f;
[Tooltip( "A factor for computing markup." )]
[Range( Single.Epsilon, 1000f )]
[DefaultValue( 50f )]
[CustomModConfigItem( typeof( MyFloatInputElement ) )]
public float MarkupDivisor { get; set; } = 50f;
[Tooltip("% markup if a Tax Collector NPC has moved in.")]
[Range( 0f, 10f )]
[DefaultValue( 1.02f )]
[CustomModConfigItem( typeof( MyFloatInputElement ) )]
public float TaxMarkupPercent { get; set; } = 1.02f;
[Tooltip("% markup after an NPC has died.")]
[Range( 0f, 10f )]
[DefaultValue( 1.5f )]
[CustomModConfigItem( typeof( MyFloatInputElement ) )]
public float InfuriationMarkupPercent { get; set; } = 1.5f;
[Tooltip("% that markup prices 'decay' to, twice per day.")]
[Range( 0f, 10f )]
[DefaultValue( 0.95f )]
[CustomModConfigItem( typeof( MyFloatInputElement ) )]
public float BiDailyDecayMarkdownPercent { get; set; } = 0.95f;
[Tooltip("% scale during a blood moon from female NPCs.")]
[Range( 0f, 10f )]
[DefaultValue( 1.1f )]
[CustomModConfigItem( typeof( MyFloatInputElement ) )]
public float FemaleBloodMoonSellPricePercent { get; set; } = 1.1f;
[Tooltip( "% scale from a 'lovestruck' NPC." )]
[Range( 0f, 10f )]
[DefaultValue( 0.9f )]
[CustomModConfigItem( typeof( MyFloatInputElement ) )]
public float LovestruckSellPricePercent { get; set; } = 0.9f;
[Tooltip( "% scale from a 'stinky' NPC." )]
[Range( 0f, 10f )]
[DefaultValue( 1.1f )]
[CustomModConfigItem( typeof( MyFloatInputElement ) )]
public float StinkySellPricePercent { get; set; } = 1.1f;
////////////////
public override bool AcceptClientChanges( ModConfig pendingConfig, int whoAmI, ref string message ) {
if( !UserHelpers.HasBasicServerPrivilege(Main.player[whoAmI]) ) {
message = "Insufficient privilege.";
return false;
}
return true;
}
}
}