Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
You are viewing a potentially older version of this package.
View all versions.
| Date uploaded | 3 months ago |
| Version | 1.0.1 |
| Download link | cn_xc-RandomValueLib-1.0.1.zip |
| Downloads | 1081 |
| Dependency string | cn_xc-RandomValueLib-1.0.1 |
README
📄 README.md markdown
RandomValueLib
核心随机价格库,为《REPO》模组提供统一的贵重物品价格随机化逻辑。
功能
- 确定性随机算法(基于物品 ID 和可选额外种子)
- 可配置倍率范围、黑白名单、现金袋保护、高价物品排除
- 提供纯计算和直接修改两种方式
- 反射读写价格字段,兼容公共化与非公共化环境
使用示例
using RandomValueLib;
var config = new RandomizationConfig
{
MinMultiplier = 0.5f,
MaxMultiplier = 2.0f,
// 根据需要设置其他规则
};
// 方式一:直接应用随机价格
float newPrice = RandomValueService.ApplyRandomPrice(valuableObject, config);
// 方式二:先判断是否随机化
if (RandomValueService.ShouldRandomize(obj, config))
{
float price = RandomValueService.GetRandomPrice(instanceID, originalPrice, config);
RandomValueService.SetItemPrice(vo, price);
}
依赖
游戏 Assembly-CSharp.dll
.NET Standard 2.0 或 .NET Framework 4.7.2
安装
将 RandomValueLib.dll 放入 BepInEx/plugins 文件夹(作为其他模组的依赖自动安装,一般无需手动操作)。
许可证
基于 MIT 许可证开源。
MIT License
Copyright (c) 2026 dyxc666
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
CHANGELOG
更新日志
[1.0.5] - 2026-05-25
适配repo 0.4.4。
[1.0.4] - 2026-05-23
适配repo 0.4.3。
[1.0.3] - 2026-05-02
更新文档。
[1.0.2] - 2026-05-02
文档
- README 添加 QQ 群信息。
[1.0.1] - 2026-04-17
修复
- 修复
ApplyRandomPrice方法中ShouldRandomize检查逻辑。
文档
- 添加 MIT 许可证。
- 更新使用示例。
[1.0.0] - 2026-04-14
- 初始版本发布。
- 核心随机算法、配置模型、反射读写价格字段。