DP-S_Script/MyProject/A.nut

104 lines
3.7 KiB
Plaintext

Gm_InputFunc_Handle["给"] <- function(SUser, CmdString) {
local count = -1;
local pos = 0;
local handler = [];
do {
local start = pos;
pos = CmdString.find(" ", pos + 1);
if (pos != null) {
handler.append(CmdString.slice(start + 1, pos));
} else
handler.append(CmdString.slice(start + 1));
count = count + 1
} while (pos != null)
//得到空格数量
if (count == 1) {
local Ret = SUser.GiveItem(handler[1].tointeger(), 1);
if (!Ret) SUser.SendNotiPacketMessage("发送失败背包是不是满了", 8);
} else if (count == 2) {
local Ret = SUser.GiveItem(handler[1].tointeger(), handler[2].tointeger());
if (!Ret) SUser.SendNotiPacketMessage("发送失败背包是不是满了", 8);
}
}
Timer.SetTimeOut(function() {
Haker.LoadHook("0x0830ADF6", ["pointer", "pointer", "pointer", "pointer", "int", "int", "int", "int", "int", "pointer", "float", "int", "void"],
function(args) {
local SParty = Party(NativePointer(args[0]).readPointer());
local map_monster_param = NativePointer(Haker.CpuContext.ebp).add(0x10).readPointer();
local monster_uid = NativePointer(NativePointer(Haker.CpuContext.ebp).add(0x18).readPointer()).readU16();
Sq_WriteByteArr(S_Ptr("0x830ADFB"), Haker.AsmGenerateMcd(
"pop esi",
"pop edi",
"pop ebp",
"ret"));
return null;
},
function(args) {
//还原
Sq_WriteByteArr(S_Ptr("0x830ADFB"), [0x53, 0x81, 0xec, 0x7c, 0x01]);
return null;
});
}, 1)
Timer.SetTimeOut(function() {
local Config = sq_ReadJsonFile("/dp_s/OfficialConfig" + "/" + "门票进入副本配置_Maomi.json");
// local Config = GlobalConfig.Get("门票进入副本配置_Maomi.json");
print(Config);
}, 1);
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;
}
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))
return null;
}
}
}
SUser.SendNotiBox("队伍中所有玩家均无副本所需门票,无法进入!", 2)
return 1;
}
}