|
| 1 | +using System; |
| 2 | + |
1 | 3 | namespace Turbo.Catalog.Configuration; |
2 | 4 |
|
3 | 5 | public class CatalogConfig |
4 | 6 | { |
5 | 7 | public const string SECTION_NAME = "Turbo:Catalog"; |
| 8 | + |
| 9 | + /// <summary> |
| 10 | + /// Configuration for LTD raffle weighting criteria. |
| 11 | + /// </summary> |
| 12 | + public LtdRaffleWeightConfig LtdRaffle { get; set; } = new(); |
| 13 | +} |
| 14 | + |
| 15 | +/// <summary> |
| 16 | +/// Configuration for LTD raffle weighting criteria. |
| 17 | +/// Hotel owners can tune these values to define their own fairness criteria. |
| 18 | +/// </summary> |
| 19 | +public class LtdRaffleWeightConfig |
| 20 | +{ |
| 21 | + /// <summary> |
| 22 | + /// Base weight given to all participants (ensures everyone has a chance). |
| 23 | + /// </summary> |
| 24 | + public double BaseWeight { get; set; } = 1.0; |
| 25 | + |
| 26 | + /// <summary> |
| 27 | + /// Default buffer window in seconds. |
| 28 | + /// </summary> |
| 29 | + public int DefaultBufferSeconds { get; set; } = 20; |
| 30 | + |
| 31 | + /// <summary> |
| 32 | + /// If true, uses pure random selection (equal chance for all). |
| 33 | + /// Set to true to disable all weighting. |
| 34 | + /// </summary> |
| 35 | + public bool UsePureRandom { get; set; } = false; |
| 36 | + |
| 37 | + /// <summary> |
| 38 | + /// If true, serial numbers are assigned randomly (Habbo style). |
| 39 | + /// If false, they are assigned sequentially (1, 2, 3...). |
| 40 | + /// </summary> |
| 41 | + public bool RandomizeSerials { get; set; } = true; |
| 42 | + |
| 43 | + /// <summary> |
| 44 | + /// If true, each player can only win one item per LTD series. |
| 45 | + /// If false, players can buy as many as they want (if stock permits). |
| 46 | + /// </summary> |
| 47 | + public bool LimitOnePerCustomer { get; set; } = true; |
| 48 | + |
| 49 | + /// <summary> |
| 50 | + /// Maximum number of entries accepted per raffle batch. |
| 51 | + /// Prevents unbounded memory growth during the buffer window. |
| 52 | + /// </summary> |
| 53 | + public int MaxEntriesPerBatch { get; set; } = 5000; |
| 54 | + |
| 55 | + /// <summary> |
| 56 | + /// Badge count weighting configuration. |
| 57 | + /// </summary> |
| 58 | + public WeightCriterion BadgeCount { get; set; } = |
| 59 | + new() |
| 60 | + { |
| 61 | + Enabled = true, |
| 62 | + BonusPerUnit = 0.02, |
| 63 | + MaxBonus = 1.0, |
| 64 | + }; |
| 65 | + |
| 66 | + /// <summary> |
| 67 | + /// Account age (days) weighting configuration. |
| 68 | + /// </summary> |
| 69 | + public WeightCriterion AccountAgeDays { get; set; } = |
| 70 | + new() |
| 71 | + { |
| 72 | + Enabled = true, |
| 73 | + BonusPerUnit = 0.00137, // ~0.5 per year |
| 74 | + MaxBonus = 0.5, |
| 75 | + }; |
| 76 | + |
| 77 | + /// <summary> |
| 78 | + /// Online time (minutes) weighting configuration. |
| 79 | + /// Note: Requires online time tracking to be implemented. |
| 80 | + /// </summary> |
| 81 | + public WeightCriterion OnlineTimeMinutes { get; set; } = |
| 82 | + new() |
| 83 | + { |
| 84 | + Enabled = false, |
| 85 | + BonusPerUnit = 0.00005, |
| 86 | + MaxBonus = 0.5, |
| 87 | + }; |
| 88 | + |
| 89 | + /// <summary> |
| 90 | + /// Room count weighting configuration. |
| 91 | + /// </summary> |
| 92 | + public WeightCriterion RoomCount { get; set; } = |
| 93 | + new() |
| 94 | + { |
| 95 | + Enabled = false, |
| 96 | + BonusPerUnit = 0.05, |
| 97 | + MaxBonus = 0.5, |
| 98 | + }; |
| 99 | + |
| 100 | + /// <summary> |
| 101 | + /// Furniture count weighting configuration. |
| 102 | + /// </summary> |
| 103 | + public WeightCriterion FurnitureCount { get; set; } = |
| 104 | + new() |
| 105 | + { |
| 106 | + Enabled = false, |
| 107 | + BonusPerUnit = 0.001, |
| 108 | + MaxBonus = 0.5, |
| 109 | + }; |
| 110 | + |
| 111 | + /// <summary> |
| 112 | + /// Friend count weighting configuration. |
| 113 | + /// </summary> |
| 114 | + public WeightCriterion FriendCount { get; set; } = |
| 115 | + new() |
| 116 | + { |
| 117 | + Enabled = false, |
| 118 | + BonusPerUnit = 0.01, |
| 119 | + MaxBonus = 0.5, |
| 120 | + }; |
| 121 | + |
| 122 | + /// <summary> |
| 123 | + /// Respects earned (from other users) weighting configuration. |
| 124 | + /// </summary> |
| 125 | + public WeightCriterion RespectsReceived { get; set; } = |
| 126 | + new() |
| 127 | + { |
| 128 | + Enabled = false, |
| 129 | + BonusPerUnit = 0.005, |
| 130 | + MaxBonus = 0.5, |
| 131 | + }; |
| 132 | + |
| 133 | + /// <summary> |
| 134 | + /// Achievement score weighting configuration. |
| 135 | + /// </summary> |
| 136 | + public WeightCriterion AchievementScore { get; set; } = |
| 137 | + new() |
| 138 | + { |
| 139 | + Enabled = false, |
| 140 | + BonusPerUnit = 0.0001, |
| 141 | + MaxBonus = 0.5, |
| 142 | + }; |
| 143 | +} |
| 144 | + |
| 145 | +/// <summary> |
| 146 | +/// Configuration for a single weighting criterion. |
| 147 | +/// </summary> |
| 148 | +public class WeightCriterion |
| 149 | +{ |
| 150 | + /// <summary> |
| 151 | + /// Whether this criterion is used in weight calculation. |
| 152 | + /// </summary> |
| 153 | + public bool Enabled { get; set; } |
| 154 | + |
| 155 | + /// <summary> |
| 156 | + /// Bonus weight added per unit of this criterion. |
| 157 | + /// </summary> |
| 158 | + public double BonusPerUnit { get; set; } |
| 159 | + |
| 160 | + /// <summary> |
| 161 | + /// Maximum bonus that can be gained from this criterion. |
| 162 | + /// </summary> |
| 163 | + public double MaxBonus { get; set; } |
6 | 164 | } |
0 commit comments