添加示例项目
This commit is contained in:
11
示例项目/强化增幅药剂/Proj.ifo
Normal file
11
示例项目/强化增幅药剂/Proj.ifo
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"ProjectName": "强化增幅药剂",
|
||||
"ProjectDescribe": "使用指定药剂增加强化/增幅",
|
||||
"ProjectAuthor": "Pluto",
|
||||
"ProjectVersion": 1.1,
|
||||
"ProjectConfig": "强化增幅药剂_Pluto.json",
|
||||
"ProjectFiles": [
|
||||
"强化增幅药剂.nut"
|
||||
],
|
||||
"ProjectRunFunc": "_Dps_EnhancementPotion_Main_"
|
||||
}
|
||||
63
示例项目/强化增幅药剂/强化增幅药剂.nut
Normal file
63
示例项目/强化增幅药剂/强化增幅药剂.nut
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
文件名:强化药剂.nut
|
||||
路径:强化药剂/强化药剂.nut
|
||||
创建日期:2025-03-10
|
||||
文件用途:使用强化药剂增加强化成功几率
|
||||
*/
|
||||
|
||||
function _Dps_EnhancementPotion_Main_() {
|
||||
// 注册强化进入回调
|
||||
Cb_WongWork_CItemUpgrade_Enter_Func["强化药剂_逻辑"] <- function(args) {
|
||||
local Config = GlobalConfig.Get("强化增幅药剂_Pluto.json");
|
||||
local SUser = User(args[1]);
|
||||
local invenItem = args[2];
|
||||
local upgradeInfo = args[3];
|
||||
|
||||
// 检查开关
|
||||
if (!Config["开关(true/false)"]) {
|
||||
return args;
|
||||
}
|
||||
|
||||
// 检查用户是否拥有强化药剂
|
||||
local hasPotion = Sq_CallFunc(
|
||||
S_Ptr("0x865E994"),
|
||||
"int",
|
||||
["pointer", "int"],
|
||||
SUser.C_Object,
|
||||
Config["强化药剂ID"]
|
||||
);
|
||||
|
||||
if (!hasPotion) {
|
||||
return args;
|
||||
}
|
||||
|
||||
// 读取基础概率
|
||||
local probBase = NativePointer(args[0]).add(0x4EC).readU32();
|
||||
|
||||
// 获取当前强化等级和目标等级
|
||||
local currentLevel = Sq_CallFunc(S_Ptr("0x080F506C"), "int", ["pointer"], invenItem);
|
||||
local targetLevel = currentLevel + 1;
|
||||
|
||||
// 读取原始失败率
|
||||
local originalFailRate = NativePointer(upgradeInfo).add(32).readU32();
|
||||
|
||||
// 获取概率加成值
|
||||
local charac_no = SUser.GetCID().tostring();
|
||||
local boost = Config["默认增加概率"];
|
||||
|
||||
// 检查是否是指定角色,使用指定角色的概率
|
||||
if (Config["指定角色概率"].rawin(charac_no)) {
|
||||
boost = Config["指定角色概率"][charac_no];
|
||||
}
|
||||
|
||||
// 计算新的失败率
|
||||
if (boost > 0) {
|
||||
local boostAmount = (probBase * boost / 100).tointeger();
|
||||
local newFailRate = originalFailRate - boostAmount;
|
||||
if (newFailRate < 0) newFailRate = 0;
|
||||
NativePointer(upgradeInfo).add(32).writeU32(newFailRate);
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
}
|
||||
11
示例项目/强化增幅药剂/强化增幅药剂_Pluto.json
Normal file
11
示例项目/强化增幅药剂/强化增幅药剂_Pluto.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"开关(true/false)": true,
|
||||
"强化药剂ID": 2600025,
|
||||
"默认增加概率": 10,
|
||||
"指定角色概率": {
|
||||
"1": 100,
|
||||
"2": 50
|
||||
},
|
||||
"概率说明":"概率值10代表增加10%的概率",
|
||||
"指定角色说明":"角色ID可以查看数据库中 taiwan_cain → charac_info → charac_no代表角色ID"
|
||||
}
|
||||
Reference in New Issue
Block a user