Files
DP-S_Script/示例项目/指定用户强化必定成功/指定用户强化必定成功.nut
2026-04-16 16:27:53 +08:00

53 lines
1.7 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// ------------------------------------------------------------
// 指定用户强化必定成功 by Pluto
// ------------------------------------------------------------
// 核心逻辑函数
function _Dps_VipUpgrade_Main_() {
// 原生 C 函数指针:让装备强化等级 +1
local Inven_Item_IncUpgrade_Ptr = S_Ptr("0x0854B4BE");
// 封装调用函数
function IncUpgrade(item) {
return Sq_CallFunc(Inven_Item_IncUpgrade_Ptr, "int", ["pointer"], item);
}
// VIP 强化必成功回调
Cb_WongWork_CItemUpgrade_Leave_Func.VipUpgrade <- function(args) {
local Config = GlobalConfig.Get("指定用户强化必定成功_Pluto.json");
local vip_user_uid = Config["指定用户的UID"];
local vip_user_cid = Config["指定用户的CID"];
print("=== 强化回调触发 ===");
// 原函数返回值(不破坏 args
local OldRet = args[args.len() - 1];
// args[1] 是玩家对象args[2] 是装备对象
local SUser = User(args[1]);
local item = args[2];
local uid = SUser.GetUID();
local cid = SUser.GetCID();
// 仅对 VIP UID 生效
if (vip_user_uid.find(uid) != null || vip_user_cid.find(cid) != null) {
if (OldRet == 0) {
print("VIP 玩家原强化失败,强制成功: " + SUser.GetCharacName());
local newLvl = IncUpgrade(item);
print("强化后等级: " + newLvl);
return 1; // 强制返回成功
} else {
print("VIP 玩家原强化成功,不修改: " + SUser.GetCharacName());
}
}
// 默认返回原结果
//return OldRet;
}
}