Compare commits
4 Commits
237bcf8719
...
3e73f1ae54
| Author | SHA1 | Date |
|---|---|---|
|
|
3e73f1ae54 | |
|
|
825ab4366c | |
|
|
2d6e633410 | |
|
|
7f547f5fd4 |
|
|
@ -15,4 +15,81 @@ class GameManager extends Base_C_Object {
|
|||
local C_Party = Sq_GameManager_GetParty(C_Object);
|
||||
return Party(C_Party);
|
||||
}
|
||||
|
||||
//设置游戏最大等级
|
||||
function SetGameMaxLevel(MaxLevel) {
|
||||
NativePointer("0x8360C38").add(3).writeU8(MaxLevel);
|
||||
NativePointer("0x8360C76").add(3).writeU8(MaxLevel);
|
||||
NativePointer("0x8360CC1").add(3).writeU8(MaxLevel);
|
||||
NativePointer("0x84EF802").add(3).writeU8(MaxLevel);
|
||||
NativePointer("0x858F002").add(3).writeU8(MaxLevel);
|
||||
NativePointer("0x865A5C0").add(1).writeU8(MaxLevel);
|
||||
NativePointer("0x865B091").add(4).writeU8(MaxLevel);
|
||||
NativePointer("0x865B757").add(4).writeU8(MaxLevel);
|
||||
NativePointer("0x8662F53").add(2).writeU8(MaxLevel);
|
||||
NativePointer("0x86630F0").add(3).writeU8(MaxLevel);
|
||||
NativePointer("0x86638F4").add(2).writeU8(MaxLevel);
|
||||
NativePointer("0x8665D24").add(4).writeU8(MaxLevel);
|
||||
NativePointer("0x8666E9A").add(2).writeU8(MaxLevel);
|
||||
NativePointer("0x866A4A6").add(2).writeU8(MaxLevel);
|
||||
NativePointer("0x866A657").add(2).writeU8(MaxLevel);
|
||||
NativePointer("0x866A926").add(3).writeU8(MaxLevel);
|
||||
NativePointer("0x866A93F").add(2).writeU8(MaxLevel);
|
||||
NativePointer("0x867AEC0").add(2).writeU8(MaxLevel);
|
||||
NativePointer("0x8689D48").add(3).writeU8(MaxLevel);
|
||||
NativePointer("0x868fecb").add(3).writeU8(MaxLevel);
|
||||
NativePointer("0x868fed4").add(6).writeU8(MaxLevel);
|
||||
}
|
||||
|
||||
//设置装备解锁需要时间
|
||||
function SetItemLockTime(time) {
|
||||
NativePointer("0x8402D29").writeInt(time);
|
||||
NativePointer("0x854242F").writeInt(time);
|
||||
NativePointer("0x854274D").writeInt(time);
|
||||
NativePointer("0x854296F").writeInt(time);
|
||||
NativePointer("0x8542AD9").writeInt(time);
|
||||
NativePointer("0x8542BDE").writeInt(time);
|
||||
}
|
||||
|
||||
//开启创建鼠标妹
|
||||
function OpenCreateJob_CreatorMage() {
|
||||
Sq_WriteByteArr(S_Ptr("0x81C029F"), [0xf]);
|
||||
}
|
||||
|
||||
//开启获得魔法封印时自动解除魔法封印
|
||||
function OpenRandomAutomaticUnblocking() {
|
||||
Cb_User_Insert_Item_Leave_Func.Rindro <- function(args) {
|
||||
local SUser = User(NativePointer(args[0]).readPointer());
|
||||
local InvenObj = SUser.GetInven();
|
||||
local idx = args.pop();
|
||||
if (idx > 0) {
|
||||
local inven_item = InvenObj.GetSlot(1, idx);
|
||||
local item_id = inven_item.GetIndex();
|
||||
local pvfitem = PvfItem.GetPvfItemById(item_id);
|
||||
//如果是魔法封印装备
|
||||
if (!pvfitem.IsRandomOption()) {
|
||||
return;
|
||||
}
|
||||
local random_option = NativePointer(inven_item.C_Object).add(37);
|
||||
if (random_option.readU32() || random_option.add(4).readU32() || random_option.add(8).readShort()) {
|
||||
return;
|
||||
}
|
||||
NativePointer(inven_item.C_Object).add(37).add(0).writeU8(1);
|
||||
}
|
||||
SUser.SendItemSpace(0);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//开启自动热重载
|
||||
function OpenHotFix(Path = "/dp_s/MyProject") {
|
||||
print("DP-S开启自动重载脚本功能,重载目录为: " + Path + " .");
|
||||
print("请注意如果你不处于DP-S开发环境,请关闭此功能,以免对性能造成影响");
|
||||
Sq_AutoReload(Path);
|
||||
}
|
||||
}
|
||||
//热重载
|
||||
function _Reload_List_Write_(Path) {
|
||||
dofile(Path);
|
||||
print("位于 [" + Path + "] 的脚本已重载")
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
文件名:HackerClass.nut
|
||||
路径:Dps_A/BaseClass/HackerClass/HackerClass.nut
|
||||
创建日期:2024-09-22 11:33
|
||||
文件用途:黑客类
|
||||
*/
|
||||
class _Hacker {
|
||||
HookTable = null;
|
||||
|
||||
constructor() {
|
||||
HookTable = {};
|
||||
}
|
||||
|
||||
function UnLoadHook(AddressStr) {
|
||||
Sq_DeHookFunc(HookTable[AddressStr]);
|
||||
}
|
||||
|
||||
function LoadHook(AddressStr, ArgumentArr, EnterFunc, LeaveFunc) {
|
||||
//如果已经HOOK过 需要先卸载原来的HOOK
|
||||
if (HookTable.rawin(AddressStr)) {
|
||||
UnLoadHook(AddressStr);
|
||||
print("地址: " + AddressStr + " 已经装载了Hook,本次操作将会卸载之前的Hook在执行。")
|
||||
}
|
||||
|
||||
local Controler = Sq_HookFunc(S_Ptr(AddressStr), ArgumentArr, EnterFunc, LeaveFunc);
|
||||
HookTable.rawset(AddressStr, Controler);
|
||||
}
|
||||
}
|
||||
//初始化Hacker
|
||||
Haker <- _Hacker();
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
文件名:IOClass.nut
|
||||
路径:Dps_A/BaseClass/IOClass/IOClass.nut
|
||||
创建日期:2024-09-19 14:13
|
||||
文件用途:IO流类
|
||||
*/
|
||||
class IO extends Base_C_Object {
|
||||
_Fopen_Address = Module.getExportByName(null, "fopen");
|
||||
_Fgetc_Address = Module.getExportByName(null, "fgetc");
|
||||
_Fputc_Address = Module.getExportByName(null, "fputc");
|
||||
_Fgets_Address = Module.getExportByName(null, "fgets");
|
||||
_Fputs_Address = Module.getExportByName(null, "fputs");
|
||||
_Fread_Address = Module.getExportByName(null, "fread");
|
||||
_Fwrite_Address = Module.getExportByName(null, "fwrite");
|
||||
_Fclose_Address = Module.getExportByName(null, "fclose");
|
||||
_Fseek_Address = Module.getExportByName(null, "fseek");
|
||||
_Ftell_Address = Module.getExportByName(null, "ftell");
|
||||
_Rewind_Address = Module.getExportByName(null, "rewind");
|
||||
|
||||
|
||||
|
||||
Pos = 0;
|
||||
|
||||
constructor(FileName, Modes) {
|
||||
local FileObj = Sq_CallFunc(_Fopen_Address, "pointer", ["pointer", "pointer"], Str_Ptr(FileName), Str_Ptr(Modes));
|
||||
if (FileObj) {
|
||||
base.constructor(FileObj);
|
||||
} else error("文件打开错误! FileName: " + FileName);
|
||||
}
|
||||
|
||||
//读取一行
|
||||
function ReadLine() {
|
||||
local Buffer = Memory.alloc(256);
|
||||
local RetFlag = Sq_CallFunc(_Fgets_Address, "pointer", ["pointer", "int", "pointer"], Buffer.C_Object, 256, this.C_Object);
|
||||
if (RetFlag)
|
||||
return Buffer.readUtf8String();
|
||||
}
|
||||
|
||||
//读取一个
|
||||
function Read() {
|
||||
local RetFlag = Sq_CallFunc(_Fgetc_Address, "char", ["pointer"], this.C_Object);
|
||||
if (RetFlag) {
|
||||
return RetFlag;
|
||||
}
|
||||
}
|
||||
|
||||
//读取指定大小
|
||||
function ReadBuffer(size) {
|
||||
local Buffer = Memory.alloc(size);
|
||||
local RetFlag = Sq_CallFunc(_Fread_Address, "int", ["pointer", "int", "int", "pointer"], Buffer.C_Object, 1, size, this.C_Object);
|
||||
if (RetFlag > 0) {
|
||||
return {
|
||||
count = RetFlag,
|
||||
str = Buffer.readUtf8String(RetFlag)
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
count = 0,
|
||||
str = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//写入字符串
|
||||
function Write(Str) {
|
||||
local Buffer = Memory.allocUtf8String(Str);
|
||||
Sq_CallFunc(_Fputs_Address, "int", ["pointer", "pointer"], Buffer.C_Object, this.C_Object);
|
||||
}
|
||||
|
||||
|
||||
//关闭文件
|
||||
function Close() {
|
||||
Sq_CallFunc(_Fclose_Address, "pointer", ["pointer"], this.C_Object);
|
||||
}
|
||||
}
|
||||
|
|
@ -132,7 +132,4 @@ class Item extends Base_C_Object {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
文件名:MD5Class.nut
|
||||
路径:Dps_A/BaseClass/MD5Class/MD5Class.nut
|
||||
创建日期:2024-09-20 00:06
|
||||
文件用途:MD5类
|
||||
*/
|
||||
class MD5 {
|
||||
MD5_Init_ptr = Module.getExportByName(null, "MD5_Init");
|
||||
MD5_Update_ptr = Module.getExportByName(null, "MD5_Update");
|
||||
MD5_Final_ptr = Module.getExportByName(null, "MD5_Final");
|
||||
|
||||
function MD5_Init(Ctx) {
|
||||
Sq_CallFunc(MD5_Init_ptr, "void", ["pointer"], Ctx);
|
||||
}
|
||||
|
||||
function MD5_Update(Ctx, Buffer, Size) {
|
||||
Sq_CallFunc(MD5_Update_ptr, "void", ["pointer", "pointer", "int"], Ctx, Buffer, Size);
|
||||
}
|
||||
|
||||
function MD5_Final(Ctx, Result) {
|
||||
Sq_CallFunc(MD5_Final_ptr, "void", ["pointer", "pointer"], Ctx, Result);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (i) {
|
||||
for (j = i; j< 3; j++) {
|
||||
charArray3[j] = 0;
|
||||
}
|
||||
|
||||
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 (j = 0; j< i + 1; j++) {
|
||||
encoded += base64_chars[charArray4[j]];
|
||||
}
|
||||
|
||||
while (i++<3) {
|
||||
encoded += "=";
|
||||
}
|
||||
}
|
||||
|
||||
return encoded;
|
||||
}
|
||||
|
||||
function GetFile(FileName) {
|
||||
local Io = IO(FileName, "r+");
|
||||
|
||||
local Ctx = Memory.alloc(0x100);
|
||||
MD5.MD5_Init(Ctx.C_Object);
|
||||
|
||||
while (true) {
|
||||
local Buffer = Memory.alloc(0x1000);
|
||||
local Res = Io.ReadBuffer(0x1000);
|
||||
if (Res.count == 0) break;
|
||||
MD5.MD5_Update(Ctx.C_Object, Memory.allocUtf8String(Res.str).C_Object, Res.count);
|
||||
}
|
||||
|
||||
local Result = Memory.alloc(16);
|
||||
MD5.MD5_Final(Result.C_Object, Ctx.C_Object);
|
||||
Io.Close();
|
||||
return base64_encode(Result.readUtf8String(16));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,187 @@
|
|||
/*
|
||||
文件名:MemoryClass.nut
|
||||
路径:Dps_A/BaseClass/MemoryClass/MemoryClass.nut
|
||||
创建日期:2024-09-17 08:23
|
||||
文件用途:内存类
|
||||
*/
|
||||
class Memory {
|
||||
|
||||
function alloc(Size) {
|
||||
return NativePointer(Size);
|
||||
}
|
||||
|
||||
function allocUtf8String(Str) {
|
||||
return NativePointer(Str_Ptr(Str));
|
||||
}
|
||||
}
|
||||
|
||||
class NativePointer extends Base_C_Object {
|
||||
|
||||
constructor(T) {
|
||||
if (typeof T == "integer") {
|
||||
base.constructor(Sq_New_Point(T));
|
||||
//注册销毁伪析构
|
||||
Register_Destruction(C_Object, this);
|
||||
} else if (typeof T == "userdata") {
|
||||
base.constructor(T);
|
||||
} else if (typeof T == "string") {
|
||||
base.constructor(S_Ptr(T));
|
||||
}
|
||||
}
|
||||
|
||||
function add(intoffset) {
|
||||
this.C_Object = Sq_PointerOperation(this.C_Object, intoffset, "+");
|
||||
return this;
|
||||
}
|
||||
|
||||
function sub(intoffset) {
|
||||
this.C_Object = Sq_PointerOperation(this.C_Object, intoffset, "-");
|
||||
return this;
|
||||
}
|
||||
|
||||
function writeByteArray(arr) {
|
||||
Sq_Memory_WriteByteArr(this.C_Object, arr);
|
||||
}
|
||||
|
||||
function readByteArray(size) {
|
||||
local PointB = Sq_Point2Blob(this.C_Object, size);
|
||||
local arr = [];
|
||||
foreach(value in PointB) {
|
||||
arr.append(value);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
||||
function write(value, type) {
|
||||
local Buf = blob(0);
|
||||
Buf.writen(value, type);
|
||||
local arr = [];
|
||||
foreach(value in Buf) {
|
||||
arr.append(value);
|
||||
}
|
||||
writeByteArray(arr);
|
||||
}
|
||||
|
||||
function writeS8(value) {
|
||||
write(value, 'c');
|
||||
}
|
||||
|
||||
function writeU8(value) {
|
||||
write(value, 'b');
|
||||
}
|
||||
|
||||
function writeS16(value) {
|
||||
write(value, 's');
|
||||
}
|
||||
|
||||
function writeU16(value) {
|
||||
write(value, 'w');
|
||||
}
|
||||
|
||||
function writeS32(value) {
|
||||
write(value, 'i');
|
||||
}
|
||||
|
||||
function writeU32(value) {
|
||||
write(value, 'i');
|
||||
}
|
||||
|
||||
function writeShort(value) {
|
||||
write(value, 's');
|
||||
}
|
||||
|
||||
function writeUShort(value) {
|
||||
write(value, 'w');
|
||||
}
|
||||
|
||||
function writeInt(value) {
|
||||
write(value, 'i');
|
||||
}
|
||||
|
||||
function writeUInt(value) {
|
||||
write(value, 'i');
|
||||
}
|
||||
|
||||
function writeFloat(value) {
|
||||
write(value, 'f');
|
||||
}
|
||||
|
||||
function writeDouble(value) {
|
||||
write(value, 'd');
|
||||
}
|
||||
|
||||
|
||||
function read(type) {
|
||||
local Buf = Sq_Point2Blob(this.C_Object, 4);
|
||||
return Buf.readn(type);
|
||||
}
|
||||
|
||||
function readS8() {
|
||||
return read('c');
|
||||
}
|
||||
|
||||
function readU8() {
|
||||
return read('b');
|
||||
}
|
||||
|
||||
function readS16() {
|
||||
return read('s');
|
||||
}
|
||||
|
||||
function readU16() {
|
||||
return read('w');
|
||||
}
|
||||
|
||||
function readS32() {
|
||||
return read('i');
|
||||
}
|
||||
|
||||
function readU32() {
|
||||
return read('i');
|
||||
}
|
||||
|
||||
function readShort() {
|
||||
return read('s');
|
||||
}
|
||||
|
||||
function readUShort() {
|
||||
return read('w');
|
||||
}
|
||||
|
||||
function readInt() {
|
||||
return read('i');
|
||||
}
|
||||
|
||||
function readUInt() {
|
||||
return read('i');
|
||||
}
|
||||
|
||||
function readFloat() {
|
||||
return read('f');
|
||||
}
|
||||
|
||||
function readDouble() {
|
||||
return read('d');
|
||||
}
|
||||
|
||||
function readUtf8String(...) {
|
||||
if (vargv.len() > 0) {
|
||||
return Sq_Memory_ReadString(this.C_Object, vargv[0]);
|
||||
} else {
|
||||
return Sq_Memory_ReadString(this.C_Object);
|
||||
}
|
||||
}
|
||||
|
||||
function readPointer() {
|
||||
return Sq_ReadPoint(this.C_Object);
|
||||
}
|
||||
|
||||
function readBinary(Size) {
|
||||
return Sq_Point2Blob(this.C_Object, Size);
|
||||
}
|
||||
|
||||
function tostring() {
|
||||
return this.C_Object.tostring();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
文件名:MoudleClass.nut
|
||||
路径:Dps_A/BaseClass/MoudleClass/MoudleClass.nut
|
||||
创建日期:2024-09-17 09:48
|
||||
文件用途:模块类
|
||||
*/
|
||||
class Module {
|
||||
|
||||
function getExportByName(ModuleName, FunctionName) {
|
||||
return Sq_getExportByName(ModuleName, FunctionName);
|
||||
}
|
||||
|
||||
function load() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,267 @@
|
|||
/*
|
||||
文件名:MysqlClass.nut
|
||||
路径:Dps_A/BaseClass/MysqlClass/MysqlClass.nut
|
||||
创建日期:2024-09-16 21:23
|
||||
文件用途:数据库类
|
||||
*/
|
||||
class Mysql extends Base_C_Object {
|
||||
|
||||
// 0空闲 1任务中 2死亡
|
||||
State = 0;
|
||||
|
||||
constructor(Ip, Port, Name, Account, Password) {
|
||||
if (!Open(Ip, Port, Name, Account, Password)) error("数据库连接失败");
|
||||
}
|
||||
|
||||
/*
|
||||
* 读取mysql返回的数据,读取binary类型的字段
|
||||
* @param this.C_Object mysql数据库句柄
|
||||
* @param columnIndex 要读取的字段的位置
|
||||
*/
|
||||
function Open(db_ip, db_port, db_name, db_username, db_password) {
|
||||
base.constructor(Sq_New_Point(0x80000));
|
||||
Sq_CallFunc(S_Ptr("0x83F3AC8"), "pointer", ["pointer"], this.C_Object);
|
||||
Sq_CallFunc(S_Ptr("0x83F3CE4"), "int", ["pointer"], this.C_Object);
|
||||
//打开数据库句柄
|
||||
if (Sq_CallFunc(S_Ptr("0x83F4024"), "int", ["pointer", "pointer", "int", "pointer", "pointer", "pointer"],
|
||||
this.C_Object, db_ip, db_port, db_name, db_username, db_password)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function Fetch() {
|
||||
return Sq_CallFunc(S_Ptr("0x83F44BC"), "int", ["pointer"], this.C_Object);
|
||||
}
|
||||
|
||||
function Close() {
|
||||
Sq_CallFunc(S_Ptr("0x83F3E74"), "int", ["pointer"], this.C_Object);
|
||||
Sq_Delete_Point(this.C_Object);
|
||||
State = 2;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 读取mysql返回的数据,读取string类型的字段
|
||||
* @param this.C_Object mysql数据库句柄
|
||||
* @param columnIndex 要读取的字段的位置
|
||||
*/
|
||||
function ReadStringColumn(columnIndex) {
|
||||
//MySQL_get_binary_length
|
||||
local binary_length = Sq_CallFunc(S_Ptr("0x81253DE"), "int", ["pointer", "int"], this.C_Object, columnIndex);
|
||||
local binary_length_point = Sq_New_Point(binary_length);
|
||||
//MySQL_get_binary
|
||||
if (1 == Sq_CallFunc(S_Ptr("0x812531A"), "int", ["pointer", "int", "pointer", "int"], this.C_Object, columnIndex, binary_length_point, binary_length)) {
|
||||
//读取string类型的数据
|
||||
local result = Sq_ReadAddressString(binary_length_point, binary_length);
|
||||
Sq_Delete_Point(binary_length_point);
|
||||
return result;
|
||||
}
|
||||
Sq_Delete_Point(binary_length_point);
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* 读取mysql返回的数据,读取有符号int类型的字段
|
||||
* @param this.C_Object mysql数据库句柄
|
||||
* @param columnIndex 要读取的字段的位置
|
||||
*/
|
||||
function ReadIntColumn(columnIndex) {
|
||||
local intSizePoint = Sq_New_Point(4);
|
||||
//MySQL_get_int
|
||||
if (1 == Sq_CallFunc(S_Ptr("0x811692C"), "int", ["pointer", "int", "pointer"], this.C_Object, columnIndex, intSizePoint)) {
|
||||
//转为blob
|
||||
local blob = Sq_Point2Blob(intSizePoint, 4);
|
||||
//读取8位有符号整数
|
||||
local result = blob.readn('c');
|
||||
Sq_Delete_Point(intSizePoint);
|
||||
return result;
|
||||
}
|
||||
// Sq_Delete_Point(intSizePoint);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 读取mysql返回的数据,读取无符号int类型的字段
|
||||
* @param this.C_Object mysql数据库句柄
|
||||
* @param columnIndex 要读取的字段的位置
|
||||
*/
|
||||
function ReadUIntColumn(columnIndex) {
|
||||
local intSizePoint = Sq_New_Point(4);
|
||||
//MySQL_get_uint
|
||||
if (1 == Sq_CallFunc(S_Ptr("0x80E22F2"), "int", ["pointer", "int", "pointer"], this.C_Object, columnIndex, intSizePoint)) {
|
||||
//转为blob
|
||||
local blob = Sq_Point2Blob(intSizePoint, 4);
|
||||
//读取8位无符号整数
|
||||
local result = blob.readn('b');
|
||||
Sq_Delete_Point(intSizePoint);
|
||||
return result;
|
||||
}
|
||||
Sq_Delete_Point(intSizePoint);
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* 读取mysql返回的数据,读取float类型的字段
|
||||
* @param this.C_Object mysql数据库句柄
|
||||
* @param columnIndex 要读取的字段的位置
|
||||
*/
|
||||
function ReadFloatColumn(columnIndex) {
|
||||
local intSizePoint = Sq_New_Point(4);
|
||||
//MySQL_get_float
|
||||
if (1 == Sq_CallFunc(S_Ptr("0x844D6D0"), "int", ["pointer", "int", "pointer"], this.C_Object, columnIndex, intSizePoint)) {
|
||||
//转为blob
|
||||
local blob = Sq_Point2Blob(intSizePoint, 4);
|
||||
//读取32位浮点数
|
||||
local result = blob.readn('f');
|
||||
Sq_Delete_Point(intSizePoint);
|
||||
return result;
|
||||
}
|
||||
Sq_Delete_Point(intSizePoint);
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* 读取mysql返回的数据,读取binary类型的字段
|
||||
* @param this.C_Object mysql数据库句柄
|
||||
* @param columnIndex 要读取的字段的位置
|
||||
*/
|
||||
function ReadBinaryColumn(columnIndex) {
|
||||
//MySQL_get_binary_length
|
||||
local binary_length = Sq_CallFunc(S_Ptr("0x81253DE"), "int", ["pointer", "int"], this.C_Object, columnIndex);
|
||||
if (binary_length > 0) {
|
||||
local binary_length_point = Memory.alloc(binary_length);
|
||||
//MySQL_get_binary
|
||||
if (1 == Sq_CallFunc(S_Ptr("0x812531A"), "int", ["pointer", "int", "pointer", "int"], this.C_Object, columnIndex, binary_length_point.C_Object, binary_length)) {
|
||||
return binary_length_point;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* mysql查询,带返回结果,返回一个二维数组
|
||||
* @param {*} db_pointer 数据库句柄
|
||||
* @param {*} select_sql 要执行的查询语句
|
||||
* @param {*} column_type_list 返回结果的类型list,按select的column顺序,int,string,unit,float,binary
|
||||
* @returns
|
||||
*/
|
||||
function Select(select_sql, column_type_list) {
|
||||
local result_list = [];
|
||||
if (Exec_Sql(select_sql)) {
|
||||
//获取查询到的数据总数
|
||||
local row_count = Sq_CallFunc(S_Ptr("0x80E236C"), "int", ["pointer"], this.C_Object);
|
||||
if (row_count > 0) {
|
||||
for (local i = 0; i< row_count; i++) {
|
||||
Fetch();
|
||||
local row = [];
|
||||
for (local j = 0; j< column_type_list.len(); j++) {
|
||||
//判断是否为空值
|
||||
if (!Sq_CallFunc(S_Ptr("0x85F41B2"), "bool", ["pointer", "int"], this.C_Object, j)) {
|
||||
row.push(null);
|
||||
} else if (column_type_list[j] == "int") {
|
||||
row.push(ReadIntColumn(j));
|
||||
} else if (column_type_list[j] == "string") {
|
||||
row.push(ReadStringColumn(j));
|
||||
} else if (column_type_list[j] == "uint") {
|
||||
row.push(ReadUIntColumn(j));
|
||||
} else if (column_type_list[j] == "float") {
|
||||
row.push(ReadFloatColumn(j));
|
||||
} else if (column_type_list[j] == "binary") {
|
||||
row.push(ReadBinaryColumn(j));
|
||||
}
|
||||
}
|
||||
result_list.push(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result_list;
|
||||
}
|
||||
|
||||
//执行查询返回执行是否成功
|
||||
function Exec_Sql(sql) {
|
||||
local sql_ptr = Str_Ptr(sql);
|
||||
//set query
|
||||
local set_query = Sq_CallFunc(S_Ptr("0x83F41C0"), "int", ["pointer", "pointer"], this.C_Object, sql_ptr);
|
||||
//执行sql
|
||||
local sql_exec_result = Sq_CallFunc(S_Ptr("0x83F4326"), "int", ["pointer", "int"], this.C_Object, 1);
|
||||
return sql_exec_result;
|
||||
}
|
||||
|
||||
|
||||
//获取服务端版本
|
||||
function GetServerVersion() {
|
||||
return Sq_CallFunc(S_Ptr("0x83F460C"), "int", ["pointer"], this.C_Object);
|
||||
}
|
||||
//获取客户端版本
|
||||
function GetClientVersion() {
|
||||
return Sq_CallFunc(S_Ptr("0x83F4622"), "int", ["pointer"], this.C_Object);
|
||||
}
|
||||
}
|
||||
|
||||
class MysqlPool {
|
||||
|
||||
// 用于存储数据库的 IP 地址
|
||||
db_ip = null;
|
||||
// 用于存储数据库的端口号
|
||||
db_port = null;
|
||||
// 用于存储数据库的名称
|
||||
db_name = null;
|
||||
// 用于存储数据库的用户名
|
||||
db_username = null;
|
||||
// 用于存储数据库的密码
|
||||
db_password = null;
|
||||
|
||||
//连接池大小
|
||||
PoolSize = 10;
|
||||
//连接编码
|
||||
Charset = "latin1";
|
||||
//连接池
|
||||
PoolList = null;
|
||||
|
||||
constructor() {
|
||||
PoolList = [];
|
||||
getroottable()._MysqlPoolObject <- this;
|
||||
}
|
||||
|
||||
function GetInstance() {
|
||||
if (!(getroottable().rawin("_MysqlPoolObject"))) MysqlPool();
|
||||
// MysqlPool();
|
||||
return getroottable()._MysqlPoolObject;
|
||||
}
|
||||
|
||||
//设置基础配置
|
||||
function SetBaseConfiguration(Ip, Port, Account, Password) {
|
||||
db_ip = Str_Ptr(Ip);
|
||||
db_port = Port;
|
||||
db_name = Str_Ptr("taiwan_cain");
|
||||
db_username = Str_Ptr(Account);
|
||||
db_password = Str_Ptr(Password);
|
||||
}
|
||||
|
||||
//初始化连接池
|
||||
function Init() {
|
||||
for (local i = 0; i< PoolSize; i++) {
|
||||
local Buffer = Mysql(db_ip, db_port, db_name, db_username, db_password);
|
||||
Buffer.Exec_Sql(format("SET NAMES %s", Charset));
|
||||
PoolList.append(Buffer);
|
||||
// print("创建了一条连接,编号: " + i + ",地址: " + Buffer + ", 指针地址: " + Buffer.C_Object);
|
||||
}
|
||||
}
|
||||
|
||||
function GetConnect() {
|
||||
local _Connect = PoolList.pop();
|
||||
if (_Connect.State == 0) {
|
||||
_Connect.State = 1;
|
||||
return _Connect;
|
||||
}
|
||||
}
|
||||
|
||||
function PutConnect(_Connect) {
|
||||
if (_Connect.State == 1) {
|
||||
_Connect.State = 0;
|
||||
PoolList.append(_Connect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -55,4 +55,19 @@ class PvfItem extends Base_C_Object {
|
|||
return PvfItem(Ret);
|
||||
} else return null;
|
||||
}
|
||||
|
||||
//Public 是否是魔法封印
|
||||
function IsRandomOption() {
|
||||
return Sq_CallFunc(S_Ptr("0x8514E5E"), "int", ["pointer"], this.C_Object);
|
||||
}
|
||||
}
|
||||
|
||||
//获取穿戴等级
|
||||
function PvfItem::GetUsableLevel() {
|
||||
return Sq_CallFunc(S_Ptr("0x80F12EE"), "int", ["pointer"], this.C_Object);
|
||||
}
|
||||
|
||||
//是否为消耗品
|
||||
function PvfItem::IsStackable() {
|
||||
return Sq_CallFunc(S_Ptr("0x80f12fa"), "int", ["pointer"], this.C_Object);
|
||||
}
|
||||
|
|
@ -0,0 +1,280 @@
|
|||
/*
|
||||
文件名:RedBlackTreeClass.nut
|
||||
路径:Dps_A/BaseClass/RedBlackTreeClass/RedBlackTreeClass.nut
|
||||
创建日期:2024-09-19 12:42
|
||||
文件用途:红黑树类
|
||||
*/
|
||||
// 红黑树节点类
|
||||
class RBTreeNode {
|
||||
key = null;
|
||||
time = null;
|
||||
left = null;
|
||||
right = null;
|
||||
parent = null;
|
||||
color = null;
|
||||
Info = null;
|
||||
constructor(key, func_info) {
|
||||
this.key = key;
|
||||
this.time = key;
|
||||
this.Info = func_info;
|
||||
this.left = null;
|
||||
this.right = null;
|
||||
this.parent = null;
|
||||
this.color = "red";
|
||||
}
|
||||
|
||||
function _tyoeof() {
|
||||
return "RBTreeNode";
|
||||
}
|
||||
}
|
||||
|
||||
// 红黑树类
|
||||
class RedBlackTree {
|
||||
nil = null;
|
||||
root = null;
|
||||
size = 0;
|
||||
|
||||
function _tyoeof() {
|
||||
return "RedBlackTree";
|
||||
}
|
||||
|
||||
constructor() {
|
||||
this.nil = RBTreeNode(null, null);
|
||||
this.root = this.nil;
|
||||
}
|
||||
|
||||
function insert(key, func_info) {
|
||||
local z = RBTreeNode(key, func_info);
|
||||
local y = this.nil;
|
||||
local x = this.root;
|
||||
while (x != this.nil) {
|
||||
y = x;
|
||||
if (z.key< x.key) {
|
||||
x = x.left;
|
||||
} else {
|
||||
x = x.right;
|
||||
}
|
||||
}
|
||||
z.parent = y;
|
||||
if (y == this.nil) {
|
||||
this.root = z;
|
||||
} else if (z.key< y.key) {
|
||||
y.left = z;
|
||||
} else {
|
||||
y.right = z;
|
||||
}
|
||||
z.left = this.nil;
|
||||
z.right = this.nil;
|
||||
z.color = "red";
|
||||
this.insertFixup(z);
|
||||
this.size++;
|
||||
}
|
||||
|
||||
function insertFixup(z) {
|
||||
while (z.parent.color == "red") {
|
||||
if (z.parent.parent && z.parent == z.parent.parent.left) {
|
||||
local y = z.parent.parent.right;
|
||||
if (y.color == "red") {
|
||||
z.parent.color = "black";
|
||||
y.color = "black";
|
||||
z.parent.parent.color = "red";
|
||||
z = z.parent.parent;
|
||||
} else {
|
||||
if (z == z.parent.right) {
|
||||
z = z.parent;
|
||||
this.leftRotate(z);
|
||||
}
|
||||
z.parent.color = "black";
|
||||
z.parent.parent.color = "red";
|
||||
this.rightRotate(z.parent.parent);
|
||||
}
|
||||
} else {
|
||||
if (z.parent.parent && z.parent.parent.left.color == "red") {
|
||||
z.parent.color = "black";
|
||||
z.parent.parent.left.color = "black";
|
||||
z.parent.parent.color = "red";
|
||||
z = z.parent.parent;
|
||||
} else {
|
||||
if (z == z.parent.left) {
|
||||
z = z.parent;
|
||||
this.rightRotate(z);
|
||||
}
|
||||
z.parent.color = "black";
|
||||
if (z.parent.parent) z.parent.parent.color = "red";
|
||||
this.leftRotate(z.parent.parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.root.color = "black";
|
||||
}
|
||||
|
||||
function leftRotate(x) {
|
||||
if (!x) return;
|
||||
local y = x.right;
|
||||
x.right = y.left;
|
||||
if (y.left != this.nil) {
|
||||
y.left.parent = x;
|
||||
}
|
||||
y.parent = x.parent;
|
||||
if (x.parent == this.nil) {
|
||||
this.root = y;
|
||||
} else if (x == x.parent.left) {
|
||||
x.parent.left = y;
|
||||
} else {
|
||||
x.parent.right = y;
|
||||
}
|
||||
y.left = x;
|
||||
x.parent = y;
|
||||
}
|
||||
|
||||
function rightRotate(x) {
|
||||
local y = x.left;
|
||||
x.left = y.right;
|
||||
if (y.right != this.nil) {
|
||||
y.right.parent = x;
|
||||
}
|
||||
y.parent = x.parent;
|
||||
if (x.parent == this.nil) {
|
||||
this.root = y;
|
||||
} else if (x == x.parent.left) {
|
||||
x.parent.left = y;
|
||||
} else {
|
||||
x.parent.right = y;
|
||||
}
|
||||
y.right = x;
|
||||
x.parent = y;
|
||||
}
|
||||
|
||||
|
||||
function minimum(...) {
|
||||
local node = this.root;
|
||||
if (vargv.len() > 0) node = vargv[0];
|
||||
while (node.left != this.nil) {
|
||||
node = node.left;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
function transplant(u, v) {
|
||||
if (u.parent == this.nil) {
|
||||
this.root = v;
|
||||
} else if (u == u.parent.left) {
|
||||
u.parent.left = v;
|
||||
} else {
|
||||
u.parent.right = v;
|
||||
}
|
||||
v.parent = u.parent;
|
||||
}
|
||||
|
||||
function deleteFixup(x) {
|
||||
while (x != this.root && x.color == "black") {
|
||||
if (x == x.parent.left) {
|
||||
local w = x.parent.right;
|
||||
if (w.color == "red") {
|
||||
w.color = "black";
|
||||
x.parent.color = "red";
|
||||
this.leftRotate(x.parent);
|
||||
w = x.parent.right;
|
||||
}
|
||||
if (w.left.color == "black" && w.right.color == "black") {
|
||||
w.color = "red";
|
||||
x = x.parent;
|
||||
} else {
|
||||
if (w.right.color == "black") {
|
||||
w.left.color = "black";
|
||||
w.color = "red";
|
||||
this.rightRotate(w);
|
||||
w = x.parent.right;
|
||||
}
|
||||
w.color = x.parent.color;
|
||||
x.parent.color = "black";
|
||||
w.right.color = "black";
|
||||
this.leftRotate(x.parent);
|
||||
x = this.root;
|
||||
}
|
||||
} else {
|
||||
local w = x.parent.left;
|
||||
if (w.color == "red") {
|
||||
w.color = "black";
|
||||
x.parent.color = "red";
|
||||
this.rightRotate(x.parent);
|
||||
w = x.parent.left;
|
||||
}
|
||||
if (w.right.color == "black" && w.left.color == "black") {
|
||||
w.color = "red";
|
||||
x = x.parent;
|
||||
} else {
|
||||
if (w.left.color == "black") {
|
||||
w.right.color = "black";
|
||||
w.color = "red";
|
||||
this.leftRotate(w);
|
||||
w = x.parent.left;
|
||||
}
|
||||
w.color = x.parent.color;
|
||||
x.parent.color = "black";
|
||||
w.left.color = "black";
|
||||
this.rightRotate(x.parent);
|
||||
x = this.root;
|
||||
}
|
||||
}
|
||||
}
|
||||
x.color = "black";
|
||||
}
|
||||
|
||||
function deleteNode(z) {
|
||||
local y = z;
|
||||
local yOriginalColor = y.color;
|
||||
local x;
|
||||
if (z.left == this.nil) {
|
||||
x = z.right;
|
||||
this.transplant(z, z.right);
|
||||
} else if (z.right == this.nil) {
|
||||
x = z.left;
|
||||
this.transplant(z, z.left);
|
||||
} else {
|
||||
y = this.minimum(z.right);
|
||||
yOriginalColor = y.color;
|
||||
x = y.right;
|
||||
if (y.parent == z) {
|
||||
x.parent = y;
|
||||
} else {
|
||||
this.transplant(y, y.right);
|
||||
y.right = z.right;
|
||||
y.right.parent = y;
|
||||
}
|
||||
this.transplant(z, y);
|
||||
y.left = z.left;
|
||||
y.left.parent = y;
|
||||
y.color = z.color;
|
||||
}
|
||||
if (yOriginalColor == "black") {
|
||||
this.deleteFixup(x);
|
||||
}
|
||||
this.size--;
|
||||
}
|
||||
|
||||
function inorderTraversal(...) {
|
||||
local node = this.root;
|
||||
if (vargv.len() > 0) node = vargv[0];
|
||||
if (node == this.nil) {
|
||||
return;
|
||||
}
|
||||
this.inorderTraversal(node.left);
|
||||
print(node.key + "(" + node.color + ") ");
|
||||
this.inorderTraversal(node.right);
|
||||
}
|
||||
|
||||
function getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
function pop() {
|
||||
if (this.size <= 0) return null;
|
||||
local z = this.minimum();
|
||||
if (z != this.nil) {
|
||||
this.deleteNode(z);
|
||||
return z;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
文件名:TimerClass.nut
|
||||
路径:Dps_A/BaseClass/TimerClass/TimerClass.nut
|
||||
创建日期:2024-09-19 12:39
|
||||
文件用途:定时器类
|
||||
*/
|
||||
class Timer {
|
||||
//执行任务队列树
|
||||
Wait_Exec_Tree = null;
|
||||
//定时执行任务队列树
|
||||
Date_Exec_Tree = null;
|
||||
|
||||
constructor() {
|
||||
Wait_Exec_Tree = RedBlackTree();
|
||||
Date_Exec_Tree = RedBlackTree();
|
||||
|
||||
Cb_timer_dispatch_Func.rawset("__System__Timer__Event", Update.bindenv(this));
|
||||
}
|
||||
|
||||
//检测延时任务
|
||||
function CheckTimeOut() {
|
||||
local Node = Wait_Exec_Tree.pop();
|
||||
if (!Node) {
|
||||
return;
|
||||
}
|
||||
//取得函数体
|
||||
local Info = Node.Info;
|
||||
//执行时间
|
||||
local exec_time = Node.time;
|
||||
//如果没到执行时间,放回去,等待下次扫描
|
||||
if (clock() <= exec_time) {
|
||||
Wait_Exec_Tree.insert(exec_time, Node.Info);
|
||||
return;
|
||||
}
|
||||
//函数
|
||||
local func = Info[0];
|
||||
//参数
|
||||
local func_args = Info[1];
|
||||
//执行函数
|
||||
func.acall(func_args);
|
||||
}
|
||||
|
||||
function SetTimeOut(target_func, delay_time, ...) {
|
||||
local target_arg_list = [];
|
||||
target_arg_list.push(getroottable());
|
||||
for (local i = 0; i< vargv.len(); i++) {
|
||||
target_arg_list.push(vargv[i]);
|
||||
}
|
||||
//当前时间戳,单位:秒
|
||||
local time_sec = clock();
|
||||
//计算下一次执行的时间
|
||||
local exec_time_sec = time_sec + (delay_time / 1000.0).tofloat();
|
||||
|
||||
//设置下一次执行
|
||||
local func_info = [];
|
||||
|
||||
func_info.push(target_func);
|
||||
func_info.push(target_arg_list);
|
||||
|
||||
_Timer_Object.Wait_Exec_Tree.insert(exec_time_sec, func_info);
|
||||
}
|
||||
|
||||
//检测定时任务
|
||||
function CheckCronTask() {
|
||||
local Node = Date_Exec_Tree.pop();
|
||||
if (!Node) {
|
||||
return;
|
||||
}
|
||||
//取得函数体
|
||||
local Info = Node.Info;
|
||||
//执行时间
|
||||
local exec_time = Node.time;
|
||||
//如果没到执行时间,放回去,等待下次扫描
|
||||
if (time() <= exec_time) {
|
||||
Date_Exec_Tree.insert(exec_time, Node.Info);
|
||||
return;
|
||||
}
|
||||
//函数
|
||||
local func = Info[0];
|
||||
//参数
|
||||
local func_args = Info[1];
|
||||
//下次任务叠加时间
|
||||
local NextTimestep = Info[2];
|
||||
//执行函数
|
||||
func.acall(func_args);
|
||||
//继续构建下一次任务
|
||||
Date_Exec_Tree.insert(time() + NextTimestep, Info);
|
||||
}
|
||||
|
||||
function SetCronTask(target_func, CronString, ...) {
|
||||
local parts = split(CronString, "/");
|
||||
local minute = parts[0].tointeger();
|
||||
local hour = parts[1].tointeger();
|
||||
local day = parts[2].tointeger();
|
||||
local weekday = parts[3].tointeger();
|
||||
|
||||
local S_minute = minute * 60;
|
||||
local S_hour = hour * 60 * 60;
|
||||
local S_day = day * 24 * 60 * 60;
|
||||
local S_weekday = weekday * 7 * 24 * 60 * 60;
|
||||
|
||||
local AddTimestep = S_minute + S_hour + S_day + S_weekday;
|
||||
local NowTimestep = time();
|
||||
|
||||
//下一次执行的时间
|
||||
local NextTimestep = AddTimestep + NowTimestep;
|
||||
|
||||
local target_arg_list = [];
|
||||
target_arg_list.push(getroottable());
|
||||
for (local i = 0; i< vargv.len(); i++) {
|
||||
target_arg_list.push(vargv[i]);
|
||||
}
|
||||
|
||||
//设置下一次执行
|
||||
local func_info = [];
|
||||
|
||||
//函数体
|
||||
func_info.push(target_func);
|
||||
//参数列表
|
||||
func_info.push(target_arg_list);
|
||||
//间隔时间戳时间
|
||||
func_info.push(AddTimestep);
|
||||
|
||||
_Timer_Object.Date_Exec_Tree.insert(NextTimestep, func_info);
|
||||
}
|
||||
|
||||
|
||||
function Update() {
|
||||
CheckTimeOut();
|
||||
CheckCronTask();
|
||||
}
|
||||
}
|
||||
|
|
@ -215,6 +215,19 @@ class User extends Base_C_Object {
|
|||
Sq_Packet_Send(this.C_Object, SPacket.C_Object);
|
||||
}
|
||||
|
||||
//发送弹窗公告包(可自定义文字需要客户端修复233dll搭配)
|
||||
function SendNotiBox(Msg, Type) {
|
||||
local Pack = Packet();
|
||||
Pack.Put_Header(0, 233);
|
||||
Pack.Put_Byte(1);
|
||||
Pack.Put_Byte(5);
|
||||
Pack.Put_Int(Msg.len());
|
||||
Pack.Put_BinaryEx(Str_Ptr(Msg), Msg.len());
|
||||
Pack.Finalize(true);
|
||||
Sq_CallFunc(S_Ptr("0x867B8FE"), "int", ["pointer", "int", "pointer"], this.C_Object, Type, Pack.C_Object);
|
||||
Pack.Delete();
|
||||
}
|
||||
|
||||
//发送自定义包
|
||||
function SendJso(Jso) {
|
||||
local Str = Json.Encode(Jso);
|
||||
|
|
@ -519,4 +532,71 @@ class User extends Base_C_Object {
|
|||
if (Ret) return AccountCargo(Ret, this);
|
||||
else return null;
|
||||
}
|
||||
}
|
||||
|
||||
//获取公会名称
|
||||
function User::GetGuildName() {
|
||||
return Sq_CallFunc(S_Ptr("0x869742a"), "string", ["pointer"], this.C_Object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//获取副职业对象指针
|
||||
function User::GetCurCharacExpertJob() {
|
||||
return Sq_CallFunc(S_Ptr("0x822f8d4"), "pointer", ["pointer"], this.C_Object);
|
||||
}
|
||||
|
||||
//获得角色副职业
|
||||
function User::GetCurCharacExpertJobType() {
|
||||
return Sq_CallFunc(S_Ptr("0x822f894"), "int", ["pointer"], this.C_Object);
|
||||
}
|
||||
|
||||
//调用分解机
|
||||
function User::DisPatcher_DisJointItem_disjoint(Slot, ...) {
|
||||
local UseIdx = 239;
|
||||
local UsePtr = this.C_Object;
|
||||
if (vargv.len() > 1) {
|
||||
UseIdx = vargv[0];
|
||||
UsePtr = vargv[1];
|
||||
}
|
||||
return Sq_CallFunc(S_Ptr("0x81f92ca"), "int", ["pointer", "int", "int", "int", "pointer", "int"], this.C_Object, Slot, 0, UseIdx, UsePtr, 0xFFFF);
|
||||
}
|
||||
|
||||
//发送Item邮件 Pubilc
|
||||
function User::SendItemMail(UID, CID, ItemList, title, content) {
|
||||
local SUser = World.GetUserByUid(UID);
|
||||
local sql = "select letter_id from taiwan_cain_2nd.postal order by letter_id DESC";
|
||||
local column_type_list = ["int"];
|
||||
|
||||
local SqlObj = MysqlPool.GetInstance().GetConnect();
|
||||
local result = SqlObj.Select(sql, column_type_list);
|
||||
local sl = 1;
|
||||
if (result.len() > 0) {
|
||||
sl = result[0][0] + 1;
|
||||
}
|
||||
|
||||
local time = date();
|
||||
local timeStr = time["year"] + "-" + (time["month"] + 1) + "-" + time["day"] + " " + time["hour"] + ":" + time["min"] + ":" + time["sec"];
|
||||
|
||||
foreach(value in ItemList) {
|
||||
local sql1 = "insert into taiwan_cain_2nd.postal (occ_time,send_charac_name,receive_charac_no,amplify_option,amplify_value,seperate_upgrade,seal_flag,item_id,add_info,upgrade,gold,letter_id,avata_flag,creature_flag) values ('" + timeStr + "','" + title + "'," + CID + ",0,0,0,0," + value.item + "," + value.num + ",0,0," + sl + ",'0','0')";
|
||||
SqlObj.Select(sql1, []);
|
||||
}
|
||||
|
||||
local sql2 = "insert into taiwan_cain_2nd.letter (letter_id,charac_no,send_charac_name,letter_text,reg_date,stat) values ('" + sl + "'," + CID + ",'" + title + "','" + content + "','" + timeStr + "','1')";
|
||||
SqlObj.Select(sql2, []);
|
||||
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
|
||||
if (SUser) {
|
||||
local Pack = Packet();
|
||||
Pack.Put_Header(0, 9);
|
||||
local MailBox = Sq_CallFunc(S_Ptr("0x0823020C"), "int", ["pointer"], SUser.C_Object);
|
||||
Sq_CallFunc(S_Ptr("0x0823455A"), "int", ["int"], MailBox);
|
||||
local Not_Count = Sq_CallFunc(S_Ptr("0x084ED330"), "int", ["int"], MailBox);
|
||||
Pack.Put_Short(Not_Count);
|
||||
Pack.Finalize(true);
|
||||
SUser.Send(Pack);
|
||||
Pack.Delete();
|
||||
}
|
||||
}
|
||||
|
|
@ -204,4 +204,64 @@ class World {
|
|||
function SendPartyInfoToAll(Party) {
|
||||
Sq_GameWorld_SendPartyInfoToAll(Sq_Get_GameWorld(), Party.C_Object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//获取在线玩家列表表头
|
||||
function api_gameworld_user_map_begin() {
|
||||
local Begin = Sq_New_Point(4);
|
||||
Sq_CallFunc(S_Ptr("0x80F78A6"), "int", ["pointer", "pointer"], Begin, Ptr_Operation_A2S(Sq_Get_GameWorld(), 308));
|
||||
return Begin;
|
||||
}
|
||||
|
||||
//获取在线玩家列表表尾
|
||||
function api_gameworld_user_map_end() {
|
||||
local End = Sq_New_Point(4);
|
||||
Sq_CallFunc(S_Ptr("0x80F78CC"), "int", ["pointer", "pointer"], End, Ptr_Operation_A2S(Sq_Get_GameWorld(), 308));
|
||||
return End;
|
||||
}
|
||||
|
||||
//获取当前正在遍历的玩家
|
||||
function api_gameworld_user_map_get(it) {
|
||||
local Buf = Sq_CallFunc(S_Ptr("0x80F7944"), "pointer", ["pointer"], it);
|
||||
local Buf2 = Ptr_Operation_A2S(Buf, 4);
|
||||
local Buf3 = Sq_ReadPoint(Buf2);
|
||||
return Buf3;
|
||||
}
|
||||
|
||||
//迭代器指针自增
|
||||
function api_gameworld_user_map_next(it) {
|
||||
local Next = Sq_New_Point(4);
|
||||
Sq_CallFunc(S_Ptr("0x80F7906"), "pointer", ["pointer", "pointer"], Next, it);
|
||||
Sq_Delete_Point(Next);
|
||||
return Next;
|
||||
}
|
||||
//获取在线玩家列表
|
||||
function GetOnlinePlayer() {
|
||||
local PlayerArr = [];
|
||||
//遍历在线玩家列表
|
||||
local it = api_gameworld_user_map_begin();
|
||||
local end = api_gameworld_user_map_end();
|
||||
|
||||
//判断在线玩家列表遍历是否已结束
|
||||
while (Sq_CallFunc(S_Ptr("0x80F78F2"), "bool", ["pointer", "pointer"], it, end)) {
|
||||
//当前被遍历到的玩家
|
||||
local user = api_gameworld_user_map_get(it);
|
||||
local SUser = User(user);
|
||||
if (SUser) PlayerArr.append(SUser);
|
||||
//继续遍历下一个玩家
|
||||
api_gameworld_user_map_next(it);
|
||||
}
|
||||
|
||||
Sq_Delete_Point(it);
|
||||
Sq_Delete_Point(end);
|
||||
return PlayerArr;
|
||||
}
|
||||
}
|
||||
|
|
@ -152,14 +152,21 @@ Gm_InputFunc_Handle.Q <- function(SUser, CmdString) {
|
|||
}
|
||||
};
|
||||
|
||||
Gm_InputFunc_Handle.FI <- function(SUser, CmdString) {
|
||||
local PartyObj = SUser.GetParty();
|
||||
if (PartyObj) {
|
||||
local Bfobj = PartyObj.GetBattleField();
|
||||
print(Bfobj.GetHellDifficulty());
|
||||
// print(n);
|
||||
}
|
||||
|
||||
Gm_InputFunc_Handle.FI <- function(SUser, CmdString) {
|
||||
// local PartyObj = SUser.GetParty();
|
||||
// if (PartyObj) {
|
||||
// local Bfobj = PartyObj.GetBattleField();
|
||||
// print(Bfobj.GetHellDifficulty());
|
||||
// // print(n);
|
||||
// }
|
||||
|
||||
|
||||
SUser.SendNotiForColorAIdPacketMessage([
|
||||
[" → ", 0, [0xff, 0xff, 0xff]],
|
||||
["无色", 1, [255, 215, 0], 3037],
|
||||
[" x" + (1).tostring(), 0, [0xff, 0xff, 0xff]]
|
||||
], 6);
|
||||
};
|
||||
|
||||
Gm_InputFunc_Handle.UINJ <- function(SUser, CmdString) {
|
||||
|
|
@ -173,7 +180,7 @@ Gm_InputFunc_Handle.UINJ <- function(SUser, CmdString) {
|
|||
Pack.Put_Binary(Str);
|
||||
Pack.Finalize(true);
|
||||
SUser.Send(Pack);
|
||||
Pack.Delete();
|
||||
Pack.Delocale();
|
||||
};
|
||||
|
||||
Gm_InputFunc_Handle.T <- function(SUser, CmdString) {
|
||||
|
|
@ -187,6 +194,7 @@ Gm_InputFunc_Handle.T <- function(SUser, CmdString) {
|
|||
SUser.SendNotiPacketMessage("GetCharacCount: " + SUser.GetCharacCount(), 8);
|
||||
SUser.SendNotiPacketMessage("GetUID: " + SUser.GetUID(), 8);
|
||||
SUser.SendNotiPacketMessage("GetCID: " + SUser.GetCID(), 8);
|
||||
SUser.SendNotiPacketMessage("GetUni: " + SUser.GetUniqueId(), 8);
|
||||
SUser.SendNotiPacketMessage("GetCharacJob: " + SUser.GetCharacJob(), 8);
|
||||
SUser.SendNotiPacketMessage("GetCharacName: " + SUser.GetCharacName(), 8);
|
||||
SUser.SendNotiPacketMessage("GetCharacLevel: " + SUser.GetCharacLevel(), 8);
|
||||
|
|
@ -212,4 +220,372 @@ function Cb_gm_input(C_User, 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("文件书写完成");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function TestCronTask(str) {
|
||||
print(str);
|
||||
print("定时任务已执行一次");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Gm_InputFunc_Handle.TTT <- function(SUser, CmdString) {
|
||||
// Timer.SetCronTask(TestCronTask, "1/0/0/0", "测试字符串参数");
|
||||
// print("注册任务");
|
||||
|
||||
// Sq_AutoReload("/dp_s/MyProject");
|
||||
|
||||
// local ms = 2000;
|
||||
// local minutes = ms / 60000;
|
||||
// local seconds = (ms % 60000) / 1000;
|
||||
// local milliseconds = (ms % 1000) / 10;
|
||||
// if (minutes > 0) {
|
||||
// str = minutes + "分" +
|
||||
// (seconds< 10 ? "0" : "") + seconds + "秒" +
|
||||
// (milliseconds< 10 ? "0" : "") + milliseconds; // 补全毫秒数为两位
|
||||
// } else {
|
||||
// str = seconds + "秒" +
|
||||
// (milliseconds< 10 ? "0" : "") + milliseconds; // 补全毫秒数为两位
|
||||
// }
|
||||
|
||||
// print(str);
|
||||
|
||||
// User.SendItemMail(1, 7, [{
|
||||
// itemId = 3037,
|
||||
// num = 100
|
||||
// }, {
|
||||
// itemId = 3038,
|
||||
// num = 100
|
||||
// }], "给你", "东西");
|
||||
|
||||
// Sq_CallFunc(S_Ptr("0x86C5A84"), "pointer", ["pointer", "pointer", "int", "int", "int", "int", "int", "int", "int", "int", "int"], Sq_Get_GameWorld(), SUser.C_Object, 1, 1, 200, 200, 0, 0, 0, 0, 0);
|
||||
|
||||
// Haker.LoadHook(S_Ptr("0x86C5A84"),
|
||||
// ["pointer", "pointer", "int", "int", "int", "int", "int", "int", "int", "int", "int", "pointer"],
|
||||
// function(args) {
|
||||
// print(args[0]);
|
||||
// print(Sq_Get_GameWorld());
|
||||
// print(args[2]);
|
||||
// print(args[3]);
|
||||
// print(args[4]);
|
||||
// print(args[5]);
|
||||
// print(args[6]);
|
||||
// print(args[7]);
|
||||
// print(args[8]);
|
||||
// print(args[9]);
|
||||
// print(args[10]);
|
||||
// return null;
|
||||
// },
|
||||
// function(args) {
|
||||
|
||||
// return null;
|
||||
// });
|
||||
|
||||
|
||||
// local Sm = Memory.alloc(200);
|
||||
// Sq_CallFunc(S_Ptr("0x8AA5CBA"), "int", ["pointer", "int", "pointer"], S_Ptr("0x949B140"), 7, Sm.C_Object);
|
||||
// local Bsa = Sq_Point2Blob(Sm.C_Object, 120);
|
||||
// local str = "["
|
||||
// foreach(value in Bsa) {
|
||||
// str += value;
|
||||
// str += ","
|
||||
// }
|
||||
// str += "]";
|
||||
// print(str);
|
||||
// print("字符串: " + Sm.readUtf8String());
|
||||
|
||||
// getroottable()._nut_file_md5_table.rawset(file_name, file_md5_string);
|
||||
|
||||
// local opendirAddr = Module.getExportByName(null, "opendir");
|
||||
|
||||
// function open_dir(dir_path) {
|
||||
// local path_ptr = Memory.allocUtf8String(dir_path).C_Object;
|
||||
// return Sq_CallFunc(opendirAddr, "pointer", ["pointer"], path_ptr);
|
||||
// }
|
||||
// local dir_pointer = open_dir("/dp_s/");
|
||||
// print("dir_pointer = " + dir_pointer);
|
||||
|
||||
// local Pack = Packet();
|
||||
// Pack.Put_Header(1, 83);
|
||||
// Pack.Put_Byte(1);
|
||||
// Pack.Put_Byte(11)
|
||||
// Pack.Put_Short(8195);
|
||||
// Pack.Put_Int(1);
|
||||
// Pack.Put_Short(65535);
|
||||
// Pack.Put_Byte(1);
|
||||
// Pack.Put_Byte(12);
|
||||
// Pack.Put_Byte(1);
|
||||
// Pack.Put_Byte(13);
|
||||
// Pack.Put_Byte(25);
|
||||
// Pack.Finalize(true);
|
||||
// SUser.Send(Pack);
|
||||
// Pack.Delete();
|
||||
|
||||
|
||||
|
||||
// GameManager.SetGameMaxLevel(95);
|
||||
|
||||
// Sq_HookFunc();
|
||||
|
||||
// Sq_HookFunc(S_Ptr("0x8678526"),
|
||||
// 2,
|
||||
// function(a,args) {
|
||||
// print("AAA动态HOOK成功 城镇移动HOOK");
|
||||
// print(CUser);
|
||||
// print(id);
|
||||
// },
|
||||
// function(a,args) {
|
||||
// print("AAA动态HOOK成功 城镇移动HOOK");
|
||||
// print(CUser);
|
||||
// print(id);
|
||||
// });
|
||||
|
||||
|
||||
//给角色发消息var CUser_SendNotiPacketMessage = new NativeFunction(ptr(0x86886CE), 'int', ['pointer', 'pointer', 'int'], { "abi": "sysv" });
|
||||
|
||||
// Sq_CallFunc(S_Ptr("0x86886CE"), "int", ["pointer", "pointer","int"], SUser.C_Object, Memory.allocUtf8String("测试信息"),14);
|
||||
// Sq_HookFunc(S_Ptr("0x8678526"),
|
||||
|
||||
/*
|
||||
// 发包
|
||||
Haker.LoadHook("0x86485BA", ["pointer", "pointer", "int"],
|
||||
function(args) {
|
||||
print(args[0]);
|
||||
local Pack = NativePointer(args[1]);
|
||||
Pack = NativePointer(Pack.readPointer());
|
||||
local headIndex = Pack.add(0x19).readU16();
|
||||
if (headIndex == 83) {
|
||||
print("发了83包");
|
||||
|
||||
// local Bo = Sq_Point2Blob(args[1], 100);
|
||||
|
||||
// local Str = "[";
|
||||
// foreach(Value in Bo) {
|
||||
// Str = format("%s%02X", Str, Value);
|
||||
// Str += ",";
|
||||
// }
|
||||
// Str += "]";
|
||||
// print(Str);
|
||||
|
||||
// local bufftype = Pack.add(0x28).readU8();
|
||||
// local itemSlot = Pack.add(0x29).readU16();
|
||||
// local itemCount = Pack.add(0x2B).readU32();
|
||||
// local upType = Pack.add(0x31).readU8();
|
||||
// local ret = Pack.add(0x33).readU8();
|
||||
// local newUpLevel = Pack.add(0x34).readU8();
|
||||
// local equSlot = Pack.add(0x35).readU16();
|
||||
// print("bufftype: " + bufftype);
|
||||
// print("itemSlot: " + itemSlot);
|
||||
// print("itemCount: " + itemCount);
|
||||
// print("upType: " + upType);
|
||||
// print("ret: " + ret);
|
||||
// print("newUpLevel: " + newUpLevel);
|
||||
// print("equSlot: " + equSlot);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
function(args) {
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
Haker.LoadHook("0x080FC850", ["pointer", "pointer", "pointer", "int", "void"],
|
||||
function(args) {
|
||||
// local Arr = [0x95, 0xDA, 0xF6, 0x12, 0x25, 0xDF, 0xE0, 0x0B, 0x48, 0xDF, 0xCC, 0xC6, 0x95, 0xDA, 0x31, 0x3F, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x14, 0x00, 0xBE, 0x6B, 0x00, 0x00, 0xFF, 0xFF, 0x3C, 0x00, 0x00, 0x00, 0x00, 0xE5, 0xB9, 0xB8, 0xE5, 0xAD, 0x98, 0xE8, 0x80, 0x85, 0xE7, 0x9A, 0x84, 0xE5, 0xA5, 0xA7, 0xE7, 0xA5, 0x95];
|
||||
|
||||
// Sq_Memory_WriteByteArr(args[2], Arr);
|
||||
|
||||
// local Address = NativePointer(args[2]).add(35);
|
||||
// NativePointer(Address).writeU8(0x3c);
|
||||
// // local Address2 = NativePointer(args[2]).add(36);
|
||||
// NativePointer(Address).writeShort(65535);
|
||||
// NativePointer(Address2).writeShort(0x3E);
|
||||
|
||||
local Bo = Sq_Point2Blob(args[2], 100);
|
||||
|
||||
local Str = "[";
|
||||
foreach(Value in Bo) {
|
||||
Str = format("%s%02X", Str, Value);
|
||||
Str += ",";
|
||||
}
|
||||
Str += "]";
|
||||
print(Str);
|
||||
return null;
|
||||
},
|
||||
function(args) {
|
||||
local Pos = NativePointer(args[2]).add(27).readU16();
|
||||
local SUser = User(args[1]);
|
||||
SUser.SendUpdateItemList(1, 0, Pos);
|
||||
|
||||
// local Pack = Packet();
|
||||
// Pack.Put_Header(1, 83);
|
||||
// Pack.Put_Byte(1);
|
||||
// Pack.Put_Byte(11)
|
||||
// Pack.Put_Short(8195);
|
||||
// Pack.Put_Int(0);
|
||||
// Pack.Put_Short(65535);
|
||||
// Pack.Put_Byte(0);
|
||||
// Pack.Put_Byte(30);
|
||||
// Pack.Put_Byte(0);
|
||||
// Pack.Put_Byte(31);
|
||||
// Pack.Put_Byte(25);
|
||||
// Pack.Finalize(true);
|
||||
// SUser.Send(Pack);
|
||||
// Pack.Delete();
|
||||
|
||||
return null;
|
||||
});
|
||||
*/
|
||||
|
||||
// Sq_CallFunc(S_Ptr("0x84ECAA2"), "pointer", ["pointer", "float"], SUser.C_Object, 5.5);
|
||||
|
||||
/*
|
||||
|
||||
|
||||
|
||||
function(args) {
|
||||
print("AAA动态HOOK成功 城镇移动HOOK");
|
||||
print(CUser);
|
||||
print(id);
|
||||
}
|
||||
|
||||
*/
|
||||
// local md5 = MD5.GetFile("/dp_s/a.txt");
|
||||
// print("Md5文本值: " + md5);
|
||||
// local Arr = [];
|
||||
// foreach(char in md5) {
|
||||
// Arr.append(char.tointeger());
|
||||
// }
|
||||
// print("Md5字符值>>>");
|
||||
// printT(Arr);
|
||||
|
||||
|
||||
// local Io = IO("/dp_s/a.txt", "r+");
|
||||
// local Ret = Io.ReadBuffer(256);
|
||||
// printT(Ret);
|
||||
// Io.Close();
|
||||
|
||||
// local coro = newthread(TestIoP);
|
||||
// Timer.SetTimeOut(TestThread, 0, coro);
|
||||
// Timer.SetTimeOut(TestL, 1);
|
||||
|
||||
// local FileObj = file("/dp_s/a.txt", "r+");
|
||||
|
||||
// local Arr = [0, 1];
|
||||
// local T = {
|
||||
// TestWn = 666
|
||||
// };
|
||||
// // Arr.insert(0,getroottable());
|
||||
// Arr.insert(0, T);
|
||||
// TestWn.acall(Arr);
|
||||
|
||||
// sq_RunScript("测试加密脚本.sut");
|
||||
// local Opendir = Module.getExportByName(null, "opendir");
|
||||
// local Readdir = Module.getExportByName(null, "readdir");
|
||||
// local Closedir = Module.getExportByName(null, "closedir");
|
||||
// print("Opendir: " + Opendir);
|
||||
// print("Readdir: " + Readdir);
|
||||
// print("Closedir: " + Closedir);
|
||||
|
||||
// local UserList = World.GetOnlinePlayer();
|
||||
|
||||
// foreach (SUserObj in UserList) {
|
||||
// print(SUserObj.GetCharacLevel());
|
||||
// }
|
||||
|
||||
// api_exec_delay_function(function() {
|
||||
// print("先注册")
|
||||
// }, 2);
|
||||
|
||||
// api_exec_delay_function(function() {
|
||||
// print("后注册")
|
||||
// }, 5);
|
||||
|
||||
|
||||
// local rbTree = RedBlackTree();
|
||||
// // rbTree.insert(10);
|
||||
// // rbTree.insert(40);
|
||||
// // rbTree.insert(20);
|
||||
// // rbTree.insert(50);
|
||||
// // rbTree.insert(30);
|
||||
// // rbTree.insert(752);
|
||||
// // rbTree.insert(54);
|
||||
// // rbTree.insert(12);
|
||||
// // rbTree.insert(787);
|
||||
// // rbTree.insert(26);
|
||||
// // rbTree.insert(278);
|
||||
|
||||
// rbTree.inorderTraversal();
|
||||
|
||||
// local l = rbTree.pop();
|
||||
// print(">>>");
|
||||
// print("弹出值: " + l);
|
||||
// print(">>>");
|
||||
// rbTree.inorderTraversal();
|
||||
|
||||
|
||||
// Timer.SetTimeOut(function() {
|
||||
// print("注册 5 秒后执行")
|
||||
// }, 5);
|
||||
// Timer.SetTimeOut(function() {
|
||||
// print("注册 3 秒后执行")
|
||||
// }, 3);
|
||||
// Timer.SetTimeOut(function() {
|
||||
// print("注册 2 秒后执行")
|
||||
// }, 2);
|
||||
|
||||
};
|
||||
|
||||
Gm_InputFunc_Handle.AAA <- function(SUser, CmdString) {
|
||||
|
||||
// //查询的sql语句
|
||||
// local sql = "SELECT m_id,charac_name,lev,village,job,exp,Hp FROM charac_info WHERE charac_no = 1;";
|
||||
// //查询的元素类型,按sql中的顺序
|
||||
// local column_type_list = ["int", "string", "int", "int", "int", "int", "int"];
|
||||
// local SqlObj = MysqlPool.GetInstance().GetConnect();
|
||||
// local result = SqlObj.Select(sql, column_type_list);
|
||||
|
||||
// printT(result);
|
||||
|
||||
// MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
|
||||
|
||||
//从池子拿连接
|
||||
local SqlObj = MysqlPool.GetInstance().GetConnect();
|
||||
|
||||
//建库
|
||||
local sql = "SELECT slot FROM frida.setCharacSlotLimit WHERE account_id = " + account_id + ";";
|
||||
local column_type_list = ["int"];
|
||||
local result = SqlObj.Select(sql, column_type_list);
|
||||
if (result.len() > 0) {
|
||||
|
||||
}
|
||||
|
||||
//把连接还池子
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
};
|
||||
|
|
@ -98,4 +98,11 @@ Cb_History_Log_Func["PCoin-"] <- function(SUser, Data) {
|
|||
foreach(_Index, Func in Cb_History_PCoinDown_Func) {
|
||||
Func(SUser, Data);
|
||||
}
|
||||
}
|
||||
//使用复活币事件
|
||||
if (!("Cb_History_ItemLock_Func" in getroottable())) Cb_History_ItemLock_Func <- {};
|
||||
Cb_History_Log_Func["ItemLock"] <- function(SUser, Data) {
|
||||
foreach(_Index, Func in Cb_History_ItemLock_Func) {
|
||||
Func(SUser, Data);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
try {
|
||||
dofile("/dp_s/Main.nut");
|
||||
} catch (exception){
|
||||
|
||||
}
|
||||
|
|
@ -45,7 +45,6 @@ class ServerControl {
|
|||
}
|
||||
|
||||
constructor() {
|
||||
|
||||
//分发来自网关的包
|
||||
GatewaySocketPackFuncMap.rawset(20240730, function(Jso) {
|
||||
local UserList = [];
|
||||
|
|
@ -75,9 +74,25 @@ class ServerControl {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
}.bindenv(this));
|
||||
|
||||
//给频道所有玩家分发网关的包
|
||||
GatewaySocketPackFuncMap.rawset(20240806, function(Jso) {
|
||||
Jso.op <- Jso.realop;
|
||||
local Str = Json.Encode(Jso);
|
||||
Str = removeBackslashes(Str);
|
||||
local Pack = Packet();
|
||||
Pack.Put_Header(1, 130);
|
||||
Pack.Put_Byte(1);
|
||||
Pack.Put_Int(Str.len());
|
||||
Pack.Put_Binary(Str);
|
||||
Pack.Finalize(true);
|
||||
World.SendAll(Pack);
|
||||
Pack.Delete();
|
||||
}.bindenv(this));
|
||||
|
||||
|
||||
|
||||
//给查询指定uid cid列表的玩家信息
|
||||
GatewaySocketPackFuncMap.rawset(2023101902, function(Jso) {
|
||||
local UserList = [];
|
||||
|
|
@ -172,6 +187,7 @@ class ServerControl {
|
|||
Cb_Use_Item_Sp_Func[ItemId] <- function(SUser, ItemId) {
|
||||
local T = {
|
||||
op = RealOp,
|
||||
itemId = ItemId,
|
||||
uid = SUser.GetUID(),
|
||||
cid = SUser.GetCID()
|
||||
};
|
||||
|
|
@ -246,6 +262,14 @@ class ServerControl {
|
|||
}
|
||||
});
|
||||
|
||||
//给指定玩家下发邮件
|
||||
GatewaySocketPackFuncMap.rawset(20240928, function(Jso) {
|
||||
local UID = Jso.uid;
|
||||
local CID = Jso.cid;
|
||||
User.SendItemMail(UID, CID, Jso.result, Jso.title, Jso.content);
|
||||
});
|
||||
|
||||
|
||||
//给指定队伍设置复活币数量
|
||||
GatewaySocketPackFuncMap.rawset(20240804, function(Jso) {
|
||||
local UID = Jso.uid;
|
||||
|
|
@ -396,8 +420,8 @@ class ServerControl {
|
|||
//给注册玩家通关副本
|
||||
GatewaySocketPackFuncMap.rawset(2023110704, function(Jso) {
|
||||
local RealOp = Jso.realop;
|
||||
Cb_BossDie_Func[RealOp] <- function(SUser) {
|
||||
local PartyObj = SUser.GetParty();
|
||||
Cb_ClearDungeon_Enter_Func[RealOp] <- function(arg) {
|
||||
local PartyObj = Party(arg[0]);
|
||||
if (PartyObj) {
|
||||
local Bfobj = PartyObj.GetBattleField();
|
||||
local DgnObj = Bfobj.GetDgn();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,367 @@
|
|||
/*
|
||||
文件名:MarrySystem.nut
|
||||
路径:Dps_A/ProjectClass/MarrySystem/MarrySystem.nut
|
||||
创建日期:2024-10-01 10:02
|
||||
文件用途:结婚系统
|
||||
*/
|
||||
class Marry {
|
||||
//配置
|
||||
Config = null;
|
||||
//包头
|
||||
OP = 20078000;
|
||||
//请求结婚的列表
|
||||
RequestMarryList = {};
|
||||
//进入礼堂前的位置信息
|
||||
EnterAuditoriumPosList = {};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//数据库操作集
|
||||
Mysql_Operate_Func = {
|
||||
//查询结婚状态
|
||||
CheckMarryState = function(Cid) {
|
||||
local CheckSql = format(MARRY_SQL_LIST.CheckMarryState, Cid);
|
||||
//从池子拿连接
|
||||
local SqlObj = MysqlPool.GetInstance().GetConnect();
|
||||
local Ret = SqlObj.Select(CheckSql, ["int"]);
|
||||
//把连接还池子
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
//没结婚要返回false
|
||||
if (Ret.len()< 1 || Ret[0][0] == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return Ret[0][0];
|
||||
}
|
||||
}
|
||||
//新增结婚信息
|
||||
InseartMarryInfo = function(Cid, Name, TargerCid, Job, Level, Experience, Equip, State) {
|
||||
local sql = format(MARRY_SQL_LIST.InseartMarryInfo, Cid, Name, TargerCid, Job, Level, Experience, Equip, State, TargerCid, Equip, State);
|
||||
//从池子拿连接
|
||||
local SqlObj = MysqlPool.GetInstance().GetConnect();
|
||||
SqlObj.Exec_Sql(sql);
|
||||
//把连接还池子
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
}
|
||||
//查询结婚对象CID
|
||||
CheckMarryTarget = function(Cid) {
|
||||
local CheckSql = format(MARRY_SQL_LIST.CheckMarryTarget, Cid);
|
||||
//从池子拿连接
|
||||
local SqlObj = MysqlPool.GetInstance().GetConnect();
|
||||
local Ret = SqlObj.Select(CheckSql, ["int"]);
|
||||
//把连接还池子
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
//没结婚要返回false
|
||||
if (Ret.len()< 1 || Ret[0][0] == null) {
|
||||
return null;
|
||||
} else {
|
||||
return Ret[0][0];
|
||||
}
|
||||
}
|
||||
//删除结婚信息
|
||||
DeleteMarryInfo = function(Cid) {
|
||||
local delete_sql = format(MARRY_SQL_LIST.DeleteMarryInfo, Cid);
|
||||
//从池子拿连接
|
||||
local SqlObj = MysqlPool.GetInstance().GetConnect();
|
||||
SqlObj.Exec_Sql(delete_sql);
|
||||
//把连接还池子
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
}
|
||||
//查询结婚对象名字
|
||||
CheckMarryTargetName = function(Cid) {
|
||||
local CheckSql = format(MARRY_SQL_LIST.CheckMarryTargetName, Cid);
|
||||
//从池子拿连接
|
||||
local SqlObj = MysqlPool.GetInstance().GetConnect();
|
||||
local Ret = SqlObj.Select(CheckSql, ["string"]);
|
||||
//把连接还池子
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
//没结婚要返回false
|
||||
if (Ret.len()< 1 || Ret[0][0] == null) {
|
||||
return null;
|
||||
} else {
|
||||
return Ret[0][0];
|
||||
}
|
||||
}
|
||||
//修改结婚状态
|
||||
ChangeMarryState = function(Cid, State) {
|
||||
local Sql = format(MARRY_SQL_LIST.ChangeMarryState, State, Cid);
|
||||
//从池子拿连接
|
||||
local SqlObj = MysqlPool.GetInstance().GetConnect();
|
||||
SqlObj.Exec_Sql(Sql);
|
||||
//把连接还池子
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
}
|
||||
//新增礼堂信息
|
||||
InsertMarryRoom = function(Cid, Name, Time, Level, Target_CId, Target_Name, State, Index) {
|
||||
local Sql = format(MARRY_SQL_LIST.InsertMarryRoom, Cid, Name, Time, Level, Target_CId, Target_Name, State, Index);
|
||||
//从池子拿连接
|
||||
local SqlObj = MysqlPool.GetInstance().GetConnect();
|
||||
SqlObj.Exec_Sql(Sql);
|
||||
//把连接还池子
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//查看是否结婚包
|
||||
function CheckMarryStateCallBack(SUser, Jso) {
|
||||
local T = {
|
||||
op = OP + 10,
|
||||
Flag = Mysql_Operate_Func.CheckMarryState(SUser.GetCID())
|
||||
}
|
||||
SUser.SendJso(T);
|
||||
}
|
||||
|
||||
//申请订婚包
|
||||
function RequestMarry(SUser, Jso) {
|
||||
local PSUser = World.GetUserByName(Jso.Name);
|
||||
//判断对象角色是否在线
|
||||
if (!PSUser) {
|
||||
//没找到这个角色要返回一个错误包
|
||||
local T = {
|
||||
op = OP + 90,
|
||||
str = "未找到角色,请检查角色名或查看玩家是否在线"
|
||||
}
|
||||
SUser.SendNotiBox("未找到角色,请检查角色名或查看玩家是否在线", 1);
|
||||
}
|
||||
//判断是否是自己
|
||||
if (SUser.GetCID() == PSUser.GetCID()) {
|
||||
SUser.SendNotiBox("不能和自己结婚!", 1);
|
||||
return;
|
||||
}
|
||||
//查询两人状态必须都为未结婚
|
||||
local SUserState = Mysql_Operate_Func.CheckMarryState(SUser.GetCID());
|
||||
local PSUserState = Mysql_Operate_Func.CheckMarryState(PSUser.GetCID());
|
||||
if (SUserState) {
|
||||
SUser.SendNotiBox("抱歉,您已经结婚了!", 1);
|
||||
return;
|
||||
}
|
||||
if (PSUserState) {
|
||||
SUser.SendNotiBox("抱歉,对方已经结婚了...", 1);
|
||||
return;
|
||||
}
|
||||
|
||||
local T = {
|
||||
op = OP + 4,
|
||||
applicantCid = SUser.GetCID(),
|
||||
applicantUid = SUser.GetUID(),
|
||||
applicantName = SUser.GetCharacName(),
|
||||
}
|
||||
PSUser.SendJso(T);
|
||||
|
||||
//把请求加入到请求列表
|
||||
RequestMarryList.rawset(SUser.GetCID(), PSUser.GetCID());
|
||||
}
|
||||
|
||||
//订婚答复包
|
||||
function ResponseMarry(SUser, Jso) {
|
||||
local Flag = Jso.Flag;
|
||||
local applicantUser = World.GetUserByUidCid(Jso.applicantUid, Jso.applicantCid);
|
||||
if (Flag) {
|
||||
if (applicantUser) {
|
||||
//在请求列表里查看是否有请求
|
||||
if (!(RequestMarryList.rawin(Jso.applicantCid)) || RequestMarryList[Jso.applicantCid] != SUser.GetCID()) {
|
||||
SUser.SendNotiBox("抱歉,对方未发送请求!", 1);
|
||||
return;
|
||||
}
|
||||
|
||||
applicantUser.SendNotiBox("恭喜您!\n对方同意了您的请求。\n请寻找大司祭制定结婚的详细事宜。", 1);
|
||||
|
||||
Mysql_Operate_Func.InseartMarryInfo(Jso.applicantCid, applicantUser.GetCharacName(), SUser.GetCID(), applicantUser.GetCharacJob(), 0, 0, "no", 1);
|
||||
Mysql_Operate_Func.InseartMarryInfo(SUser.GetCID(), SUser.GetCharacName(), Jso.applicantCid, SUser.GetCharacJob(), 0, 0, "no", 1);
|
||||
|
||||
//刷新客户端的订婚状态
|
||||
local T = {
|
||||
op = OP + 10,
|
||||
Flag = 1
|
||||
};
|
||||
applicantUser.SendJso(T);
|
||||
SUser.SendJso(T);
|
||||
}
|
||||
} else {
|
||||
if (applicantUser) applicantUser.SendNotiBox("很遗憾!\n对方拒绝了您的请求", 1);
|
||||
}
|
||||
}
|
||||
|
||||
//退婚包
|
||||
function CancelMarry(SUser, Jso) {
|
||||
//加判断 必须两人都在订婚状态才能退婚
|
||||
|
||||
local DeleteArr = [];
|
||||
DeleteArr.push(SUser.GetCID());
|
||||
local Target_CId = Mysql_Operate_Func.CheckMarryTarget(SUser.GetCID());
|
||||
if (Target_CId) {
|
||||
DeleteArr.push(Target_CId);
|
||||
//如果对象存在则判断两人是否都在订婚状态
|
||||
local SUserState = Mysql_Operate_Func.CheckMarryState(SUser.GetCID())
|
||||
local TargetState = Mysql_Operate_Func.CheckMarryTarget(Target_CId);
|
||||
if (SUserState != 1 || TargetState != 1) return;
|
||||
}
|
||||
|
||||
|
||||
foreach(s_cid in DeleteArr) {
|
||||
Mysql_Operate_Func.DeleteMarryInfo(s_cid);
|
||||
}
|
||||
//刷新客户端的订婚状态
|
||||
local T = {
|
||||
op = OP + 10,
|
||||
Flag = 0
|
||||
};
|
||||
SUser.SendJso(T);
|
||||
//如果需要通知被退婚的对象
|
||||
if (DeleteArr.len() > 1) {
|
||||
local WorldMap = World.GetOnlinePlayer();
|
||||
foreach(W_User in WorldMap) {
|
||||
if (W_User.GetCID() == DeleteArr[1]) {
|
||||
W_User.SendJso(T);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//打开准备婚礼窗口
|
||||
function OpenPreparationWindow(SUser, Jso) {
|
||||
local Target_CId = Mysql_Operate_Func.CheckMarryTarget(SUser.GetCID());
|
||||
if (!Target_CId) {
|
||||
SUser.SendNotiBox("没有婚礼信息!", 1);
|
||||
return;
|
||||
}
|
||||
local Target_Name = Mysql_Operate_Func.CheckMarryTargetName(Target_CId);
|
||||
if (!Target_Name) {
|
||||
SUser.SendNotiBox("没有婚礼信息!", 1);
|
||||
return;
|
||||
}
|
||||
local T = {
|
||||
op = OP + 12,
|
||||
MyName = SUser.GetCharacName(),
|
||||
TargetName = Target_Name,
|
||||
};
|
||||
SUser.SendJso(T);
|
||||
}
|
||||
|
||||
//确认婚礼
|
||||
function ConfirmMarry(SUser, Jso) {
|
||||
local Target_CId = Mysql_Operate_Func.CheckMarryTarget(SUser.GetCID());
|
||||
if (!Target_CId) {
|
||||
SUser.SendNotiBox("没有婚礼信息!", 1);
|
||||
return;
|
||||
}
|
||||
local Time = Jso.Time;
|
||||
local Level = Jso.Level;
|
||||
local NeedItem = Config[("结婚等级" + (Level + 1) + "道具ID")];
|
||||
|
||||
//获取背包对象
|
||||
local InvenObj = SUser.GetInven();
|
||||
local SlotIdx = InvenObj.GetSlotById(NeedItem);
|
||||
if (SlotIdx == -1) {
|
||||
SUser.SendNotiBox("没有足够的道具!", 1);
|
||||
return;
|
||||
} else {
|
||||
InvenObj.DeleteItemCount(NeedItem, 1);
|
||||
|
||||
// //注册婚礼礼堂信息
|
||||
// AuditoriumList.rawset(SUser.GetCID(), {
|
||||
// Time = Time,
|
||||
// Level = Level,
|
||||
// Target_CId = Target_CId,
|
||||
// Target_Name = Mysql_Operate_Func.CheckMarryTargetName(Target_CId),
|
||||
// });
|
||||
|
||||
//当前时间戳 作为礼堂编号
|
||||
local Index = time();
|
||||
//注册婚礼礼堂信息
|
||||
Mysql_Operate_Func.InsertMarryRoom(SUser.GetCID(), SUser.GetCharacName(), Time, Level, Target_CId, Mysql_Operate_Func.CheckMarryTargetName(Target_CId), 1, Index);
|
||||
Mysql_Operate_Func.InsertMarryRoom(Target_CId, Mysql_Operate_Func.CheckMarryTargetName(Target_CId), Time, Level, SUser.GetCID(), SUser.GetCharacName(), 1, Index);
|
||||
|
||||
|
||||
Mysql_Operate_Func.ChangeMarryState(SUser.GetCID(), 2);
|
||||
Mysql_Operate_Func.ChangeMarryState(Target_CId, 2);
|
||||
|
||||
local T = {
|
||||
op = OP + 10,
|
||||
Flag = 2
|
||||
}
|
||||
|
||||
local WorldMap = World.GetOnlinePlayer();
|
||||
foreach(W_User in WorldMap) {
|
||||
if (W_User.GetCID() == Target_CId) {
|
||||
W_User.SendJso(T);
|
||||
W_User.SendNotiBox(format("婚礼将在%d分钟后举行!\n点击大司祭可进入礼堂。", (Time + 1) * 10), 1);
|
||||
}
|
||||
}
|
||||
SUser.SendJso(T);
|
||||
SUser.SendNotiBox(format("婚礼将在%d分钟后举行!\n点击大司祭可进入礼堂。", (Time + 1) * 10), 1);
|
||||
}
|
||||
}
|
||||
|
||||
//进入礼堂
|
||||
function EnterAuditorium(SUser, Jso) {
|
||||
local RoomId = Jso.room;
|
||||
//进入自己的礼堂
|
||||
if (RoomId == -1) {
|
||||
local MyState = Mysql_Operate_Func.CheckMarryState(SUser.GetCID());
|
||||
if (MyState != 2) {
|
||||
SUser.SendNotiBox("您访问的礼堂不存在!", 1);
|
||||
return;
|
||||
}
|
||||
|
||||
//向缓存写入进入时的坐标
|
||||
EnterAuditoriumPosList.rawset(SUser.GetCID(), SUser.GetLocation());
|
||||
//移动到礼堂
|
||||
World.MoveArea(SUser, Config["礼堂城镇编号"], Config["礼堂区域编号"], 55, 349);
|
||||
}
|
||||
}
|
||||
|
||||
//离开礼堂
|
||||
function LeaveAuditorium(SUser, Jso) {
|
||||
if (EnterAuditoriumPosList.rawin(SUser.GetCID())) {
|
||||
local Info = EnterAuditoriumPosList[SUser.GetCID()];
|
||||
//离开礼堂回到进入时的位置
|
||||
World.MoveArea(SUser, Info.Town, Info.Area, Info.Pos.X, Info.Pos.Y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
constructor() {
|
||||
Config = dofile("/root/娱心插件配置/结婚系统配置.dat");
|
||||
|
||||
//注册来自客户端的收包
|
||||
ClientSocketPackFuncMap.rawset(OP + 9, CheckMarryStateCallBack.bindenv(this));
|
||||
ClientSocketPackFuncMap.rawset(OP + 3, RequestMarry.bindenv(this));
|
||||
ClientSocketPackFuncMap.rawset(OP + 5, ResponseMarry.bindenv(this));
|
||||
ClientSocketPackFuncMap.rawset(OP + 7, CancelMarry.bindenv(this));
|
||||
ClientSocketPackFuncMap.rawset(OP + 11, OpenPreparationWindow.bindenv(this));
|
||||
ClientSocketPackFuncMap.rawset(OP + 13, ConfirmMarry.bindenv(this));
|
||||
ClientSocketPackFuncMap.rawset(OP + 15, EnterAuditorium.bindenv(this));
|
||||
ClientSocketPackFuncMap.rawset(OP + 17, LeaveAuditorium.bindenv(this));
|
||||
|
||||
//从池子拿连接
|
||||
local SqlObj = MysqlPool.GetInstance().GetConnect();
|
||||
local query = "SELECT COUNT(*) AS table_exists FROM information_schema.tables WHERE table_schema = 'zyk' AND table_name = 'marry';"
|
||||
local Res = SqlObj.Select(query, ["int"]);
|
||||
//需要建库
|
||||
if (Res.len() > 0 && Res[0][0] == 0) {
|
||||
local CreateSql = "CREATE TABLE IF NOT EXISTS zyk.marry (cid INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), target_cid INT(11), job INT(11), level INT(11), experience INT(11), equip VARCHAR(255), state INT(11));"
|
||||
local CreateSql2 = "CREATE TABLE IF NOT EXISTS zyk.marry_room (cid INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), time INT(11), level INT(11), target_cid INT(11), target_name VARCHAR(255), state INT(11), index INT(11));"
|
||||
SqlObj.Exec_Sql(CreateSql);
|
||||
SqlObj.Exec_Sql(CreateSql2);
|
||||
}
|
||||
//把连接还池子
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
}
|
||||
}
|
||||
|
||||
ProjectInitFuncMap.P_Marry <- Marry();
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
文件名:Marry_sql.nut
|
||||
路径:Dps_A/ProjectClass/MarrySystem/Marry_sql.nut
|
||||
创建日期:2024-10-03 20:57
|
||||
文件用途:结婚系统数据库命令
|
||||
*/
|
||||
|
||||
MARRY_SQL_LIST <- {};
|
||||
|
||||
//查询婚姻状态
|
||||
MARRY_SQL_LIST.CheckMarryState <- "SELECT state FROM zyk.marry WHERE cid = %d;";
|
||||
//查询婚姻对象
|
||||
MARRY_SQL_LIST.CheckMarryTarget <- "SELECT target_cid FROM zyk.marry WHERE cid = %d;";
|
||||
//查询婚姻对象名字
|
||||
MARRY_SQL_LIST.CheckMarryTargetName <- "SELECT name FROM zyk.marry WHERE cid = %d;";
|
||||
//通过cid删除一条婚姻信息
|
||||
MARRY_SQL_LIST.DeleteMarryInfo <- "DELETE FROM zyk.marry WHERE cid = %d;";
|
||||
//新增婚姻信息
|
||||
MARRY_SQL_LIST.InseartMarryInfo <- @"INSERT INTO zyk.marry (cid, name, target_cid, job, level, experience, equip, state)
|
||||
VALUES (%d, '%s', %d, %d, %d, %d,'%s',%d)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
target_cid = %d,
|
||||
equip = '%s',
|
||||
state = %d;";
|
||||
//通过cid修改婚姻状态
|
||||
MARRY_SQL_LIST.ChangeMarryState <- "UPDATE zyk.marry SET state = %d WHERE cid = %d;";
|
||||
//新增礼堂信息
|
||||
MARRY_SQL_LIST.InsertMarryRoom <- @"INSERT INTO zyk.marry_room (cid, name, time, level, target_cid, target_name, state, rindex)
|
||||
VALUES (%d, '%s', %d, %d, %d, '%s', %d, %d);";
|
||||
|
|
@ -27,7 +27,8 @@ enum RETTYPE {
|
|||
POINTER
|
||||
}
|
||||
|
||||
function sq_RunScript(Path)
|
||||
|
||||
function printT(T)
|
||||
{
|
||||
return dofile("/dp_s/" + Path);
|
||||
Sq_OutPutTable(Json.Encode(T));
|
||||
}
|
||||
|
|
@ -1,8 +1,29 @@
|
|||
getroottable().DebugModelFlag <- false;
|
||||
//初始化插件
|
||||
function InitPluginInfo() {
|
||||
Sq_CreatCConnectPool(2, 4, "127.0.0.1", 3306, "game", "uu5!^%jg");
|
||||
//初始化定时器
|
||||
_Timer_Object <- Timer();
|
||||
|
||||
|
||||
//初始化自动重载 只在15线开启
|
||||
local ConfigPath = Sq_Game_GetConfig();
|
||||
local Channel = ConfigPath.slice(ConfigPath.find("cfg/") + 4, ConfigPath.len());
|
||||
if (Channel.find("15")) GameManager.OpenHotFix("/dp_s/Dps_A");
|
||||
|
||||
local PoolObj = MysqlPool.GetInstance();
|
||||
PoolObj.SetBaseConfiguration("127.0.0.1", 3306, "game", "uu5!^%jg");
|
||||
//连接池大小
|
||||
PoolObj.PoolSize = 10;
|
||||
//初始化
|
||||
PoolObj.Init();
|
||||
|
||||
|
||||
|
||||
// Sq_CreatCConnectPool(2, 4, "127.0.0.1", 3306, "game", "uu5!^%jg");
|
||||
Sq_CreatSocketConnect("192.168.200.24", "65109");
|
||||
|
||||
//初始化结婚
|
||||
ProjectInitFuncMap.P_Marry <- Marry();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -17,6 +38,8 @@ function main() {
|
|||
|
||||
PrintTag();
|
||||
|
||||
GameManager.SetGameMaxLevel(95);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
文件名:New_Hook.nut
|
||||
路径:Dps_A/New_Hook.nut
|
||||
创建日期:2024-09-23 20:15
|
||||
文件用途:后续新增的玩家需求的HOOK
|
||||
*/
|
||||
//通用HOOK入口函数
|
||||
function _Hook_Enter_Currency_Func_(args, TableObj) {
|
||||
local Ret = null;
|
||||
foreach(Func in TableObj) {
|
||||
local Buf = Func(args);
|
||||
if (Buf) Ret = Buf;
|
||||
}
|
||||
return Ret;
|
||||
}
|
||||
//通用HOOK出口函数
|
||||
function _Hook_Leave_Currency_Func_(args, TableObj) {
|
||||
local Ret = null;
|
||||
foreach(Func in TableObj) {
|
||||
local Buf = Func(args);
|
||||
if (Buf) Ret = Buf;
|
||||
}
|
||||
return Ret;
|
||||
}
|
||||
|
||||
//通用注册HOOK函数
|
||||
function _Hook_Register_Currency_Func_(AddressString, ArgRetArr, EnterTable, LeaveTable) {
|
||||
Haker.LoadHook(AddressString, ArgRetArr,
|
||||
function(args) {
|
||||
return _Hook_Enter_Currency_Func_(args, EnterTable);
|
||||
},
|
||||
function(args) {
|
||||
return _Hook_Leave_Currency_Func_(args, LeaveTable);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//玩家新增道具时
|
||||
Cb_User_Insert_Item_Enter_Func <- {};
|
||||
Cb_User_Insert_Item_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x8502D86", ["pointer", "pointer", "int", "int", "int", "int", "int", "int", "int", "int", "int", "int", "int", "int", "int", "char", "int", "char", "char", "int"], Cb_User_Insert_Item_Enter_Func, Cb_User_Insert_Item_Leave_Func);
|
||||
|
||||
|
||||
//玩家捡起道具
|
||||
Cb_User_Get_Item_Enter_Func <- {};
|
||||
Cb_User_Get_Item_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x85B949C", ["pointer", "pointer", "int", "int", "int"], Cb_User_Get_Item_Enter_Func, Cb_User_Get_Item_Leave_Func);
|
||||
|
||||
//服务器Chat日志HOOK
|
||||
Cb_Server_Chat_Log_Enter_Func <- {};
|
||||
Cb_Server_Chat_Log_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x86C9638", ["pointer", "pointer", "char", "string", "char"], Cb_Server_Chat_Log_Enter_Func, Cb_Server_Chat_Log_Leave_Func);
|
||||
|
||||
//玩家上线设置IP
|
||||
Cb_User_Set_WebAddress_Enter_Func <- {};
|
||||
Cb_User_Set_WebAddress_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x84EC918", ["pointer", "pointer", "pointer"], Cb_User_Set_WebAddress_Enter_Func, Cb_User_Set_WebAddress_Leave_Func);
|
||||
|
||||
//服务端关闭执行函数
|
||||
Cb_Server_Close_Enter_Func <- {};
|
||||
Cb_Server_Close_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x829F28B", ["pointer", "pointer"], Cb_Server_Close_Enter_Func, Cb_Server_Close_Leave_Func);
|
||||
|
||||
//检查地下城的状况
|
||||
Cb_CheckInoutConditionDungeon_Enter_Func <- {};
|
||||
Cb_CheckInoutConditionDungeon_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x85ABC80", ["pointer", "pointer", "int", "int"], Cb_CheckInoutConditionDungeon_Enter_Func, Cb_CheckInoutConditionDungeon_Leave_Func);
|
||||
|
||||
//地下城现场杀死地狱党组怪物Cnt
|
||||
Cb_Field_KillHellPartyGroupMonsterCnt_Enter_Func <- {};
|
||||
Cb_Field_KillHellPartyGroupMonsterCnt_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x830D704", ["pointer", "pointer", "pointer", "bool"], Cb_Field_KillHellPartyGroupMonsterCnt_Enter_Func, Cb_Field_KillHellPartyGroupMonsterCnt_Leave_Func);
|
||||
|
||||
//经验收益
|
||||
Cb_Gain_Exp_Sp_Enter_Func <- {};
|
||||
Cb_Gain_Exp_Sp_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x866A3FE", ["pointer", "int", "int", "int", "int", "int", "char"], Cb_Gain_Exp_Sp_Enter_Func, Cb_Gain_Exp_Sp_Leave_Func);
|
||||
|
||||
|
||||
//货币收益
|
||||
Cb_Gain_Money_Enter_Func <- {};
|
||||
Cb_Gain_Money_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x84FF29C", ["int", "int", "char", "int", "int"], Cb_Gain_Money_Enter_Func, Cb_Gain_Money_Leave_Func);
|
||||
|
||||
//GetItem检查错误
|
||||
Cb_GetItem_Check_Error_Enter_Func <- {};
|
||||
Cb_GetItem_Check_Error_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x81C35AC", ["pointer", "pointer", "pointer", "int"], Cb_GetItem_Check_Error_Enter_Func, Cb_GetItem_Check_Error_Leave_Func);
|
||||
|
||||
//队伍清除副本
|
||||
Cb_ClearDungeon_Enter_Func <- {};
|
||||
Cb_ClearDungeon_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x85a9330", ["pointer", "void"], Cb_ClearDungeon_Enter_Func, Cb_ClearDungeon_Leave_Func);
|
||||
|
||||
//检查选择进入副本时状态
|
||||
Cb_SelectDungeon_Check_Error_Enter_Func <- {};
|
||||
Cb_SelectDungeon_Check_Error_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x81C7F32", ["pointer", "pointer", "pointer", "int"], Cb_SelectDungeon_Check_Error_Enter_Func, Cb_SelectDungeon_Check_Error_Leave_Func);
|
||||
|
||||
//切换装备
|
||||
Cb_CInventory_ChangeEquip_Enter_Func <- {};
|
||||
Cb_CInventory_ChangeEquip_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x84FC37E", ["pointer", "int", "pointer", "int"], Cb_CInventory_ChangeEquip_Enter_Func, Cb_CInventory_ChangeEquip_Leave_Func);
|
||||
|
||||
//获取通关时间回调
|
||||
Cb_CParty_SetBestClearTime_Enter_Func <- {};
|
||||
Cb_CParty_SetBestClearTime_Leave_Func <- {};
|
||||
_Hook_Register_Currency_Func_("0x85BE178", ["pointer", "char", "int", "int", "bool"], Cb_CParty_SetBestClearTime_Enter_Func, Cb_CParty_SetBestClearTime_Leave_Func);
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
abcdef
|
||||
1561561561563156156adaa
|
||||
asndKasdakdn阿基德拿手机卡迪那啊睡你的觉卡死
|
||||
|
|
@ -106,5 +106,32 @@
|
|||
},
|
||||
"Dps_A/CallBack/UserPartyGiveKick.nut": {
|
||||
"description": "踢出队伍"
|
||||
},
|
||||
"Dps_A/BaseClass/MysqlClass": {
|
||||
"description": "数据库类"
|
||||
},
|
||||
"Dps_A/BaseClass/MemoryClass": {
|
||||
"description": "内存类"
|
||||
},
|
||||
"Dps_A/BaseClass/MoudleClass": {
|
||||
"description": "模块类"
|
||||
},
|
||||
"Dps_A/BaseClass/RedBlackTreeClass": {
|
||||
"description": "红黑树类"
|
||||
},
|
||||
"Dps_A/BaseClass/TimerClass": {
|
||||
"description": "定时器类"
|
||||
},
|
||||
"Dps_A/BaseClass/IOClass": {
|
||||
"description": "Io类"
|
||||
},
|
||||
"Dps_A/BaseClass/MD5Class": {
|
||||
"description": "MD5类"
|
||||
},
|
||||
"Dps_A/BaseClass/HackerClass": {
|
||||
"description": "黑客类"
|
||||
},
|
||||
"Dps_A/BaseClass/HotFixClass": {
|
||||
"description": "热更新"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue