11111
This commit is contained in:
@@ -24,6 +24,14 @@ class BlobEx extends blob {
|
||||
return readn('w');
|
||||
}
|
||||
|
||||
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]]);
|
||||
@@ -55,6 +63,59 @@ class BlobEx extends blob {
|
||||
|
||||
Rindro_Script_Bin_Data <- [];
|
||||
|
||||
class _PVF_Data_ {
|
||||
//数据
|
||||
Data = null;
|
||||
//位置
|
||||
Pos = 0;
|
||||
//最大值
|
||||
Max = 0;
|
||||
|
||||
function _typeof() {
|
||||
return "pvf_data";
|
||||
}
|
||||
|
||||
constructor(gData) {
|
||||
Data = gData;
|
||||
Max = gData.len();
|
||||
}
|
||||
|
||||
function Last() {
|
||||
if (Pos > 0) {
|
||||
Pos--;
|
||||
return Get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function Seek(i) {
|
||||
if (Pos > 0 && Pos<(Max - 1)) {
|
||||
Pos = i;
|
||||
}
|
||||
}
|
||||
|
||||
function Get() {
|
||||
local Ret = Data[Pos];
|
||||
if (Pos<(Max - 1)) {
|
||||
Pos++;
|
||||
}
|
||||
return Ret;
|
||||
}
|
||||
|
||||
function Eof() {
|
||||
if (Pos == Max - 1)
|
||||
return true;
|
||||
}
|
||||
|
||||
function Next() {
|
||||
if (Pos<(Max - 1)) {
|
||||
Pos++;
|
||||
return Get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class Rindro_Script {
|
||||
|
||||
function Get_Ani_Flip_Type(data) {
|
||||
@@ -215,6 +276,8 @@ class Rindro_Script {
|
||||
if (Len > 0) {
|
||||
local Str = Ro.GetString(Len);
|
||||
Rindro_Script_Bin_Data.append(Str);
|
||||
} else {
|
||||
Rindro_Script_Bin_Data.append("");
|
||||
}
|
||||
CurrentIndex++;
|
||||
}
|
||||
@@ -222,8 +285,12 @@ class Rindro_Script {
|
||||
}
|
||||
|
||||
function GetBinString(Index) {
|
||||
if (Index< Rindro_Script_Bin_Data.len()) return Rindro_Script_Bin_Data[Index];
|
||||
return "";
|
||||
if (!(getroottable().rawin("ENUM_TW_GROWTYPE_VERS")) || ENUM_TW_GROWTYPE_VERS >= 24112901) //24112901更新了新的读取bin文件的方式
|
||||
return L_sq_StringBinById(Index);
|
||||
else {
|
||||
if (Index< Rindro_Script_Bin_Data.len()) return Rindro_Script_Bin_Data[Index];
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function GetLoadString(Key) {
|
||||
@@ -235,7 +302,7 @@ class Rindro_Script {
|
||||
local out = "";
|
||||
IO.seek(i); //内容指示位
|
||||
local currentByte = IO.readn('c'); //内容指示位
|
||||
local after = IO.readn('i');
|
||||
local after = IO.GetInt();
|
||||
switch (currentByte) {
|
||||
case 10: {
|
||||
IO.seek(i - 4);
|
||||
@@ -251,8 +318,9 @@ class Rindro_Script {
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
out += after + '\t';
|
||||
break;
|
||||
IO.seek(-4, 'c');
|
||||
local ret = IO.readn('i');
|
||||
return ret;
|
||||
}
|
||||
case 4: {
|
||||
local Bbuf = blob(4);
|
||||
@@ -289,7 +357,8 @@ class Rindro_Script {
|
||||
local EquipmentAtt = {};
|
||||
if (ReadObject.Size >= 7) {
|
||||
//创建Blob对象
|
||||
local IO = Sq_Point2Blob(L_sq_P2I(ReadObject.Buffer.C_Object), ReadObject.Size);
|
||||
local IOBUF = Sq_Point2Blob(L_sq_P2I(ReadObject.Buffer.C_Object), ReadObject.Size);
|
||||
local IO = BlobEx(IOBUF.readblob(IOBUF.len()));
|
||||
//以5为单步从第二位开始遍历字节
|
||||
local i = 2;
|
||||
while (true) {
|
||||
@@ -320,10 +389,10 @@ class Rindro_Script {
|
||||
EquipmentAtt["Aurora"] <- {};
|
||||
EquipmentAtt["Aurora"].Back <- [];
|
||||
EquipmentAtt["Aurora"].Front <- [];
|
||||
local Count = Rindro_Script.UnpackData(IO, i).tointeger() - 9;
|
||||
local Count = Rindro_Script.UnpackData(IO, i);
|
||||
i += 5;
|
||||
for (local z = 0; z< Count; z++) {
|
||||
local Layer = Rindro_Script.UnpackData(IO, i).tointeger() - 9;
|
||||
local Layer = Rindro_Script.UnpackData(IO, i);
|
||||
i += 5;
|
||||
local Path = Rindro_Script.UnpackData(IO, i).tolower();
|
||||
i += 5;
|
||||
@@ -343,9 +412,9 @@ class Rindro_Script {
|
||||
EquipmentAtt["Ani_" + Job] <- {};
|
||||
i += 5;
|
||||
|
||||
local Index1 = Rindro_Script.UnpackData(IO, i).tointeger() - 9;
|
||||
local Index1 = Rindro_Script.UnpackData(IO, i);
|
||||
i += 5;
|
||||
local Index2 = Rindro_Script.UnpackData(IO, i).tointeger() - 9;
|
||||
local Index2 = Rindro_Script.UnpackData(IO, i);
|
||||
i += 5;
|
||||
EquipmentAtt["Ani_" + Job].variation <- [Index1, Index2];
|
||||
EquipmentAtt["Ani_" + Job].layer_variation <- [];
|
||||
@@ -358,7 +427,7 @@ class Rindro_Script {
|
||||
break;
|
||||
} else if (Ret == "[layer variation]") {
|
||||
local InfoBuf = {};
|
||||
InfoBuf.Zorder <- Rindro_Script.UnpackData(IO, i).tointeger() - 9;
|
||||
InfoBuf.Zorder <- Rindro_Script.UnpackData(IO, i);
|
||||
i += 5;
|
||||
InfoBuf.Path <- Rindro_Script.UnpackData(IO, i);
|
||||
i += 5;
|
||||
@@ -594,6 +663,39 @@ class Rindro_Script {
|
||||
}
|
||||
return AniObject;
|
||||
}
|
||||
|
||||
//获取文件并处理
|
||||
function GetFileData(Path, Func) {
|
||||
local N_Buffer = R_Utils.GetScriptFileReader(Path);
|
||||
if (N_Buffer) {
|
||||
local IO = Sq_Point2Blob(L_sq_P2I(N_Buffer.Buffer.C_Object), N_Buffer.Size);
|
||||
IO = BlobEx(IO.readblob(IO.len()));
|
||||
return Rindro_Script.ResolvingData(IO, Func, Path);
|
||||
} else {
|
||||
print(Path + "找不到文件!");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function ResolvingData(IO, Func, Path) {
|
||||
local DataTable = {};
|
||||
DataTable.filepath <- Path;
|
||||
local DataArr = [];
|
||||
local Length = IO.len();
|
||||
if (Length >= 7) {
|
||||
local i = 2;
|
||||
while (true) {
|
||||
if (i< Length && Length - i >= 5) {
|
||||
local str = Rindro_Script.UnpackData(IO, i);
|
||||
i += 5;
|
||||
DataArr.push(str);
|
||||
} else break;
|
||||
}
|
||||
Func(DataTable, _PVF_Data_(DataArr));
|
||||
return DataTable;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Rindro_Script.GetBin();
|
||||
// Rindro_Script.GetBin();
|
||||
Rindro_Script.InitLoad_String();
|
||||
Reference in New Issue
Block a user