添加示例项目
This commit is contained in:
38
示例项目/副本需要持有道具进入/副本需要持有道具进入.nut
Normal file
38
示例项目/副本需要持有道具进入/副本需要持有道具进入.nut
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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; // 禁止进入副本
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user