50 lines
2.0 KiB
Plaintext
50 lines
2.0 KiB
Plaintext
function get_required_gradeByMaomi(dgn_id, dgn_diff) {
|
|
local Config = GlobalConfig.Get("门票进入副本配置_Maomi.json");
|
|
if (Config["门票进入副本"]["副本配置"].rawin(dgn_id.tostring())) {
|
|
local requirements = Config["门票进入副本"]["副本配置"][dgn_id.tostring()];
|
|
for (local i = 0; i< requirements.len(); i += 2) {
|
|
if (requirements[i] == dgn_diff) {
|
|
return requirements[i + 1];
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function _Dps_TicketAccessToDungeon_Maomi_Main_() {
|
|
|
|
Cb_SelectDungeon_Check_Error_Leave_Func.Check_TicketByMaomi <- function(args) {
|
|
|
|
local Config = sq_ReadJsonFile("/dp_s/OfficialConfig" + "/" + "门票进入副本配置_Maomi.json");
|
|
// local Config = GlobalConfig.Get("门票进入副本配置_Maomi.json");
|
|
|
|
local SUser = User(args[1]);
|
|
local msg_base = args[2];
|
|
local dgn_id = NativePointer(msg_base).add(13).readU16(); // 获取副本ID
|
|
local dgn_diff = NativePointer(msg_base).add(15).readU8(); // 获取副本难度
|
|
local PartyObj = SUser.GetParty();
|
|
|
|
local required_Item = get_required_gradeByMaomi(dgn_id, dgn_diff);
|
|
local diff_name = Config["副本难度命名"][(dgn_diff).tostring()];
|
|
|
|
if (!required_Item) return null;
|
|
|
|
if (PartyObj && Config["门票进入副本"]["门票进入副本开关(true为开启,false为关闭)"]) {
|
|
for (local i = 0; i< 4; ++i) {
|
|
local Tuser = PartyObj.GetUser(i);
|
|
if (Tuser) {
|
|
local InvenObj = Tuser.GetInven();
|
|
if (InvenObj) {
|
|
if (InvenObj.CheckItemCount(required_Item, 1)){
|
|
InvenObj.DeleteItemCount(required_Item, 1);
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
SUser.SendNotiBox("队伍中所有玩家均无副本所需门票,无法进入!", 2)
|
|
return 1;
|
|
}
|
|
}
|
|
} |