DP-S-Script/OfficialProject/副本需要持有道具进入/副本需要持有道具进入.nut

38 lines
902 B
Plaintext
Raw Normal View History

2025-04-21 13:36:35 +08:00
function _Dps_MapNeedItem_Main_() {
// 禁止进入副本
Cb_SelectDungeon_Check_Error_Leave_Func.MapNeedItem <- function (args) {
local Config = GlobalConfig.Get("副本需要持有道具进入_Lenheart.json");
local body = Config["副本需要持有道具才允许进入"];
local SUser = User(args[1]);
local mapid = NativePointer(args[2]).add(13).readShort();
if(body.rawin(mapid.tostring())){
local ItemId = body[mapid.tostring()];
local PartyObj = SUser.GetParty();
if (!PartyObj) {
return;
}
for (local i = 0; i < 4; ++i) {
local PSUser = PartyObj.GetUser(i);
if (PSUser) {
local InvenObj = SUser.GetInven();
local SlotIdx = InvenObj.GetSlotById(ItemId);
if(SlotIdx == -1){
SUser.SendNotiBox(Config["公告"]+PvfItem.GetNameById(ItemId),1);
return 1; // 禁止进入副本
}
}
}
}
}
}