refactor: 清理代码格式并修复拼写错误

移除多余空行并修正Timer.SetTimeOut方法名拼写
调整随机数生成范围避免数组越界
添加调试打印语句用于测试
This commit is contained in:
2026-05-03 19:59:02 +08:00
parent a71fb179ef
commit 70376c380e
4 changed files with 22 additions and 5 deletions

View File

@@ -140,6 +140,24 @@ class StealSystem {
RequestCache[cid].rawset(npcId, 2);
}.bindenv(this));
ClientSocketPackFuncMap.rawset(21017005, function(SUser, Jso) {
local InvenObj = SUser.GetInven();
local itemSlot = InvenObj.GetSlotById(UseItem);
if (itemSlot == -1) {
SUser.SendJso({
op = 21017006,
ret = false
});
return;
}
else{
InvenObj.DeleteItemCount(UseItem, 1);
SUser.SendNotiPacketMessage("密码错误,已消耗一个材料!", 8);
}
}.bindenv(this));
}
function InitDailyResetTask() {
@@ -187,7 +205,7 @@ class StealSystem {
function GetRandomGroupName() {
local groupNames = ["normal", "rarity", "epic"];
return groupNames[MathClass.Rand(0, groupNames.len() - 1)];
return groupNames[MathClass.Rand(0, groupNames.len())];
}
function RollRewardFromGroup(GroupData) {