1111
This commit is contained in:
6
Dps_A/BaseClass/BigInt/BigInt.nut
Normal file
6
Dps_A/BaseClass/BigInt/BigInt.nut
Normal file
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
文件名:BigInt.nut
|
||||
路径:Dps_A/BaseClass/BigInt/BigInt.nut
|
||||
创建日期:2025-03-25 18:28
|
||||
文件用途:大数字类
|
||||
*/
|
||||
@@ -56,4 +56,66 @@ class BlobEx extends blob {
|
||||
return stream_myreadstring(count);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class blobex extends blob {
|
||||
|
||||
//-----------------Metamethods--------------------//
|
||||
function _typeof() {
|
||||
return "blobex";
|
||||
}
|
||||
//-----------------Metamethods--------------------//
|
||||
|
||||
constructor(arg) {
|
||||
//通过blob构造
|
||||
if (typeof arg == "blob") {
|
||||
base.constructor(arg.len());
|
||||
writeblob(arg);
|
||||
}
|
||||
//直接构造
|
||||
else {
|
||||
base.constructor(arg);
|
||||
}
|
||||
}
|
||||
|
||||
function writeblob(B) {
|
||||
base.writeblob(B);
|
||||
seek(0);
|
||||
}
|
||||
|
||||
function GetUShort() {
|
||||
return readn('w');
|
||||
}
|
||||
|
||||
function GetShort() {
|
||||
return readn('s');
|
||||
}
|
||||
|
||||
function charPtrToInt(arr) {
|
||||
local value = ((arr[0]) << 0) |
|
||||
((arr[1]) << 8) |
|
||||
((arr[2]) << 16) |
|
||||
((arr[3]) << 24);
|
||||
return value;
|
||||
}
|
||||
|
||||
function GetInt() {
|
||||
local CurTPos = tell();
|
||||
local Ret = charPtrToInt([this[CurTPos], this[CurTPos + 1], this[CurTPos + 2], this[CurTPos + 3]]);
|
||||
seek(4, 'c');
|
||||
return Ret;
|
||||
}
|
||||
|
||||
function Get256() {
|
||||
local Buf = readn('c');
|
||||
return (256.0 + Buf.tofloat()) % 256.0;
|
||||
}
|
||||
|
||||
function GetFloat() {
|
||||
return readn('f');
|
||||
}
|
||||
|
||||
function GetString(count) {
|
||||
return stream_myreadstring(count);
|
||||
}
|
||||
}
|
||||
@@ -94,6 +94,22 @@ class GameManager extends Base_C_Object {
|
||||
_AvatarUseJewel_Object <- AvatarUseJewel();
|
||||
}
|
||||
|
||||
//开启装备镶嵌
|
||||
function FixEquipUseJewel() {
|
||||
//装备镶嵌修复
|
||||
_EquimentUseJewel_Object <- EquimentUseJewel();
|
||||
}
|
||||
|
||||
//修复14技能
|
||||
function Fix14Skill() {
|
||||
Sq_WriteByteArr(S_Ptr("0x08604B1E"), [0x83, 0x7D, 0xEC, 0x07]);
|
||||
Sq_WriteByteArr(S_Ptr("0x08604B8C"), [0xC7, 0x45, 0xE4, 0x08, 0x00, 0x00, 0x00]);
|
||||
Sq_WriteByteArr(S_Ptr("0x08604A09"), [0x83, 0x7D, 0x0C, 0x07]);
|
||||
Sq_WriteByteArr(S_Ptr("0x086050b1"), [0xC7, 0x45, 0xEC, 0x08, 0x00, 0x00, 0x00]);
|
||||
Sq_WriteByteArr(S_Ptr("0x0860511c"), [0xC7, 0x45, 0xE8, 0x08, 0x00, 0x00, 0x00]);
|
||||
Sq_WriteByteArr(S_Ptr("0x08608D7B"), [0x83, 0xF8, 0x0B]);
|
||||
}
|
||||
|
||||
//修复下线卡城镇
|
||||
function FixSaveTown() {
|
||||
Cb_Set_Charac_Info_Detail_Enter_Func._FixSaveTown_ <- function(arg) {
|
||||
@@ -158,6 +174,31 @@ class GameManager extends Base_C_Object {
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
//副本可丢弃品级 传入一个值 3为神器
|
||||
function FixDungeonDropGrade(Level) {
|
||||
NativePointer("0x085A69F2").writeS8(Level);
|
||||
}
|
||||
|
||||
//邮件去除验证
|
||||
function FixEmailRemovalVerification() {
|
||||
//修改独立掉落原逻辑为不掉落
|
||||
local HexCode = Haker.AsmGenerateMcd(
|
||||
"mov eax, 0x0",
|
||||
"ret");
|
||||
Sq_WriteByteArr(S_Ptr("0x0868A51A"), HexCode);
|
||||
}
|
||||
|
||||
//修复拍卖行消耗品上架,设置最大总价,建议值2E
|
||||
function Fix_Auction_Regist_Item() {
|
||||
Haker.LoadHook("0x08213E40", ["int", "int", "bool"],
|
||||
function(args) {
|
||||
return null;
|
||||
},
|
||||
function(args) {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
//热重载
|
||||
function _Reload_List_Write_(Path) {
|
||||
|
||||
@@ -7,10 +7,18 @@
|
||||
class _Hacker {
|
||||
HookTable = null;
|
||||
|
||||
HookJumpMemoryTable = null;
|
||||
|
||||
__strtol__function__address__ = null;
|
||||
|
||||
NextReturnAddress = null;
|
||||
|
||||
constructor() {
|
||||
HookTable = {};
|
||||
HookJumpMemoryTable = {};
|
||||
}
|
||||
|
||||
|
||||
function UnLoadHook(AddressStr) {
|
||||
Sq_DeHookFunc(HookTable[AddressStr]);
|
||||
}
|
||||
@@ -23,9 +31,57 @@ class _Hacker {
|
||||
}
|
||||
|
||||
local Controler = Sq_HookFunc(S_Ptr(AddressStr), ArgumentArr, EnterFunc, LeaveFunc);
|
||||
print(Controler);
|
||||
HookTable.rawset(AddressStr, Controler);
|
||||
}
|
||||
|
||||
|
||||
function HexStringToInt(Str) {
|
||||
if (!__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;
|
||||
}
|
||||
|
||||
function AsmGenerateMcd(...) {
|
||||
local CodeArr = [];
|
||||
local CurCode = "";
|
||||
try {
|
||||
foreach(Str in vargv) {
|
||||
CurCode = Str;
|
||||
local Code = Sq_Asmjit_Compile(Str);
|
||||
CodeArr.extend(Code);
|
||||
}
|
||||
} catch (exception) {
|
||||
error("汇编代码有误,错误行: " + CurCode);
|
||||
}
|
||||
return CodeArr;
|
||||
}
|
||||
|
||||
function InsertCode(Address, Code) {
|
||||
//置入代码的大小
|
||||
local CodeSize = Code.len();
|
||||
//申请一块内存
|
||||
local MemBuffer = Memory.alloc(CodeSize);
|
||||
//记录
|
||||
HookJumpMemoryTable.rawset(Address, MemBuffer);
|
||||
//写入置入的代码
|
||||
MemBuffer.writeByteArray(Code);
|
||||
|
||||
//计算偏移
|
||||
local Offset = Sq_PointerOperationPointer(MemBuffer.C_Object, Sq_PointerOperation(S_Ptr(Address), 5, "+"), "-");
|
||||
local Str = "" + Offset;
|
||||
Str = Str.slice(Str.find("0x") + 4, -1);
|
||||
local JumpCodeArr = [0xE9];
|
||||
for (local i = 0; i< 4; i++) {
|
||||
local Index = -2 * (i + 1);
|
||||
local StrBuffer = "0x" + (Str.slice(Index).slice(0, 2));
|
||||
JumpCodeArr.push(HexStringToInt(StrBuffer));
|
||||
}
|
||||
Sq_WriteByteArr(S_Ptr(Address), JumpCodeArr);
|
||||
}
|
||||
}
|
||||
|
||||
function _Haker_SetNextReturnAddress(Address) {
|
||||
Haker.NextReturnAddress = "" + Address;
|
||||
}
|
||||
//初始化Hacker
|
||||
Haker <- _Hacker();
|
||||
@@ -14,26 +14,276 @@ class Http {
|
||||
Service = service;
|
||||
}
|
||||
|
||||
// 辅助函数:将参数表编码为 URL 编码字符串
|
||||
function _EncodeParams(params) {
|
||||
local encoded = "";
|
||||
foreach(key, value in params) {
|
||||
if (encoded.len() > 0) encoded += "&";
|
||||
encoded += key + "=" + value; // 需要实现 urlencode
|
||||
}
|
||||
return encoded;
|
||||
}
|
||||
|
||||
function Request(Type, Url, Content) {
|
||||
local Request = Type + " " + Url + " HTTP/1.1\r\nHost: " + Host + "\r\n";
|
||||
local RequestBuffer = Type + " " + Url + " HTTP/1.1\r\nHost: " + Host + "\r\n";
|
||||
|
||||
if (Content) {
|
||||
Request += "Content-Length: " + Content.len() + "\r\n";
|
||||
Request += "Content-Type: application/x-www-form-urlencoded\r\n";
|
||||
Request += "\r\n";
|
||||
Request += Content;
|
||||
RequestBuffer += "Content-Length: " + Content.len() + "\r\n";
|
||||
RequestBuffer += "Content-Type: application/x-www-form-urlencoded\r\n";
|
||||
RequestBuffer += "\r\n";
|
||||
RequestBuffer += Content;
|
||||
} else {
|
||||
Request += "Connection: close\r\n\r\n";
|
||||
RequestBuffer += "Connection: close\r\n\r\n";
|
||||
}
|
||||
return Sq_CreateHttp(Host, Service, Request);
|
||||
return Sq_CreateHttp(Host, Service, RequestBuffer);
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
function Post(Url, Content = null) {
|
||||
return Request("POST", Url, Content);
|
||||
function Post(Url, params = null) {
|
||||
local content = null;
|
||||
if (params != null && typeof params == "table") {
|
||||
content = _EncodeParams(params); // 编码参数
|
||||
}
|
||||
return Request("POST", Url, content);
|
||||
}
|
||||
|
||||
function Get(Url, Content = null) {
|
||||
return Request("GET", Url, Content);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function xorEncryptDecrypt(BlobObj, Key) {
|
||||
local Arr = [];
|
||||
for (local i = 0; i< BlobObj.len(); i++) {
|
||||
local currentKeyChar = Key[i % Key.len()];
|
||||
Arr.push(BlobObj[i] ^ currentKeyChar);
|
||||
}
|
||||
return Arr;
|
||||
}
|
||||
|
||||
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.slice(charArray4[i], charArray4[i] + 1);
|
||||
}
|
||||
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.slice(charArray4[j], charArray4[j] + 1);
|
||||
}
|
||||
|
||||
while (i++<3) {
|
||||
encoded += "=";
|
||||
}
|
||||
}
|
||||
return encoded;
|
||||
}
|
||||
|
||||
function AsciiToStr(code) {
|
||||
local str = Memory.alloc(1);
|
||||
str.writeS8(code);
|
||||
return str.readUtf8String();
|
||||
}
|
||||
|
||||
function base64_decode(input) {
|
||||
local base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
local base64_map = {};
|
||||
for (local i = 0; i< base64_chars.len(); i++) {
|
||||
local key = base64_chars.slice(i, i + 1);
|
||||
if (key != "=") {
|
||||
base64_map[key] <- i;
|
||||
}
|
||||
}
|
||||
local inputLength = input.len();
|
||||
local i = 0;
|
||||
local j = 0;
|
||||
local charArray4 = array(4);
|
||||
local charArray3 = array(3);
|
||||
local decoded = [];
|
||||
|
||||
while (inputLength--) {
|
||||
if (input.slice(i, i + 1) == "=") {
|
||||
charArray4[j++] = 0;
|
||||
} else {
|
||||
charArray4[j++] = base64_map[input.slice(i, i + 1)];
|
||||
}
|
||||
i++;
|
||||
if (j == 4) {
|
||||
charArray3[0] = (charArray4[0] << 2) + ((charArray4[1] & 0x30) >> 4);
|
||||
charArray3[1] = ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2);
|
||||
charArray3[2] = ((charArray4[2] & 0x3) << 6) + charArray4[3];
|
||||
|
||||
for (j = 0; j< 3; j++) {
|
||||
decoded.push(charArray3[j]);
|
||||
}
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (j) {
|
||||
for (local k = j; k< 4; k++) {
|
||||
charArray4[k] = 0;
|
||||
}
|
||||
|
||||
charArray3[0] = (charArray4[0] << 2) + ((charArray4[1] & 0x30) >> 4);
|
||||
charArray3[1] = ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2);
|
||||
charArray3[2] = ((charArray4[2] & 0x3) << 6) + charArray4[3];
|
||||
|
||||
for (local k = 0; k< j - 1; k++) {
|
||||
decoded.push(charArray3[k]);
|
||||
}
|
||||
}
|
||||
local ret = decoded.reverse();
|
||||
ret.remove(0);
|
||||
ret.push(0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
function GetMyIp() {
|
||||
local Hb = Http("tnedi.me");
|
||||
return Hb.Get("/");
|
||||
}
|
||||
|
||||
function generateRandomString(length) {
|
||||
local alphabet = "abcdefghijklmnopqrstuvwxyz";
|
||||
local result = "";
|
||||
for (local i = 0; i< length; i++) {
|
||||
local randomIndex = math.random(0, alphabet.len() - 1);
|
||||
result += alphabet.get(randomIndex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function Blend(str1, str2) {
|
||||
local alphabet = "abcdefghijklmnopqrstuvwxyz";
|
||||
local result = "";
|
||||
local len = MathClass.getMin(str1.len(), str2.len());
|
||||
for (local i = 0; i< len; i++) {
|
||||
print((str1[i].tointeger() % alphabet.len()) - 1);
|
||||
result += alphabet.slice((str1[i].tointeger() % alphabet.len()), (str1[i].tointeger() % alphabet.len()) + 1) + str2[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function Encode(Str, Key = [9, 4, 7, 3, 3, 0, 6, 7, 0]) {
|
||||
local StrPointer = Memory.allocUtf8String(Str);
|
||||
local BlobObj = StrPointer.readBinary(Str.len());
|
||||
local str = "";
|
||||
for (local i = 0; i< BlobObj.len(); i++) {
|
||||
str += BlobObj[i].tostring();
|
||||
str += ","
|
||||
}
|
||||
print(str)
|
||||
// printT(BlobObj);
|
||||
local Arr = xorEncryptDecrypt(BlobObj, Key);
|
||||
local encodestr = base64_encode(Arr);
|
||||
return encodestr;
|
||||
}
|
||||
|
||||
function Decode(Str, Key = [9, 4, 7, 3, 3, 0, 6, 7, 0]) {
|
||||
local StrArr = base64_decode(Str);
|
||||
local Arr = xorEncryptDecrypt(StrArr, Key);
|
||||
local str = "";
|
||||
for (local i = 0; i< Arr.len(); i++) {
|
||||
str += Arr[i].tostring();
|
||||
str += ","
|
||||
}
|
||||
print(str)
|
||||
local StrPointer = Memory.alloc(Arr.len());
|
||||
StrPointer.writeByteArray(Arr);
|
||||
local decodestr = StrPointer.readUtf8String(Arr.len());
|
||||
return decodestr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class HttpResponse {
|
||||
C_Object = null;
|
||||
constructor(obj) {
|
||||
C_Object = obj;
|
||||
}
|
||||
|
||||
function Write(Msg) {
|
||||
local response = "HTTP/1.1 200 OK\r\n";
|
||||
if (typeof Msg == "table") {
|
||||
response += "Content-Type: application/json\r\n";
|
||||
local JsonString = Json.Encode(Msg);
|
||||
response += "Content-Length: " + JsonString.len() + "\r\n";
|
||||
response += "\r\n";
|
||||
response += JsonString;
|
||||
}
|
||||
else if(typeof Msg == "string") {
|
||||
response += "Content-Type: text/plain\r\n";
|
||||
response += "Content-Length: " + Msg.len() + "\r\n";
|
||||
response += "\r\n";
|
||||
response += Msg;
|
||||
}
|
||||
|
||||
Sq_HttpServerResponse_Write(C_Object, response);
|
||||
}
|
||||
}
|
||||
|
||||
class HttpServer {
|
||||
|
||||
Host = null;
|
||||
Service = null;
|
||||
|
||||
//处理函数
|
||||
Handler = null;
|
||||
|
||||
|
||||
constructor(host, service = "80") {
|
||||
Host = host;
|
||||
Service = service;
|
||||
|
||||
getroottable()["HttpServer_" + Host + "_" + Service] <- this;
|
||||
}
|
||||
|
||||
function Listen(Func) {
|
||||
//记录处理函数
|
||||
Handler = Func;
|
||||
|
||||
local success = Sq_CreateHttpServer(Host, Service, this);
|
||||
if (success) {
|
||||
::print("Server started successfully.");
|
||||
} else {
|
||||
::print("Failed to start server.");
|
||||
}
|
||||
}
|
||||
|
||||
function Event(SocketObject, Msg) {
|
||||
Timer.SetTimeOut(Handler, 1, HttpResponse(SocketObject), Msg);
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,26 @@ class Inven extends Base_C_Object {
|
||||
|
||||
//检查背包是否拥有指定数量的指定道具
|
||||
function CheckItemCount(ItemId, ItemCount) {
|
||||
if (ItemId == 0) {
|
||||
//检查金币
|
||||
local Money = Sq_CallFunc(S_Ptr("0x817a188"), "int", ["pointer"], SUser.C_Object);
|
||||
if (Money >= ItemCount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (ItemId == -1) {
|
||||
//检查点券
|
||||
if (SUser.GetCera() >= ItemCount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (ItemId == -2) {
|
||||
//检查代币券
|
||||
if (SUser.GetCeraPoint() >= ItemCount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
local SlotIdx = GetSlotById(ItemId);
|
||||
if (SlotIdx != -1) {
|
||||
local SlotItem = GetSlot(1, SlotIdx);
|
||||
@@ -56,6 +76,8 @@ class Inven extends Base_C_Object {
|
||||
return Flag;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//销毁背包中指定表的道具及数量
|
||||
function DeleteArrItemCount(T) {
|
||||
foreach(value in T) {
|
||||
@@ -67,6 +89,22 @@ class Inven extends Base_C_Object {
|
||||
|
||||
//销毁背包中指定的道具及数量
|
||||
function DeleteItemCount(Id, Count) {
|
||||
if (Id == 0) {
|
||||
//处理金币
|
||||
SUser.RechargeMoney(-Count);
|
||||
return 1;
|
||||
}
|
||||
if (Id == -1) {
|
||||
//处理点券
|
||||
SUser.RechargeCera(-Count);
|
||||
return 1;
|
||||
}
|
||||
if (Id == -2) {
|
||||
//处理代币券
|
||||
SUser.RechargeCeraPoint(-Count);
|
||||
return 1;
|
||||
}
|
||||
|
||||
local Slot = GetSlotById(Id);
|
||||
local Ret = Sq_Inven_RemoveItemFormCount(this.C_Object, 1, Slot, Count, 10, 1);
|
||||
SUser.SendUpdateItemList(1, 0, Slot);
|
||||
@@ -77,4 +115,72 @@ class Inven extends Base_C_Object {
|
||||
function GetAvatarItemMgr() {
|
||||
return Sq_CallFunc(S_Ptr("0x80DD576"), "pointer", ["pointer"], this.C_Object);
|
||||
}
|
||||
|
||||
|
||||
//销毁背包中指定表的道具及数量 并且需要格子匹配
|
||||
function DeleteArrItemCountRindro(T) {
|
||||
foreach(value in T) {
|
||||
if (value.type == 0) {
|
||||
//如果是装备 按格子直接删除
|
||||
Sq_Inven_RemoveItemFormCount(this.C_Object, 1, value.pos, value.count, 10, 1);
|
||||
SUser.SendUpdateItemList(1, 0, value.pos);
|
||||
} else {
|
||||
//如果不是装备 走原逻辑
|
||||
local Slot = GetSlotById(value.itemId);
|
||||
Sq_Inven_RemoveItemFormCount(this.C_Object, 1, Slot, value.count, 10, 1);
|
||||
SUser.SendUpdateItemList(1, 0, Slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//检查背包是否拥有指定表的道具及数量 并且是装备还要匹配格子
|
||||
function CheckArrItemCountRindro(T) {
|
||||
local Flag = true;
|
||||
foreach(value in T) {
|
||||
if (!CheckItemCountRindro(value.itemId, value.count, value.pos)) Flag = false;
|
||||
}
|
||||
return Flag;
|
||||
}
|
||||
|
||||
//检查背包是否拥有指定数量的指定道具
|
||||
function CheckItemCountRindro(ItemId, ItemCount, Slot) {
|
||||
if (ItemId == 0) {
|
||||
//检查金币
|
||||
local Money = Sq_CallFunc(S_Ptr("0x817a188"), "int", ["pointer"], SUser.C_Object);
|
||||
if (Money >= ItemCount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (ItemId == -1) {
|
||||
//检查点券
|
||||
if (SUser.GetCera() >= ItemCount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (ItemId == -2) {
|
||||
//检查代币券
|
||||
if (SUser.GetCeraPoint() >= ItemCount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
local SlotIdx = GetSlotById(ItemId);
|
||||
if (SlotIdx != -1) {
|
||||
local SlotItem = GetSlot(1, SlotIdx);
|
||||
if (SlotItem) {
|
||||
if (SlotItem.GetType() != "装备") {
|
||||
if (SlotItem.GetAdd_Info() >= ItemCount) return true;
|
||||
} else {
|
||||
//如果是装备 检查格子所在的道具id
|
||||
local ItemId2 = GetSlot(1, Slot).GetIndex();
|
||||
//如果这个格子的道具id就是发来的id 那么返回true
|
||||
if (ItemId == ItemId2) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,11 @@ class Memory {
|
||||
|
||||
class NativePointer extends Base_C_Object {
|
||||
|
||||
function _tyoeof()
|
||||
{
|
||||
return "Sq_Pointer";
|
||||
}
|
||||
|
||||
constructor(T) {
|
||||
if (typeof T == "integer") {
|
||||
base.constructor(Sq_New_Point(T));
|
||||
|
||||
@@ -104,4 +104,5 @@ class Packet extends Base_C_Object {
|
||||
Sq_Delete_Point(this.C_Object);
|
||||
// Sq_Packet_Delete(this.C_Object);
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -119,6 +119,7 @@ GatewaySocketPackFuncMap[20240416] <- function(Jso) {
|
||||
|
||||
//客户端包回调Map
|
||||
if (!getroottable().rawin("ClientSocketPackFuncMap")) ClientSocketPackFuncMap <- {}
|
||||
if (!getroottable().rawin("ClientSocketDP_SPackFuncMap")) ClientSocketDP_SPackFuncMap <- {}
|
||||
|
||||
|
||||
//收到来自客户端的包 只有130
|
||||
@@ -126,15 +127,27 @@ function OnClientSocketMsg(C_User, C_Pack_Str) {
|
||||
if (PacketDebugModel) print("收到客户端包: " + C_Pack_Str);
|
||||
|
||||
local Jso = Json.Decode(C_Pack_Str);
|
||||
if (Jso.op in ClientSocketPackFuncMap) {
|
||||
local SUser = User(C_User);
|
||||
ClientSocketPackFuncMap[Jso.op](SUser, Jso);
|
||||
if (Jso.op == 2147483646) {
|
||||
if (Jso.dps_id in ClientSocketDP_SPackFuncMap) {
|
||||
Jso.rawdelete("op");
|
||||
local SUser = User(C_User);
|
||||
ClientSocketDP_SPackFuncMap[Jso.dps_id](SUser, Jso);
|
||||
}
|
||||
} else {
|
||||
local SUser = User(C_User);
|
||||
if (SUser) {
|
||||
Jso.uid <- SUser.GetUID();
|
||||
Jso.cid <- SUser.GetCID();
|
||||
Socket.SendGateway(Jso);
|
||||
if (Jso.op in ClientSocketPackFuncMap) {
|
||||
local SUser = User(C_User);
|
||||
ClientSocketPackFuncMap[Jso.op](SUser, Jso);
|
||||
} else {
|
||||
local SUser = User(C_User);
|
||||
if (SUser) {
|
||||
Jso.uid <- SUser.GetUID();
|
||||
Jso.cid <- SUser.GetCID();
|
||||
Socket.SendGateway(Jso);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Register_DPS_Pack(Id, Func) {
|
||||
ClientSocketDP_SPackFuncMap.rawset(Id, Func);
|
||||
}
|
||||
@@ -118,7 +118,6 @@ class Timer {
|
||||
_Timer_Object.Date_Exec_Tree.insert(NextTimestep, func_info);
|
||||
}
|
||||
|
||||
|
||||
function Update() {
|
||||
CheckTimeOut();
|
||||
CheckCronTask();
|
||||
|
||||
@@ -242,6 +242,14 @@ class User extends Base_C_Object {
|
||||
Pack.Delete();
|
||||
}
|
||||
|
||||
//发送自定义DPS包
|
||||
function Send_DPS_Pack(Id, Jso) {
|
||||
Jso.op <- 2147483646;
|
||||
Jso.dps_id <- Id;
|
||||
SendJso(Jso);
|
||||
}
|
||||
|
||||
|
||||
//发送消息包
|
||||
function SendNotiPacket(Type1, Type2, Type3) {
|
||||
Sq_CUser_SendNotiPacket(this.C_Object, Type1, Type2, Type3);
|
||||
@@ -532,6 +540,126 @@ class User extends Base_C_Object {
|
||||
if (Ret) return AccountCargo(Ret, this);
|
||||
else return null;
|
||||
}
|
||||
|
||||
//获取角色身上的显示时装
|
||||
function GetAva() {
|
||||
//获取背包对象
|
||||
local InvenObj = this.GetInven();
|
||||
if (!InvenObj) return;
|
||||
local re = [];
|
||||
local job = this.GetCharacJob();
|
||||
|
||||
//遍历身上的每一件装备
|
||||
for (local u = 0; u <= 10; u++) {
|
||||
local EquObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_BODY, u);
|
||||
if (EquObj && !EquObj.IsEmpty) {
|
||||
//先拿克隆id 如果这个值有 那说明带的克隆这个是被克隆的装备 直接用这个 但是如果这个人什么都没带 只带了克隆 会显示克隆的id 所以还得判断这个id是不是克隆时装
|
||||
local clearId = Sq_CallFunc(S_Ptr("0x850d374"), "int", ["pointer", "int"], InvenObj.C_Object, u)
|
||||
|
||||
|
||||
local EquObjId = EquObj.GetIndex();
|
||||
//如果这个是克隆
|
||||
if (clearId > 0) {
|
||||
re.push(clearId);
|
||||
} else { //不是克隆 直接把id放上去
|
||||
re.push(EquObjId);
|
||||
}
|
||||
} else { //如果这个部位没东西 直接放默认时装上去
|
||||
re.push(defaultJobItemIdMap[job].index[u]);
|
||||
}
|
||||
}
|
||||
return re;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class defaultJobItemId {
|
||||
|
||||
/**
|
||||
* 头发
|
||||
*/
|
||||
hat = 0;
|
||||
|
||||
/**
|
||||
* 帽子
|
||||
*/
|
||||
hair = 0;
|
||||
|
||||
/**
|
||||
*脸
|
||||
*/
|
||||
face = 0;
|
||||
/**
|
||||
* 披风
|
||||
*/
|
||||
breast = 0;
|
||||
/**
|
||||
* 上衣
|
||||
*/
|
||||
coat = 0;
|
||||
|
||||
/**
|
||||
* 下装
|
||||
*/
|
||||
pants = 0;
|
||||
|
||||
/**
|
||||
* 腰部
|
||||
*/
|
||||
waist = 0;
|
||||
|
||||
/**
|
||||
* 鞋子
|
||||
*/
|
||||
shoes = 0;
|
||||
|
||||
/**
|
||||
* 皮肤
|
||||
*/
|
||||
skin = 0;
|
||||
|
||||
index = null;
|
||||
|
||||
constructor(hat, hair, face, breast, coat, pants, waist, shoes, skin) {
|
||||
index = [];
|
||||
this.hat = hat;
|
||||
this.hair = hair;
|
||||
this.face = face;
|
||||
this.breast = breast;
|
||||
this.coat = coat;
|
||||
this.pants = pants;
|
||||
this.waist = waist;
|
||||
this.shoes = shoes;
|
||||
this.skin = skin;
|
||||
|
||||
index.push(hat);
|
||||
index.push(hair);
|
||||
index.push(face);
|
||||
index.push(breast);
|
||||
index.push(coat);
|
||||
index.push(pants);
|
||||
index.push(waist);
|
||||
index.push(shoes);
|
||||
index.push(skin);
|
||||
index.push(0);
|
||||
index.push(0);
|
||||
}
|
||||
}
|
||||
//默认时装
|
||||
if (!(getroottable().rawin("defaultJobItemIdMap"))) {
|
||||
getroottable().defaultJobItemIdMap <- {};
|
||||
defaultJobItemIdMap.rawset(0, defaultJobItemId(39278, 39400, 0, 0, 40600, 41000, 0, 41800, 42200));
|
||||
defaultJobItemIdMap.rawset(1, defaultJobItemId(0, 43400, 0, 0, 44600, 45000, 0, 45800, 46200));
|
||||
defaultJobItemIdMap.rawset(2, defaultJobItemId(0, 47400, 0, 48426, 48600, 49000, 0, 49800, 50200));
|
||||
defaultJobItemIdMap.rawset(3, defaultJobItemId(51265, 51400, 0, 0, 52600, 53000, 0, 53800, 54200));
|
||||
defaultJobItemIdMap.rawset(4, defaultJobItemId(0, 55400, 55820, 0, 56600, 57000, 0, 57800, 58200));
|
||||
|
||||
defaultJobItemIdMap.rawset(5, defaultJobItemId(1600000, 1610000, 0, 0, 1640000, 1650000, 0, 1670000, 1680000));
|
||||
defaultJobItemIdMap.rawset(6, defaultJobItemId(1720000, 1730000, 0, 1750000, 1760000, 1770000, 0, 1790000, 1800000));
|
||||
defaultJobItemIdMap.rawset(7, defaultJobItemId(0, 29201, 0, 0, 29202, 29203, 0, 29204, 29205));
|
||||
defaultJobItemIdMap.rawset(8, defaultJobItemId(0, 2090000, 0, 0, 2120000, 2130000, 0, 2140000, 2150000));
|
||||
defaultJobItemIdMap.rawset(9, defaultJobItemId(39278, 39400, 0, 0, 40600, 41000, 0, 41800, 42200));
|
||||
defaultJobItemIdMap.rawset(10, defaultJobItemId(51265, 51400, 0, 0, 52600, 53000, 0, 53800, 54200));
|
||||
}
|
||||
|
||||
//获取公会名称
|
||||
@@ -604,4 +732,15 @@ function User::SendItemMail(UID, CID, ItemList, title, content) {
|
||||
//道具是否被锁
|
||||
function User::CheckItemLock(Type, Slot) {
|
||||
return Sq_CallFunc(S_Ptr("0x8646942"), "int", ["pointer", "int", "int"], this.C_Object, Type, Slot);
|
||||
}
|
||||
|
||||
|
||||
//查询本日金币交易额度
|
||||
function User::GetTradeGoldDaily() {
|
||||
return Sq_CallFunc(S_Ptr("0x8696600"), "int", ["pointer"], this.C_Object);
|
||||
}
|
||||
|
||||
//设置本日金币交易额度
|
||||
function User::SetTradeGoldDaily(Value) {
|
||||
return Sq_CallFunc(S_Ptr("0x84EC002"), "int", ["pointer", "int"], this.C_Object, Value);
|
||||
}
|
||||
Reference in New Issue
Block a user