11111
This commit is contained in:
@@ -62,8 +62,8 @@ class Rindro_Animation {
|
||||
foreach(FrameObj in FrameList) {
|
||||
//如果有附加处理 格式化
|
||||
if (AdditionalOptions && AdditionalOptions.rawin("ImgFormat")) FrameObj.Img_Path = AdditionalOptions["ImgFormat"](FrameObj.Img_Path);
|
||||
local Png = Rindro_Image.Load(FrameObj.Img_Path).GetPng(FrameObj.Img_Index);
|
||||
Png.Draw(-500, -500);
|
||||
local Png = Rindro_Image.Load(FrameObj.Img_Path);
|
||||
// Png.Draw(-500, -500);
|
||||
|
||||
//如果有附加处理 坐标
|
||||
if (AdditionalOptions && AdditionalOptions.rawin("Pos")) {
|
||||
@@ -75,7 +75,22 @@ class Rindro_Animation {
|
||||
PngList.append(Png);
|
||||
}
|
||||
} else {
|
||||
error("创建Ani失败,找不到Ani数据");
|
||||
AnimationFlag = {};
|
||||
FrameList.append({
|
||||
AttackBox = [],
|
||||
DamageBox = [],
|
||||
Delay = 800,
|
||||
Flag = {},
|
||||
Img_Index = 0,
|
||||
Img_Path = "",
|
||||
Pos = {
|
||||
x = -248,
|
||||
y = -331
|
||||
}
|
||||
})
|
||||
|
||||
// print(Data);
|
||||
// print("创建Ani失败,找不到Ani数据");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +107,7 @@ class Rindro_Animation {
|
||||
}
|
||||
|
||||
function FlushFrame(Index) {
|
||||
if (PngList.len() <= 0) return;
|
||||
//同步当前帧
|
||||
CurrentFrameIndex = Index;
|
||||
//当前帧更换为本帧
|
||||
@@ -110,13 +126,12 @@ class Rindro_Animation {
|
||||
|
||||
//绘制
|
||||
function DrawFrame(X, Y) {
|
||||
// local NowDrawPng = CurrentFrame;
|
||||
local FrameObj = FrameList[CurrentFrameIndex];
|
||||
|
||||
//线性减淡
|
||||
if ("GRAPHIC_EFFECT_LINEARDODGE" in FrameObj.Flag) {
|
||||
L_sq_SetDrawImgModel(2, 0);
|
||||
}
|
||||
// local NowDrawPng = CurrentFrame;
|
||||
if (FrameList.len() <= 0) return;
|
||||
local FrameObj = FrameList[CurrentFrameIndex];
|
||||
// printT(FrameObj);
|
||||
|
||||
|
||||
//坐标偏移
|
||||
local XOffset = FrameObj.Pos.x;
|
||||
@@ -138,8 +153,17 @@ class Rindro_Animation {
|
||||
YRate = Fbuf.y;
|
||||
}
|
||||
|
||||
if (CurrentFrame) CurrentFrame.DrawEx(X + XOffset, Y + YOffset, Angle, RGBA, XRate, YRate);
|
||||
L_sq_ReleaseDrawImgModel();
|
||||
//线性减淡
|
||||
if ("GRAPHIC_EFFECT_LINEARDODGE" in FrameObj.Flag) {
|
||||
L_sq_SetDrawImgModel(2, 0);
|
||||
}
|
||||
|
||||
if (CurrentFrame) CurrentFrame.DrawExPng(FrameObj.Img_Index, X + XOffset, Y + YOffset, Angle, RGBA, XRate, YRate);
|
||||
|
||||
//线性减淡
|
||||
if ("GRAPHIC_EFFECT_LINEARDODGE" in FrameObj.Flag) {
|
||||
L_sq_ReleaseDrawImgModel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -172,6 +196,14 @@ class Rindro_Animation {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function DrawIndex(X, Y, Index) {
|
||||
// return;
|
||||
if (IsUsability) {
|
||||
FlushFrame(Index);
|
||||
DrawFrame(X, Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -246,6 +278,65 @@ class Rindro_Draw_Character {
|
||||
},
|
||||
];
|
||||
|
||||
ENUM_RINDRO_JOB_FACE_HEIGHT = [
|
||||
//男鬼剑士
|
||||
{
|
||||
x = 11,
|
||||
y = 111
|
||||
},
|
||||
//女格斗
|
||||
{
|
||||
x = 9,
|
||||
y = 103
|
||||
},
|
||||
//男神枪手
|
||||
{
|
||||
x = 13,
|
||||
y = 131
|
||||
},
|
||||
//女魔法师
|
||||
{
|
||||
x = 14,
|
||||
y = 87
|
||||
},
|
||||
//男圣职者
|
||||
{
|
||||
x = 16,
|
||||
y = 126
|
||||
},
|
||||
//女神枪手
|
||||
{
|
||||
x = 11,
|
||||
y = 119
|
||||
},
|
||||
|
||||
//女暗夜使者
|
||||
{
|
||||
x = 12,
|
||||
y = 115
|
||||
},
|
||||
//男格斗家
|
||||
{
|
||||
x = 13,
|
||||
y = 119
|
||||
},
|
||||
//男魔法师
|
||||
{
|
||||
x = 13,
|
||||
y = 101
|
||||
},
|
||||
//黑暗武士
|
||||
{
|
||||
x = -42,
|
||||
y = -154
|
||||
},
|
||||
//缔造者
|
||||
{
|
||||
x = -46,
|
||||
y = -126
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
//获取角色AniBy装备
|
||||
function GetCharacAniByEqu(Job, Equ, AniName) {
|
||||
@@ -379,8 +470,15 @@ class Rindro_Draw_Character {
|
||||
L_sq_DrawCode(Name, 44 + X + ENUM_RINDRO_JOB_TITLE_HEIGHT[Job].x - (LenheartTextClass.GetStringLength(Name) / 2), Y + ENUM_RINDRO_JOB_TITLE_HEIGHT[Job].y + 24, sq_RGBA(255, 255, 255, 250), 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function DrawFace(X, Y) {
|
||||
setClip(X, Y, X + 22, Y + 18); //开始裁切
|
||||
foreach(AniInfo in DrawInfo) {
|
||||
AniInfo.Ani.DrawIndex(X + ENUM_RINDRO_JOB_FACE_HEIGHT[Job].x, Y + ENUM_RINDRO_JOB_FACE_HEIGHT[Job].y, 0);
|
||||
}
|
||||
releaseClip(); //裁切结束
|
||||
}
|
||||
}
|
||||
//鬼剑士
|
||||
//601580026 101550559
|
||||
// Sassq <- {};
|
||||
|
||||
@@ -192,21 +192,22 @@ class MemoryTool {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//解密读取内存地址的数据
|
||||
function DecodeMemoryData(Address) {
|
||||
local nEax, nEcx8, nEsi, nEdx, nTmp;
|
||||
nEax = L_sq_RA(Address);
|
||||
nEax = NativePointer(L_sq_I2P(Address)).readInt();
|
||||
if (nEax == -1) return nEax;
|
||||
nEcx8 = L_sq_RA(Address + 8);
|
||||
nEcx8 = NativePointer(L_sq_I2P(Address + 8)).readInt();
|
||||
if (nEcx8 == -1) return nEcx8;
|
||||
nEsi = L_sq_RA(0x1AF8D78);
|
||||
nEsi = NativePointer(L_sq_I2P(0x1AF8D78)).readInt();
|
||||
nEdx = nEax >> 16;
|
||||
nTmp = (nEdx << 2) + nEsi + 36;
|
||||
nEdx = L_sq_RA(nTmp);
|
||||
nEdx = NativePointer(L_sq_I2P(nTmp)).readInt();
|
||||
if (nEdx == -1) return nEdx;
|
||||
nEax = nEax & 65535;
|
||||
nTmp = (nEax << 2) + nEdx + 8468;
|
||||
nEax = L_sq_RA(nTmp);
|
||||
nEax = NativePointer(L_sq_I2P(nTmp)).readInt();
|
||||
if (nEax == -1) return nEax;
|
||||
nEdx = nEax & 0xFFFF;
|
||||
nEsi = nEdx << 16;
|
||||
@@ -285,4 +286,47 @@ class MemoryTool {
|
||||
Bl.seek(0);
|
||||
return Bl.readn('f');
|
||||
}
|
||||
}
|
||||
|
||||
//大数字
|
||||
class longlong {
|
||||
Value = null;
|
||||
//构造函数 不管是不是string类型都要转成string类型
|
||||
constructor(StrValue) {
|
||||
Value = StrValue.tostring();
|
||||
}
|
||||
|
||||
function _add(other) {
|
||||
return longlong(L_sq_LongLongOperation(this.Value, other.Value, "+"));
|
||||
}
|
||||
|
||||
function _sub(other) {
|
||||
return longlong(L_sq_LongLongOperation(this.Value, other.Value, "-"));
|
||||
}
|
||||
|
||||
function _mul(other) {
|
||||
return longlong(L_sq_LongLongOperation(this.Value, other.Value, "*"));
|
||||
}
|
||||
|
||||
function _div(other) {
|
||||
return L_sq_LongLongOperation(this.Value, other.Value, "/");
|
||||
}
|
||||
|
||||
function _unm() {
|
||||
return longlong(L_sq_LongLongOperation(longlong("0"), this.Value, "-"));
|
||||
}
|
||||
|
||||
function _modulo(other) {
|
||||
return longlong(L_sq_LongLongOperation(this.Value, other.Value, "%"));
|
||||
}
|
||||
|
||||
function GetFormat(FType) {
|
||||
local Buf = L_sq_LongLongOperation(this.Value, FType, "format");
|
||||
if (Buf.len()< 2) return Buf + ".0";
|
||||
local Value = Buf.slice(0, -1);
|
||||
local Unit = Buf.slice(-1);
|
||||
local RetStr = format(FType + Unit, Value.tofloat());
|
||||
return RetStr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,4 +42,19 @@ Rindro_Haker.LoadHook(0x674350, ["pointer", "int"],
|
||||
function(args) {
|
||||
|
||||
return null;
|
||||
});
|
||||
});
|
||||
|
||||
OnSetCharacter_Control.MarrySystem <- function() {
|
||||
if (getroottable().rawin("Yosin_14SkillXpos1") &&
|
||||
getroottable().rawin("Yosin_14SkillXpos2") &&
|
||||
getroottable().rawin("Yosin_14SkillYpos1") &&
|
||||
getroottable().rawin("Yosin_14SkillYpos2")
|
||||
) {
|
||||
for (local i = 6; i< 7; i++) {
|
||||
L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x30 + (i * 0x4)) + 0x14, Yosin_14SkillXpos1 + (i * 31));
|
||||
L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x30 + (i * 0x4)) + 0x18, Yosin_14SkillYpos1);
|
||||
L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x60 + (i * 0x4)) + 0x14, Yosin_14SkillXpos2 + (i * 31));
|
||||
L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x60 + (i * 0x4)) + 0x18, Yosin_14SkillYpos2);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -100,6 +100,49 @@ class R_Utils {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//获取Lst文件的返回Array
|
||||
function GetLstArr(Path, Header) {
|
||||
local Arr = [];
|
||||
local LstBuf = R_Utils.GetScriptFileReader(Path);
|
||||
if (LstBuf) {
|
||||
local IO = Sq_Point2Blob(L_sq_P2I(LstBuf.Buffer.C_Object), LstBuf.Size);
|
||||
local i = 2;
|
||||
while (i< LstBuf.Size) {
|
||||
if ((LstBuf.Size - i) >= 10) {
|
||||
IO.seek(i + 6); //内容指示位
|
||||
local FindKey = IO.readn('i');
|
||||
local Key = Rindro_Script.GetBinString(FindKey);
|
||||
if (Key) {
|
||||
local StrFilePath = Header + Key.tolower();
|
||||
Arr.append(StrFilePath);
|
||||
}
|
||||
} else break;
|
||||
i += 10;
|
||||
}
|
||||
}
|
||||
return Arr;
|
||||
}
|
||||
|
||||
//通过处理函数获取文件Table
|
||||
function GetFileTableByHandle(Path, Func) {
|
||||
local Data = {};
|
||||
local FileData = R_Utils.GetScriptFileReader(Path);
|
||||
if (FileData) {
|
||||
if (FileData.Size >= 7) {
|
||||
//创建Blob对象
|
||||
local IO = Sq_Point2Blob(L_sq_P2I(FileData.Buffer.C_Object), FileData.Size);
|
||||
//以5为单步从第二位开始遍历字节
|
||||
local i = 2;
|
||||
while (true) {
|
||||
if (i< FileData.Size && FileData.Size - i >= 5) {
|
||||
i = Func(Data, IO, i);
|
||||
} else break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -158,11 +201,11 @@ getroottable().DrawCodeCallBackFunc <- {};
|
||||
// // print("nut:" + format("%02x", args[3]));
|
||||
|
||||
// if (args[3]) {
|
||||
// // for (local i = 0; i< 10000; i++) {
|
||||
// local DrawCode = NativePointer((args[3])).readUnicodeString();
|
||||
// // print(DrawCode);
|
||||
// if (DrawCode in DrawCodeCallBackFunc)
|
||||
// DrawCodeCallBackFunc[DrawCode](args);
|
||||
// // print(args[3]);
|
||||
// // }
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
@@ -173,6 +216,7 @@ getroottable().DrawCodeCallBackFunc <- {};
|
||||
// return null;
|
||||
// });
|
||||
|
||||
|
||||
//绘制城镇回调
|
||||
getroottable().DrawTownCallBackFunc <- {};
|
||||
Rindro_Haker.LoadHook(0x1108700, ["int", "void"],
|
||||
@@ -193,8 +237,65 @@ Rindro_Haker.LoadHook(0x1108700, ["int", "void"],
|
||||
|
||||
|
||||
//顺图
|
||||
function Rindro_Gm_MoveMap()
|
||||
{
|
||||
|
||||
function Rindro_Gm_MoveMap(obj) {
|
||||
if (sq_IsKeyDown(OPTION_HOTKEY_PAUSE_IN_TOWER, ENUM_SUBKEY_TYPE_ALL) && RINDROLOCAL) {
|
||||
if (KeyPress.isKeyPress(0)) L_sq_MoveMap(2);
|
||||
if (KeyPress.isKeyPress(1)) L_sq_MoveMap(0);
|
||||
if (KeyPress.isKeyPress(2)) L_sq_MoveMap(3);
|
||||
if (KeyPress.isKeyPress(3)) L_sq_MoveMap(1);
|
||||
}
|
||||
}
|
||||
getroottable()["LenheartFuncTab"].rawset("Rindro_Gm_MoveMapFuncN", Rindro_Gm_MoveMap);
|
||||
getroottable()["LenheartFuncTab"].rawset("Rindro_Gm_MoveMapFuncN", Rindro_Gm_MoveMap);
|
||||
|
||||
|
||||
//丢弃物品回调
|
||||
getroottable().DiscardItemCallBackFunc <- {};
|
||||
|
||||
function Sq_DiscardItem(Item) {
|
||||
local Flag = true;
|
||||
foreach(Func in DiscardItemCallBackFunc) {
|
||||
local Ret = Func(Item);
|
||||
if (!Ret) Flag = false;
|
||||
}
|
||||
return Flag;
|
||||
}
|
||||
|
||||
//从exe获取字符串
|
||||
getroottable()["Sq_GetExeStr_Map"] <- {};
|
||||
function Sq_GetExeStr_Event(Index)
|
||||
{
|
||||
if(Index in getroottable()["Sq_GetExeStr_Map"]){
|
||||
return getroottable()["Sq_GetExeStr_Map"][Index](Index);
|
||||
}
|
||||
return Index;
|
||||
}
|
||||
|
||||
|
||||
// //hook打开窗口
|
||||
// Rindro_Haker.LoadHook(0xE6E070, ["int","int","int","int","void"],
|
||||
// function(args) {
|
||||
|
||||
// return null;
|
||||
// },
|
||||
// function(args) {
|
||||
// // print(666);
|
||||
// // print(format("%02x", args.pop()));
|
||||
// // TTTAni <- args.pop();
|
||||
// return null;
|
||||
// });
|
||||
|
||||
|
||||
// Rindro_Haker.LoadHook(0xE6E070, ["int", "int", "int", "int", "int"],
|
||||
// function(args) {
|
||||
// print("nut:" + format("%02x", args[0]));
|
||||
// print("nut:" + format("%02x", args[1]));
|
||||
// print("nut:" + format("%02x", args[2]));
|
||||
// print("nut:" + format("%02x", args[3]));
|
||||
// return null;
|
||||
// },
|
||||
// function(args) {
|
||||
// // print(666);
|
||||
// // print(format("%02x", args.pop()));
|
||||
// // TTTAni <- args.pop();
|
||||
// return null;
|
||||
// });
|
||||
@@ -6,8 +6,12 @@
|
||||
*/
|
||||
class Rindro_Png {
|
||||
C_Object = null;
|
||||
Path = null;
|
||||
Idx = null;
|
||||
|
||||
constructor(Object) {
|
||||
constructor(Object, Path, Idx) {
|
||||
this.Path = Path;
|
||||
this.Idx = Idx;
|
||||
this.C_Object = Object;
|
||||
}
|
||||
|
||||
@@ -22,15 +26,18 @@ class Rindro_Png {
|
||||
class Rindro_Image {
|
||||
|
||||
Img = null;
|
||||
Path = null;
|
||||
|
||||
constructor(Path) {
|
||||
this.Path = Path;
|
||||
//读取Img
|
||||
Img = L_Sq_CallFunc(0x11C0410, "int", FFI_THISCALL, ["int", "int", "int"], NativePointer(0x1B4684C).readInt(), 0, L_sq_P2I(Memory.allocUtf8String(Path).C_Object));
|
||||
}
|
||||
|
||||
function GetPng(Idx) {
|
||||
if (Img) {
|
||||
return Rindro_Png(L_Sq_CallFunc(0x11AA190, "int", FFI_THISCALL, ["int", "int"], Img, Idx));
|
||||
local PngObject = L_Sq_CallFunc(0x11AA190, "int", FFI_THISCALL, ["int", "int"], Img, Idx);
|
||||
return Rindro_Png(PngObject, Path, Idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class JSONParser {
|
||||
if (vargc > 0) converter = vargc[0];
|
||||
|
||||
|
||||
// actions for string tokens
|
||||
|
||||
local string = {
|
||||
go = function() {
|
||||
state = "ok";
|
||||
@@ -55,7 +55,7 @@ class JSONParser {
|
||||
}.bindenv(this)
|
||||
};
|
||||
|
||||
// the actions for number tokens
|
||||
|
||||
local number = {
|
||||
go = function() {
|
||||
state = "ok";
|
||||
@@ -75,8 +75,8 @@ class JSONParser {
|
||||
};
|
||||
|
||||
|
||||
// action table
|
||||
// describes where the state machine will go from each given state
|
||||
|
||||
|
||||
local action = {};
|
||||
|
||||
|
||||
@@ -188,9 +188,9 @@ class JSONParser {
|
||||
|
||||
action[":"] <- {
|
||||
colon = function() {
|
||||
// Check if the key already exists
|
||||
// NOTE previous code used 'if (key in container)...'
|
||||
// but this finds table ('container') member methods too
|
||||
|
||||
|
||||
|
||||
local err = false;
|
||||
foreach(akey, avalue in container) {
|
||||
if (akey == key) err = true;
|
||||
@@ -271,11 +271,11 @@ class JSONParser {
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
||||
state = "go";
|
||||
stack = [];
|
||||
|
||||
// current tokenizeing position
|
||||
|
||||
local start = 0;
|
||||
|
||||
try {
|
||||
@@ -285,14 +285,14 @@ class JSONParser {
|
||||
while (token = tokenizer.nextToken(str, start)) {
|
||||
|
||||
if ("ptfn" == token.type) {
|
||||
// punctuation/true/false/null
|
||||
|
||||
action[token.value][state]();
|
||||
} else if ("number" == token.type) {
|
||||
// number
|
||||
|
||||
value = token.value;
|
||||
number[state]();
|
||||
} else if ("string" == token.type) {
|
||||
// string
|
||||
|
||||
value = tokenizer.unescape(token.value);
|
||||
string[state]();
|
||||
}
|
||||
@@ -322,11 +322,11 @@ class JSONParser {
|
||||
function _convert(value, type, converter) {
|
||||
if ("function" == typeof converter) {
|
||||
|
||||
// # of params for converter function
|
||||
|
||||
|
||||
local parametercCount = 2;
|
||||
|
||||
// .getinfos() is missing on ei platform
|
||||
|
||||
if ("getinfos" in converter) {
|
||||
parametercCount = converter.getinfos().parameters.len() -
|
||||
1;
|
||||
@@ -361,19 +361,19 @@ class _JSONTokenizer {
|
||||
_unescapeRegex = null;
|
||||
|
||||
constructor() {
|
||||
// punctuation/true/false/null
|
||||
|
||||
this._ptfnRegex = regexp("^(?:\\,|\\:|\\[|\\]|\\{|\\}|true|false|null)");
|
||||
|
||||
// numbers
|
||||
|
||||
this._numberRegex = regexp("^(?:\\-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)");
|
||||
|
||||
// strings
|
||||
|
||||
this._stringRegex = regexp("^(?:\\\"((?:[^\\r\\n\\t\\\\\\\"]|\\\\(?:[\"\\\\\\/trnfb]|u[0-9a-fA-F]{4}))*)\\\")");
|
||||
|
||||
// ltrim pattern
|
||||
|
||||
this._ltrimRegex = regexp("^[\\s\\t\\n\\r]*");
|
||||
|
||||
// string unescaper tokenizer pattern
|
||||
|
||||
this._unescapeRegex = regexp("\\\\(?:(?:u\\d{4})|[\\\"\\\\/bfnrt])");
|
||||
}
|
||||
|
||||
@@ -389,20 +389,20 @@ class _JSONTokenizer {
|
||||
length,
|
||||
whitespaces;
|
||||
|
||||
// count # of left-side whitespace chars
|
||||
|
||||
whitespaces = this._leadingWhitespaces(str, start);
|
||||
start += whitespaces;
|
||||
|
||||
if (m = this._ptfnRegex.capture(str, start)) {
|
||||
// punctuation/true/false/null
|
||||
|
||||
value = str.slice(m[0].begin, m[0].end);
|
||||
type = "ptfn";
|
||||
} else if (m = this._numberRegex.capture(str, start)) {
|
||||
// number
|
||||
|
||||
value = str.slice(m[0].begin, m[0].end);
|
||||
type = "number";
|
||||
} else if (m = this._stringRegex.capture(str, start)) {
|
||||
// string
|
||||
|
||||
value = str.slice(m[1].begin, m[1].end);
|
||||
type = "string";
|
||||
} else {
|
||||
@@ -429,7 +429,7 @@ class _JSONTokenizer {
|
||||
}
|
||||
}
|
||||
|
||||
// unesacape() replacements table
|
||||
|
||||
_unescapeReplacements = {
|
||||
b = "\b",
|
||||
f = "\f",
|
||||
@@ -449,7 +449,7 @@ class _JSONTokenizer {
|
||||
if (m) {
|
||||
local token = str.slice(m[0].begin, m[0].end);
|
||||
|
||||
// append chars before match
|
||||
|
||||
local pre = str.slice(start, m[0].begin);
|
||||
res += pre;
|
||||
|
||||
@@ -482,8 +482,8 @@ class JSONEncoder {
|
||||
|
||||
static VERSION = "2.0.0";
|
||||
|
||||
// max structure depth
|
||||
// anything above probably has a cyclic ref
|
||||
|
||||
|
||||
static _maxDepth = 32;
|
||||
|
||||
|
||||
@@ -495,7 +495,7 @@ class JSONEncoder {
|
||||
function _encode(val, ...) {
|
||||
local depth = 0;
|
||||
if (vargc > 0) depth = vargv[0];
|
||||
// detect cyclic reference
|
||||
|
||||
if (depth > this._maxDepth) {
|
||||
throw "Possible cyclic reference";
|
||||
}
|
||||
@@ -511,7 +511,7 @@ class JSONEncoder {
|
||||
case "class":
|
||||
s = "";
|
||||
|
||||
// serialize properties, but not functions
|
||||
|
||||
foreach(k, v in val) {
|
||||
if (typeof v != "function") {
|
||||
s += ",\"" + k + "\":" + this._encode(v, depth + 1);
|
||||
@@ -547,12 +547,12 @@ class JSONEncoder {
|
||||
|
||||
if ("_serializeRaw" in val && typeof val._serializeRaw == "function") {
|
||||
|
||||
// include value produced by _serializeRaw()
|
||||
|
||||
r += val._serializeRaw().tostring();
|
||||
|
||||
} else if ("_serialize" in val && typeof val._serialize == "function") {
|
||||
|
||||
// serialize instances by calling _serialize method
|
||||
|
||||
r += this._encode(val._serialize(), depth + 1);
|
||||
|
||||
} else {
|
||||
@@ -561,15 +561,15 @@ class JSONEncoder {
|
||||
|
||||
try {
|
||||
|
||||
// iterate through instances which implement _nexti meta-method
|
||||
|
||||
foreach(k, v in val) {
|
||||
s += ",\"" + k + "\":" + this._encode(v, depth + 1);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
|
||||
// iterate through instances w/o _nexti
|
||||
// serialize properties, but not functions
|
||||
|
||||
|
||||
foreach(k, v in val.getclass()) {
|
||||
if (typeof v != "function") {
|
||||
s += ",\"" + k + "\":" + this._encode(val[k], depth + 1);
|
||||
@@ -585,13 +585,13 @@ class JSONEncoder {
|
||||
break;
|
||||
|
||||
case "blob":
|
||||
// This is a workaround for a known bug:
|
||||
// on device side Blob.tostring() returns null
|
||||
// (instaead of an empty string)
|
||||
|
||||
|
||||
|
||||
r += "\"" + (val.len() ? this._escape(val.tostring()) : "") + "\"";
|
||||
break;
|
||||
|
||||
// strings and all other
|
||||
|
||||
default:
|
||||
r += "\"" + this._escape(val.tostring()) + "\"";
|
||||
break;
|
||||
@@ -608,7 +608,7 @@ class JSONEncoder {
|
||||
local ch1 = (str[i] & 0xFF);
|
||||
|
||||
if ((ch1 & 0x80) == 0x00) {
|
||||
// 7-bit Ascii
|
||||
|
||||
|
||||
ch1 = format("%c", ch1);
|
||||
|
||||
@@ -637,16 +637,16 @@ class JSONEncoder {
|
||||
} else {
|
||||
|
||||
if ((ch1 & 0xE0) == 0xC0) {
|
||||
// 110xxxxx = 2-byte unicode
|
||||
|
||||
local ch2 = (str[++i] & 0xFF);
|
||||
res += format("%c%c", ch1, ch2);
|
||||
} else if ((ch1 & 0xF0) == 0xE0) {
|
||||
// 1110xxxx = 3-byte unicode
|
||||
|
||||
local ch2 = (str[++i] & 0xFF);
|
||||
local ch3 = (str[++i] & 0xFF);
|
||||
res += format("%c%c%c", ch1, ch2, ch3);
|
||||
} else if ((ch1 & 0xF8) == 0xF0) {
|
||||
// 11110xxx = 4 byte unicode
|
||||
|
||||
local ch2 = (str[++i] & 0xFF);
|
||||
local ch3 = (str[++i] & 0xFF);
|
||||
local ch4 = (str[++i] & 0xFF);
|
||||
|
||||
@@ -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