拓展字节包

This commit is contained in:
Lenheart 2025-07-05 22:29:11 +08:00
parent 41c31e80f6
commit 3c181a4631
2 changed files with 54 additions and 3 deletions

View File

@ -50,6 +50,16 @@ function Sq_Pack_ControlLocal(Chunk) {
}
}
//字节流包
function Sq_BlobPack_Control(Size,Pointer)
{
local Pack = Packet();
Pack.Load(Pointer,Size);
// print(Pack.GetInt());
// print(Pack.GetInt());
}
function SendPackToDP_S(Id, T) {
T.op <- 2147483646;
T.dps_id <- Id;
@ -69,6 +79,7 @@ Pack_Control.rawset(2024041602, LenheartGotoDgnCallBack);
//进入副本增加属性
function LenheartAdditionalAttributes(obj) {
obj = sq_ObjectToSQRCharacter(obj);
//在副本中
if (sq_GetCurrentModuleType() == 3) {
if (!CNSquirrelAppendage.sq_IsAppendAppendage(obj, "appendage/lenheartap.nut")) {
@ -76,12 +87,13 @@ function LenheartAdditionalAttributes(obj) {
local Abarr = {};
foreach(AtObj in getroottable()["LenheartAttributesTable"]) {
foreach(Apos, At in AtObj) {
if(!Abarr.rawin(Apos))Abarr[Apos] <- At;
else Abarr[Apos]+= At;
if (!Abarr.rawin(Apos)) Abarr[Apos] <- At;
else Abarr[Apos] += At;
}
}
local appendage = CNSquirrelAppendage.sq_AppendAppendage(obj, obj, -1, false, "appendage/lenheartap.nut", true);
CNSquirrelAppendage.sq_Append(appendage, obj, obj);
local change_appendage = appendage.sq_getChangeStatus("Yosin_LenheartDgnBuff");
if (!change_appendage) {
@ -154,4 +166,4 @@ function LenheartAdditionalCallBack(Chunk) {
getroottable().rawset("LenheartAttributesTable", T);
}
}
Pack_Control.rawset(20069016, LenheartAdditionalCallBack);
Pack_Control.rawset(20069016, LenheartAdditionalCallBack);

View File

@ -0,0 +1,39 @@
/*
文件名:Pack_Class.nut
路径:Base/_Tool/Pack_Class.nut
创建日期:2025-06-30 09:24
文件用途:字节包
*/
class Packet{
//读取指针位置
ReadIndex = 0;
//内存数据
Pointer = null;
//包大小
Size = 0;
//加载包
function Load(P,S)
{
Pointer = P;
Size = S;
}
//读取整形
function GetInt()
{
local Size_t = 4;
if(ReadIndex + Size_t > Size){
print("读取包越界!");
return;
}
local Buf = NativePointer(Pointer).add(ReadIndex).readInt();
ReadIndex += Size_t;
return Buf;
}
//读取
}