Files
DP-S_Script/示例项目/更加优雅的跨界石/更加优雅的跨界石.nut
2026-04-16 16:27:53 +08:00

76 lines
2.2 KiB
Plaintext

/*
文件名:更加优雅的跨界石.nut
路径:MyProject/更加优雅的跨界石/更加优雅的跨界石.nut
创建日期:2026-03-23
文件用途:使用附魔宝珠指针进行跨界
作者:Pluto
*/
function _Dps_Crossover_Main_() {
Cb_ExpertOnEnchantByBead_Enter_Func.Crossover <- function (args) {
local cfg = GlobalConfig.Get("更加优雅的跨界石_Pluto.json");
local SUser = User(args[1]);
local beadSlot = args[3];
local equipSlot = args[5];
local inven = SUser.GetInven();
local bead = inven.GetSlot(1,beadSlot);
local bead_id = bead.GetIndex();
local bead_add_info = bead.GetAdd_Info();
if(bead_id == cfg["功能配置"]["跨界石ID"])
{
Sq_WriteByteArr(S_Ptr("0x0849ED23"), Haker.AsmGenerateMcd(
"add esp, 0x6C",
"pop ebx",
"pop esi",
"pop edi",
"pop ebp",
"xor eax, eax", //返回值 0
"ret"
));
local equ = inven.GetSlot(1,equipSlot);
local equ_id = equ.GetIndex();
//print("[Enchant Hook] 玩家正在使用道具 ID: " + bead_id + " 装备 ID: " + equ_id + " 宝珠数量: " + bead_add_info);
//禁止跨界物品的id
local forbiddenItemIds = [27601, 27602];
//获取账号金库对象
local CargoObj = SUser.GetAccountCargo();
//获取账号金库中的一个空格子
local EmptySlot = CargoObj.GetEmptySlot();
//禁止跨界
if (cfg["功能配置"]["禁止跨界装备ID"].find(equ_id) != null) {
SUser.SendNotiBox("该装备无法跨界!", 1);
return;
}
//账号金库已满
if(EmptySlot == -1) {
SUser.SendNotiBox("账号金库已满!", 1);
return;
}
//跨界
local Flag = CargoObj.InsertItem(equ, EmptySlot);
if(Flag == -1) {
SUser.SendNotiBox("跨界失败!", 1);
return;
}else{
//销毁装备栏中的道具
equ.Delete();
//宝珠数量减一
if(bead_add_info == 1) {
bead.Delete();
}else{
bead.SetAdd_Info(bead_add_info - 1);
bead.Flush();
}
//刷新玩家装备列表
SUser.SendUpdateItemList(1, 0, equipSlot);
//刷新玩家道具列表
SUser.SendUpdateItemList(1, 0, beadSlot);
//刷新账号金库列表
CargoObj.SendItemList();
SUser.SendNotiBox("跨界成功!", 1);
}
}
}
}