This commit is contained in:
2024-11-15 10:32:19 +08:00
parent c1df659af4
commit e1528c41bb
35 changed files with 6343 additions and 62 deletions

View File

@@ -10,19 +10,22 @@ function L_HUD_BloodBackground() {
if (!obj) return;
if (RootTab.rawin("HudUi_Obj")) {
RootTab.HudUi_Obj.BottomShow(obj);
}
}
if (RootTab.rawin("EventList_Obj")) {
foreach(win in EventList_Obj.Events) {
win.EventShow(obj);
}
}
}
getroottable().Camera_Pos <- 0;
getroottable().Camera_Pos <- {};
function L_Sync_Camera_Pos(Xpos) {
getroottable().Camera_Pos = Xpos;
// print(Xpos);
function L_Sync_Camera_Pos(Camera_Object) {
// print(Camera_Object);
// print(Camera_Object);
getroottable().Camera_Pos.X <- L_sq_RA(Camera_Object + 0x638);
getroottable().Camera_Pos.Y <- L_sq_RA(Camera_Object + 0x63C);
}

View File

@@ -9,6 +9,16 @@ function L_drawMainCustomUI_All() {
local obj = sq_getMyCharacter();
if (!obj) return;
//获取与上一帧的dt
if (!(getroottable().rawin("Rindro_DurationFlag"))) {
Rindro_DurationFlag <- L_Getmicroseconds();
Rindro_Duration <- 0;
} else {
local NowM = L_Getmicroseconds();
Rindro_Duration = NowM - Rindro_DurationFlag;
Rindro_DurationFlag = NowM;
}
local RootTab = getroottable();
//下帧执行任务事件
if (RootTab.rawin("LenheartNextFrameFuncTab")) {
@@ -121,6 +131,7 @@ function L_drawMainCustomUI_All() {
}
// if (Clock() - getroottable().Lsnzz >= 50) {
// getroottable().Lsnzz = Clock();
// local T = {
@@ -165,7 +176,10 @@ function L_drawMainCustomUI_All() {
// }
// print(sq_GetCurrentModuleType());
// Rindro_BaseToolClass.T_DrawDynamicAni(obj, "common/luke/newtile/02_success_back_1.ani", 430, 210 + 26, "卢克阻截开始" + AHSJKDNJKA);
}
// AHSJKDNJKA <- Clock();
// getroottable().SINNU <- Clock();
// getroottable().Lsnzz <- Clock();

View File

@@ -4,10 +4,11 @@
创建日期:2024-08-09 14:10
文件用途:获取伤害倍率
*/
RindroDamageRate <- 1.0;
function L_getCurrentModuleDamageRate(obj) {
if (!obj)
return 1.0;
local rate = 1.0;
local ClientRat = 1.0;
try {
@@ -16,5 +17,22 @@ function L_getCurrentModuleDamageRate(obj) {
ClientRat = 1.0;
}
return (rate * ClientRat);
}
return (RindroDamageRate * ClientRat);
}
function Lenheart_GetDamageRate_Fun(obj) {
//在城镇时
if (sq_GetCurrentModuleType() == 1) {
RindroDamageRate = 1.0;
}
}
//修改伤害回调
function SetDamageRateCallBack(Chunk) {
local Jso = Json.Decode(Chunk);
RindroDamageRate = Jso.rate;
}
Pack_Control.rawset(2024110902, SetDamageRateCallBack);
getroottable()["LenheartFuncTab"].rawset("GetDamageRateFuncN", Lenheart_GetDamageRate_Fun);

View File

@@ -336,7 +336,7 @@ class Lenheart_Character_Info_ClassC extends LenheartNewUI_Windows {
GetMyInfoFlag = false;
}
if (!WindowX || !OldWindowAddress) return;
if (!WindowX) return;
if (!GetMyInfoFlag) {
GetMyInfoFlag = true;
@@ -347,41 +347,39 @@ class Lenheart_Character_Info_ClassC extends LenheartNewUI_Windows {
SendPackEx(T);
}
X = L_sq_RA(OldWindowAddress + 0x14);
Y = L_sq_RA(OldWindowAddress + 0x18);
X = Base_X;
Y = Base_Y;
}
Base_X = 0;
Base_Y = 0;
OldWindowAddress = null;
function SyncState(Address) {
local WindowX = sq_GetPopupWindowMainCotrol(74);
local WindowAddress = L_sq_GetWindowById(74);
if (!WindowX || !WindowAddress) return false;
//确定是个人信息窗口才执行逻辑 并且返回true 不执行原逻辑
if (Address - WindowAddress <= 0x50000 && L_sq_RA(Address + 0x34) == 4089) {
OldWindowAddress = Address;
local obj = sq_getMyCharacter();
RealShow(obj);
Visible = true;
return true;
}
function SyncState(Args) {
Base_X = Args[0] + 800;
Base_Y = Args[1] - 174;
local obj = sq_getMyCharacter();
RealShow(obj);
Visible = true;
}
}
DrawCodeCallBackFunc.Rindro_Character_Info <- function(Args) {
if (getroottable().rawin("Lenheart_Character_Info_Class_Obj")) {
local MyWindow = getroottable().rawget("Lenheart_Character_Info_Class_Obj");
MyWindow.SyncState(Args);
}
}
//个人信息窗口逻辑
function L_Character_Info_Window(WindowObject) {
//返回Flase 原逻辑继续执行 返回Tue 原逻辑终止执行
local Flag = false;
if (getroottable().rawin("Lenheart_Character_Info_Class_Obj")) {
local MyWindow = getroottable().rawget("Lenheart_Character_Info_Class_Obj");
local Ret = MyWindow.SyncState(WindowObject);
if (Ret) Flag = true;
}
return Flag;
// //返回Flase 原逻辑继续执行 返回Tue 原逻辑终止执行
// local Flag = false;
// if (getroottable().rawin("Lenheart_Character_Info_Class_Obj")) {
// local MyWindow = getroottable().rawget("Lenheart_Character_Info_Class_Obj");
// local Ret = MyWindow.SyncState(WindowObject);
// if (Ret) Flag = true;
// }
// return Flag;
}
getroottable().rawdelete("Lenheart_Character_Info_Class_Obj");

View File

@@ -122,13 +122,19 @@ class Lenheart_EachC extends LenheartNewUI_Windows {
function InitNpcButton() {
Childrens = [];
if (NPC_ButtonMap.rawin(NPC_Index)) {
NPC_ButtonMap[NPC_Index](this);
foreach(Func in NPC_ButtonMap[NPC_Index]) {
Func(this);
}
}
this.Visible = true;
}
function AddEachForNpc(Index, Func) {
NPC_ButtonMap.rawset(Index, Func);
if (NPC_ButtonMap.rawin(Index)) {
NPC_ButtonMap[Index].append(Func);
return;
}
NPC_ButtonMap.rawset(Index, [Func]);
}
function RemoveEachForNpc(Index) {

View File

@@ -23,11 +23,26 @@ class R_Mouse {
function Lock() {
_Rindro_Cusor_.UseState = 1;
L_sq_WAB(0x1B46886, 1);
//技能描述窗口
Sq_Memory_WriteByteArr(L_sq_I2P(0x4CC47E), [0xE9, 0xA0, 0x00, 0x00, 0x00, 0x90]);
//物品描述窗口
Sq_Memory_WriteByteArr(L_sq_I2P(0xF63DDA), [0x90, 0x90, 0x90, 0x90, 0x90, 0x90]);
//buff信息描述窗口
Sq_Memory_WriteByteArr(L_sq_I2P(0x4BF532), [0x90, 0x90, 0x90, 0x90]);
//原生商城 个人信息等按钮的悬停
L_sq_WAB(0x4C4690, 0xC3);
//活动图标的悬停
L_sq_WAB(0x11C6510, 0xC3);
}
//解锁鼠标
function UnLock() {
_Rindro_Cusor_.UseState = 0;
L_sq_WAB(0x1B46886, 0);
Sq_Memory_WriteByteArr(L_sq_I2P(0x4CC47E), [0x39, 0x05, 0xE0, 0xF6, 0xA3, 0x01]);
Sq_Memory_WriteByteArr(L_sq_I2P(0xF63DDA), [0x56, 0xE8, 0x10, 0xFE, 0xFF, 0xFF]);
Sq_Memory_WriteByteArr(L_sq_I2P(0x4BF532), [0x75, 0x07, 0x32, 0xC0]);
L_sq_WAB(0x4C4690, 0x55);
L_sq_WAB(0x11C6510, 0x55);
}
//获取鼠标工作类型
function GetType() {

View File

@@ -0,0 +1,416 @@
/*
文件名:Animation_Class.nut
路径:Base/_Tool/Animation_Class.nut
创建日期:2024-10-21 16:57
文件用途:动画类
*/
class Rindro_Animation {
//Ani是否可用
IsUsability = true;
//当前帧数
CurrentFrameIndex = 0;
//当前帧时间
CurrentIndexT = 0;
//当前帧
CurrentFrame = null;
//Ani的标签
AnimationFlag = null;
//图片对象数组
PngList = null;
//帧对象数组
FrameList = null;
//附加选项
AdditionalOptions = null;
//角度
Angle = 0;
constructor(Data, ...) {
PngList = [];
FrameList = [];
//附加选项
if (vargc > 0) AdditionalOptions = vargv[0];
//初始化数据
InitData(Data);
}
function InitData(Data) {
local Buf;
if (type(Data) == "table") {
Buf = Data;
}
//从PVF数据加载
else if (type(Data) == "string") {
local ReadObject = R_Utils.GetScriptFileReader(Data);
if (ReadObject) {
Buf = Rindro_Script.ReadAnimation(ReadObject);
}
}
if (Buf) {
AnimationFlag = Buf.Flag;
FrameList = Buf.Frame;
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);
//如果有附加处理 坐标
if (AdditionalOptions && AdditionalOptions.rawin("Pos")) {
FrameObj.Pos.x += AdditionalOptions["Pos"].x;
FrameObj.Pos.y += AdditionalOptions["Pos"].y;
}
// Spritebuf.SetPosition(FrameObj.Pos);
PngList.append(Png);
}
} else {
error("创建Ani失败,找不到Ani数据");
}
}
//重置Ani
function Reset() {
IsUsability = true;
FlushFrame(0);
}
//获取当前帧信息
function GetCurrentFrameInfo() {
return FrameList[CurrentFrameIndex];
}
function FlushFrame(Index) {
//同步当前帧
CurrentFrameIndex = Index;
//当前帧更换为本帧
CurrentFrame = PngList[CurrentFrameIndex];
local FlagBuf = FrameList[CurrentFrameIndex].Flag;
//关键帧
if ("SET_FLAG" in FlagBuf) {
// if (StateMachine && StateMachine.State != -1) StateMachine.ChangeAniKeyFlag(FlagBuf.SET_FLAG);
}
//播放音效
if ("PLAY_SOUND" in FlagBuf) {
R_Utils.PlaySound(FlagBuf.PLAY_SOUND);
}
}
//绘制
function DrawFrame(X, Y) {
// local NowDrawPng = CurrentFrame;
local FrameObj = FrameList[CurrentFrameIndex];
//线性减淡
if ("GRAPHIC_EFFECT_LINEARDODGE" in FrameObj.Flag) {
L_sq_SetDrawImgModel(2, 0);
}
//坐标偏移
local XOffset = FrameObj.Pos.x;
local YOffset = FrameObj.Pos.y;
//染色
local RGBA = sq_RGBA(255, 255, 255, 255);
if ("RGBA" in FrameObj.Flag) {
local Fbuf = FrameObj.Flag.RGBA;
RGBA = sq_RGBA(Fbuf[0].tointeger(), Fbuf[1].tointeger(), Fbuf[2].tointeger(), Fbuf[3].tointeger());
}
//缩放
local XRate = 1.0;
local YRate = 1.0;
if ("IMAGE_RATE" in FrameObj.Flag) {
local Fbuf = FrameObj.Flag.IMAGE_RATE;
XRate = Fbuf.x;
YRate = Fbuf.y;
}
if (CurrentFrame) CurrentFrame.DrawEx(X + XOffset, Y + YOffset, Angle, RGBA, XRate, YRate);
L_sq_ReleaseDrawImgModel();
}
function Draw(X, Y) {
//可用性检查
if (IsUsability) {
DrawFrame(X, Y);
//累加当前帧时间
CurrentIndexT += Rindro_Duration;
//当前帧时间 超过 当前帧延迟就需要切换帧了
if ("Delay" in FrameList[CurrentFrameIndex] && CurrentIndexT >= FrameList[CurrentFrameIndex].Delay) {
CurrentIndexT = 0;
//如果当前帧小于总帧数就切换
if (CurrentFrameIndex<(FrameList.len() - 1)) {
FlushFrame(CurrentFrameIndex + 1);
}
//说明播放完毕了
else {
//如果有循环
if ("LOOP" in AnimationFlag) {
FlushFrame(0);
}
//没有循环触发状态机回调
else {
//将不再可用
IsUsability = false;
}
}
}
}
}
}
//绘制角色类
class Rindro_Draw_Character {
//名字
Name = null;
//职业
Job = null;
//绘制体信息
DrawInfo = null;
ENUM_RINDRO_JOB_NAME = ["swordman", "fighter", "gunner", "mage", "priest", "atgunner", "thief", "atfighter", "atmage", "demonicswordman", "creatormage"];
ENUM_RINDRO_JOB_TITLE_HEIGHT = [
//男鬼剑士
{
x = -42,
y = -154
},
//女格斗
{
x = -42,
y = -140
},
//男神枪手
{
x = -44,
y = -168
},
//女魔法师
{
x = -46,
y = -126
},
//男圣职者
{
x = -46,
y = -166
},
//女神枪手
{
x = -42,
y = -156
},
//女暗夜使者
{
x = -44,
y = -154
},
//男格斗家
{
x = -45,
y = -160
},
//男魔法师
{
x = -45,
y = -140
},
//黑暗武士
{
x = -42,
y = -154
},
//缔造者
{
x = -46,
y = -126
},
];
//获取角色AniBy装备
function GetCharacAniByEqu(Job, Equ, AniName) {
local AniList = [];
foreach(value in Equ) {
if (value > 0) {
local ListBuf = CreateEquipmentAni(value, Job, AniName);
AniList.extend(ListBuf);
}
}
local n = AniList.len();
for (local i = 0; i< n - 1; i++) {
for (local j = i + 1; j< n; j++) {
if (AniList[i].Layer > AniList[j].Layer) {
// 交换两个元素
local temp = AniList[i];
AniList[i] = AniList[j];
AniList[j] = temp;
}
}
}
return AniList;
}
function CreateEquipmentAni(Index, Job, AniName) {
local AniList = [];
//获取装备或时装的文件路径
local FilePath = R_Utils.GetEquPath(Index);
if (FilePath) {
local ReadObject = R_Utils.GetScriptFileReader("equipment/" + FilePath);
if (ReadObject) {
local Equ = Rindro_Script.ReadEquipment(ReadObject);
//职业名字
local JobName = ENUM_RINDRO_JOB_NAME[Job];
//没有装备类型
if (!(Equ.rawin("equipment_type"))) Equ.equipment_type <- "normal";
//光环单独处理 其他的在下面处理
if (Equ.equipment_type == "aurora avatar") {
foreach(Path in Equ.Aurora.Back) {
local AniBuf = Rindro_Animation(Path);
AniList.append({
Ani = AniBuf,
Layer = -10000,
});
}
foreach(Path in Equ.Aurora.Front) {
local AniBuf = Rindro_Animation(Path);
AniList.append({
Ani = AniBuf,
Layer = 10000,
});
}
}
//称号
else if (Equ.equipment_type == "title name") {
local PathBuf = "equipment/" + FilePath;
PathBuf = PathBuf.slice(0, R_Utils.String.FindLastSubstring(PathBuf, "/"));
local Path = PathBuf + "/" + Equ.custom_animation;
local Ao = {
Pos = ENUM_RINDRO_JOB_TITLE_HEIGHT[Job]
}
local AniBuf = Rindro_Animation(Path, Ao);
AniList.append({
Ani = AniBuf,
Layer = 10001,
});
}
//没有Ani 就那种透明时装
if (!(Equ.rawin("Ani_" + JobName))) return AniList;
//读取Ani配置
local AniScript = Equ["Ani_" + JobName];
if (Equ.equipment_type == "skin avatar") {
local Path;
if (JobName.find("at") >= 0) {
Path = format("character/%s/atanimation/%s", JobName.slice(2), AniName);
} else Path = format("character/%s/animation/%s", JobName, AniName);
local Ao = {
ImgVariation = AniScript.variation,
ImgFormat = function(ImgPath) {
if (ImgVariation[0] > 0) {
local Pos = ImgPath.find("%04d");
ImgPath = ImgPath.slice(0, Pos) + "%02d%02d" + ImgPath.slice(Pos + 4);
return format(ImgPath, ImgVariation[0], ImgVariation[1]);
} else {
return format(ImgPath, ImgVariation[1]);
}
}
}
local AniBuf = Rindro_Animation(Path, Ao);
AniList.append({
Ani = AniBuf,
Layer = 0,
});
} else {
foreach(Info in AniScript.layer_variation) {
local PathBuf = "equipment/" + FilePath;
PathBuf = PathBuf.slice(0, R_Utils.String.FindLastSubstring(PathBuf, "/"));
local Path = PathBuf + "/" + Info.Path + "/" + AniName;
local Ao = {
ImgVariation = AniScript.variation,
ImgFormat = function(ImgPath) {
return format(ImgPath, ImgVariation[0], ImgVariation[1]);
}
}
local AniBuf = Rindro_Animation(Path, Ao);
AniList.append({
Ani = AniBuf,
Layer = Info.Zorder,
});
}
}
}
}
return AniList;
}
constructor(Job, EquipmentArr, Action, Name) {
DrawInfo = GetCharacAniByEqu(Job, EquipmentArr, Action);
this.Job = Job;
this.Name = Name;
}
function Draw(X, Y) {
foreach(AniInfo in DrawInfo) {
AniInfo.Ani.Draw(X, Y);
}
if (Name) {
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);
}
}
}
//鬼剑士
//601580026 101550559
// Sassq <- {};
// Sassq[0] <- Rindro_Draw_Character(0, [
// 601550071,
// 601560067,
// 601570062,
// 601500069,
// 601510068,
// 601540069,
// 601520061,
// 601530060,
// 601580026,
// 0,
// 27610,
// 26058
// ], "rest.ani", "鬼剑士-Kina")
// //格斗家
// Sassq[1] <- Rindro_Draw_Character(1, [26373, 102550540, 102560700, 102570504, 102520514, 102500742, 102510739, 102540664, 102580139, 102530474], "rest.ani", "Kina")
// //神枪手
// Sassq[2] <- Rindro_Draw_Character(2, [26373, 104550553, 104560725, 104570492, 104520541, 104500750, 104510913, 104540671, 104580148, 104530494], "rest.ani", "Kina")
// //魔法师
// Sassq[3] <- Rindro_Draw_Character(3, [26373, 106550521, 106560580, 106570446, 106520529, 106500603, 106510607, 106540583, 106580143, 106530461], "rest.ani", "Kina")
// //圣职者
// Sassq[4] <- Rindro_Draw_Character(4, [26373, 108550600, 108560591, 108570687, 108520580, 108500587, 108510590, 108540562, 108580138, 108530560], "rest.ani", "Kina")
// //女枪
// Sassq[5] <- Rindro_Draw_Character(5, [26373, 105550431, 105560424, 105570386, 105520415, 105500424, 105510429, 105540408, 105580144, 105530361], "rest.ani", "Kina")
// //暗夜
// Sassq[6] <- Rindro_Draw_Character(6, [26373, 109550385, 109560393, 109570369, 109520406, 109500402, 109510414, 109540389, 109580134, 109530355], "rest.ani", "Kina")
// //男格斗
// Sassq[7] <- Rindro_Draw_Character(7, [26373, 103550302, 103560311, 103570274, 103520297, 103500297, 103510301, 103540284, 103580128, 103530246], "rest.ani", "Kina")
// //男法
// Sassq[8] <- Rindro_Draw_Character(8, [26373, 107550220, 107560223, 107570188, 107520224, 107500233, 107510231, 107540209, 107580129, 107530192], "rest.ani", "Kina")

View File

@@ -4,9 +4,17 @@
创建日期:2024-08-06 23:49
文件用途:基础工具类
*/
function printT(T) {
Sq_OutPutTable(Json.Encode(T));
}
//Json类
class Json {
function Encode(Table) {
local JsonObj = JSONEncoder();
return JsonObj.encode(Table);
local Size = Table.len();
local Pos = 0;
local Str = "{";

View File

@@ -7,6 +7,26 @@
//工具类
class R_Utils {
String = {
FindLastSubstring = function(str, substring) {
local strLen = str.len();
local subLen = substring.len();
local lastIndex = -1;
for (local i = 0; i <= strLen - subLen; i++) {
local found = true;
for (local j = 0; j< subLen; j++) {
if (str[i + j] != substring[j]) {
found = false;
break;
}
}
if (found) {
lastIndex = i;
}
}
return lastIndex;
}
}
//播放音效
function PlaySound(SoundName) {
L_Sq_CallFunc(0x75BD70, "void", FFI_MS_CDECL, ["pointer", "int", "int", "int"], Memory.allocUtf8String(SoundName).C_Object, -1, 0, 0);
@@ -28,6 +48,28 @@ class R_Utils {
return Reader.readBig5String();
}
//读取文件
function GetScriptFileReader(Path, ...) {
local AllocSize = 102400;
if (vargc > 0) AllocSize = vargv[0];
//读取路径
local ReadPath = L_sq_P2I(Memory.allocUtf8String(Path).C_Object);
//读取缓存
local Reader = Memory.alloc(AllocSize);
local ReadBuffer = L_sq_P2I(Reader.C_Object);
//实际读取大小
local ReadSizeer = Memory.alloc(4);
local ReadSizeBuffer = L_sq_P2I(ReadSizeer.C_Object);
local Flag = L_Sq_CallFunc(0x59E3D0, "bool", FFI_MS_CDECL, ["int", "int", "int", "int"], ReadPath, ReadBuffer, AllocSize, ReadSizeBuffer);
if (Flag) {
return {
Buffer = Reader,
Size = ReadSizeer.readInt()
};
} else return null;
}
//读取配置表
function ReadScriptConfig(Path, Size, ...) {
local CodePage = "utf8";
@@ -38,14 +80,121 @@ class R_Utils {
return Ret;
}
//获取一个指定装备的角色Ani
//获取一个指定装备的角色对象
function GetCharacByEqu(Job, GrowType, Equ) {
local Obj = sq_CreateCharacter(Job, GrowType);
local ObjAddress = L_Sq_GetObjectAddress(Obj);
foreach(value in Equ) {
local ItemObject = L_sq_GetItem(value);
L_Sq_CallFunc(0x825570, "void", FFI_THISCALL, ["int", "int"], ObjAddress, ItemObject);
// L_Sq_CallFunc(0x825570, "void", FFI_THISCALL, ["int", "int"], ObjAddress, ItemObject);
L_Sq_CallFunc(0x8265A0, "void", FFI_THISCALL, ["int", "int", "int"], ObjAddress, ItemObject, -1);
}
return Obj;
return sq_GetCNRDObjectToSQRCharacter(Obj);
}
}
//获取装备编号的得文件路径
function GetEquPath(Equ) {
local EquPathAddress = L_Sq_CallFunc(0x1219E80, "int", FFI_THISCALL, ["int", "int"], 0x1d7993c, Equ);
if (EquPathAddress) {
return NativePointer(EquPathAddress).readUnicodeString();
}
return null;
}
}
//根据List读取文件地址
// Rindro_Haker.LoadHook(0x1219E80, ["int", "int", "int"],
// function(args) {
// // print(format("%02x", args[0]));
// // print(args[2]);
// return null;
// },
// function(args) {
// // print(666);
// // print(format("%02x", args.pop()));
// // TTTAni <- args.pop();
// // local Path = NativePointer(L_sq_I2P(args.pop())).readUnicodeString();
// // if (Path != "character/swordman/weapon/katana/kat_lowkogaras.equ" && Path != "new_elvengard.twn") {
// // print(args[0]);
// // print(args[1]);
// // // print(format("%02x", args[1]));
// // print(Path);
// // }
// return null;
// });
//可能是构造装备以及构造其他东西
// Rindro_Haker.LoadHook(0x972220, ["int", "int", "int", "int"],
// function(args) {
// // print(format("%02x", args[0]));
// // local AniPath = NativePointer(L_sq_I2P(args[0])).readUnicodeString();
// if (args[0] == 10402) {
// print(args[0]);
// print(args[1]);
// print(args[2]);
// }
// // print(args[2]);
// return null;
// },
// function(args) {
// // print(666);
// // print(format("%02x", args.pop()));
// // TTTAni <- args.pop();
// return null;
// });
//绘制字符
getroottable().DrawCodeCallBackFunc <- {};
// Rindro_Haker.LoadHook(0x1206BD0, ["int", "int", "int", "pointer", "int", "void"],
// function(args) {
// // print("nut:" + format("%02x", args[3]));
// if (args[3]) {
// local DrawCode = NativePointer((args[3])).readUnicodeString();
// // print(DrawCode);
// if (DrawCode in DrawCodeCallBackFunc)
// DrawCodeCallBackFunc[DrawCode](args);
// // print(args[3]);
// }
// return null;
// },
// function(args) {
// // print(666);
// // print(format("%02x", args.pop()));
// // TTTAni <- args.pop();
// return null;
// });
//绘制城镇回调
getroottable().DrawTownCallBackFunc <- {};
Rindro_Haker.LoadHook(0x1108700, ["int", "void"],
function(args) {
// print("nut:" + format("%02x", args[3]));
// print(format("%02x", args[0]));
foreach(Func in DrawTownCallBackFunc) {
Func();
}
return null;
},
function(args) {
// print(666);
// print(format("%02x", args.pop()));
// TTTAni <- args.pop();
return null;
});
//顺图
function Rindro_Gm_MoveMap()
{
}
getroottable()["LenheartFuncTab"].rawset("Rindro_Gm_MoveMapFuncN", Rindro_Gm_MoveMap);

View File

@@ -0,0 +1,62 @@
/*
文件名:Image_Class.nut
路径:Base/_Tool/Image_Class.nut
创建日期:2024-10-21 16:58
文件用途: 图片类
*/
class Rindro_Png {
C_Object = null;
constructor(Object) {
this.C_Object = Object;
}
function Draw(X, Y) {
L_Sq_CallFunc(0x11A8F60, "int", FFI_THISCALL, ["int", "int", "int", "int"], NativePointer(0x1B45B94).readInt(), X, Y, this.C_Object);
}
function DrawEx(X, Y, Model, Rgba, Xrate, Yrate) {
L_Sq_CallFunc(0x11A97E0, "int", FFI_THISCALL, ["int", "int", "int", "int", "float", "float", "float", "int", "float", "float"], NativePointer(0x1B45B94).readInt(), X, Y, this.C_Object, Xrate, Yrate, Model, Rgba, 0, 0);
}
}
class Rindro_Image {
Img = null;
constructor(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));
}
}
function DrawPng(Idx, X, Y) {
local Buffer = GetPng(Idx);
Buffer.Draw(X, Y);
}
function DrawExPng(Idx, X, Y, Model, Rgba, Xrate, Yrate) {
local Buffer = GetPng(Idx);
Buffer.DrawEx(X, Y, Model, Rgba, Xrate, Yrate)
}
//加载
function Load(Path) {
if (!(getroottable().rawin("Rindro_Image_Map"))) getroottable().Rindro_Image_Map <- {};
if (getroottable().Rindro_Image_Map.rawin(Path)) return getroottable().Rindro_Image_Map[Path];
else {
getroottable().Rindro_Image_Map[Path] <- Rindro_Image(Path);
return getroottable().Rindro_Image_Map[Path];
}
}
}
/*
local Png = TestImg.GetPng(0);
Png.Draw(200, 200);
Png.DrawEx(100, 400, 0, sq_RGBA(255, 255, 255, 255), 1.5, 1.5);
*/

View File

@@ -8,7 +8,7 @@
class Memory {
function alloc(Size) {
return NativePointer(Size);
return NativePointer(Size.tostring());
}
function allocUtf8String(Str) {
@@ -22,11 +22,13 @@ class NativePointer {
constructor(T) {
if (type(T) == "integer") {
C_Object = Sq_New_Point(T);
//注册销毁伪析构
Register_Destruction(C_Object, this);
C_Object = L_sq_I2P(T);
} else if (type(T) == "userdata") {
C_Object = T;
} else if (type(T) == "string") {
C_Object = Sq_New_Point(T.tointeger());
//注册销毁伪析构
Register_Destruction(C_Object, this);
}
}
@@ -115,9 +117,6 @@ class NativePointer {
function read(type) {
local Buf = Sq_Point2Blob(L_sq_P2I(this.C_Object), 4);
foreach(value in Buf) {
print(value);
}
return Buf.readn(type);
}

599
Base/_Tool/Script_Class.nut Normal file
View File

@@ -0,0 +1,599 @@
/*
文件名:Script_Class.nut
路径:Base/_Tool/Script_Class.nut
创建日期:2024-10-21 14:49
文件用途:PVF读取类
*/
class BlobEx extends blob {
constructor(BaseBlob) {
blob.constructor(BaseBlob.len());
writeblob(BaseBlob);
}
function writeblob(B) {
blob.writeblob(B);
seek(0);
}
function GetUShort() {
return readn('s');
}
function GetShort() {
return readn('w');
}
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) {
local MBuf = Memory.alloc(count);
local BlobBuf = readblob(count);
local arr = [];
foreach(value in BlobBuf) {
arr.append(value);
}
MBuf.writeByteArray(arr);
return MBuf.readUtf8String(count);
}
}
Rindro_Script_Bin_Data <- [];
class Rindro_Script {
function Get_Ani_Flip_Type(data) {
switch (data) {
case 1:
return "HORIZON";
case 2:
return "VERTICAL";
case 3:
return "ALL";
default:
return "";
}
}
function Get_Ani_Effect_Type(data) {
switch (data) {
case 0:
return "NONE";
case 1:
return "DODGE";
case 2:
return "LINEARDODGE";
case 3:
return "DARK";
case 4:
return "XOR";
case 5:
return "MONOCHROME";
case 6:
return "SPACEDISTORT";
default:
return "";
}
}
function Get_Ani_Damage_Type(data) {
switch (data) {
case 0:
return "NORMAL";
case 1:
return "SUPERARMOR";
case 2:
return "UNBREAKABLE";
default:
return "";
}
}
function Get_Ani_Flag(data) {
switch (data) {
case 0:
return "LOOP";
case 1:
return "SHADOW";
case 3:
return "COORD";
case 7:
return "IMAGE_RATE";
case 8:
return "IMAGE_ROTATE";
case 9:
return "RGBA";
case 10:
return "INTERPOLATION";
case 11:
return "GRAPHIC_EFFECT";
case 12:
return "DELAY";
case 13:
return "DAMAGE_TYPE";
case 14:
return "DAMAGE_BOX";
case 15:
return "ATTACK_BOX";
case 16:
return "PLAY_SOUND";
case 17:
return "PRELOAD";
case 18:
return "SPECTRUM";
case 23:
return "SET_FLAG";
case 24:
return "FLIP_TYPE";
case 25:
return "LOOP_START";
case 26:
return "LOOP_END";
case 27:
return "CLIP";
case 28:
return "OPERATION";
default:
return "";
}
}
function endswith(Str, cmp) {
local len = cmp.len();
local EndStr = Str.slice(-len);
if (EndStr == cmp)
return true;
return false;
}
function InitLoad_String() {
if (getroottable().rawin("RindroLoadStringTable")) return;
getroottable().RindroLoadStringTable <- {};
local N_String = R_Utils.GetScriptFileReader("n_string.lst");
if (N_String) {
local IO = Sq_Point2Blob(L_sq_P2I(N_String.Buffer.C_Object), N_String.Size);
local i = 2;
while (i< N_String.Size) {
if ((N_String.Size - i) >= 10) {
IO.seek(i + 6); //内容指示位
local FindKey = IO.readn('i');
local Key = Rindro_Script.GetBinString(FindKey);
if (Key) {
local StrFilePath = Key.tolower();
local StrFile = R_Utils.GetScriptFileReader(StrFilePath, 10240000);
if (StrFile) {
local StrBuffer = StrFile.Buffer.readUtf8String(StrFile.Size);
local StrArr = split(StrBuffer, "\r\n");
foreach(index, strobj in StrArr) {
if (strobj.find(">") != null) {
local strobjarr = split(strobj, ">");
if (strobjarr.len() > 1) {
getroottable().RindroLoadStringTable.rawset(strobjarr[0], Sq_ConvertWideChar(strobjarr[1], "big5"));
}
}
}
}
}
} else break;
i += 10;
}
}
}
function GetBin() {
local BinFile = R_Utils.GetScriptFileReader("stringtable.bin", 40960000);
if (BinFile) {
local Ro = Sq_Point2Blob(L_sq_P2I(BinFile.Buffer.C_Object), BinFile.Size);
Ro = BlobEx(Ro.readblob(Ro.len()));
local Count = Ro.readn('i');
local CurrentIndex = 0;
for (local i = 0; i< Count; i++) {
Ro.seek(CurrentIndex * 4 + 4);
local StartPos = Ro.readn('i');
local EndPos = Ro.readn('i');
local Len = EndPos - StartPos;
Ro.seek(StartPos + 4);
if (Len > 0) {
local Str = Ro.GetString(Len);
Rindro_Script_Bin_Data.append(Str);
}
CurrentIndex++;
}
}
}
function GetBinString(Index) {
if (Index< Rindro_Script_Bin_Data.len()) return Rindro_Script_Bin_Data[Index];
return "";
}
function GetLoadString(Key) {
if (getroottable().RindroLoadStringTable.rawin(Key)) return getroottable().RindroLoadStringTable[Key];
else return "";
}
function UnpackData(IO, i) {
local out = "";
IO.seek(i); //内容指示位
local currentByte = IO.readn('c'); //内容指示位
local after = IO.readn('i');
switch (currentByte) {
case 10: {
IO.seek(i - 4);
local Before = IO.readn('i');
local Buf = Rindro_Script.GetBinString(after);
if (!Buf) {
Buf = "";
} else {
Buf = "<" + Before + "::" + Buf + "`" + Rindro_Script.GetLoadString(Buf) + "`>";
}
Buf = Buf + "\r\n";
out += Buf;
break;
}
case 2: {
out += after + '\t';
break;
}
case 4: {
local Bbuf = blob(4);
Bbuf.writen(after, 'i');
Bbuf.seek(0);
local Buf = Bbuf.readn('f');
out += after + '\t';
break;
}
case 6:
case 8:
case 7:
case 5: {
local Buf = Rindro_Script.GetBinString(after);
if (!Buf) Buf = "";
return Buf;
}
case 9: {
IO.seek(i + 6);
local Before = IO.readn('i');
local Buf = Rindro_Script.GetBinString(Before);
out += Rindro_Script.GetLoadString(Buf);
}
default:
out += "";
break;
}
return out;
}
function ReadEquipment(ReadObject) {
local EquipmentAtt = {};
if (ReadObject.Size >= 7) {
//创建Blob对象
local IO = Sq_Point2Blob(L_sq_P2I(ReadObject.Buffer.C_Object), ReadObject.Size);
//以5为单步从第二位开始遍历字节
local i = 2;
while (true) {
if (i< ReadObject.Size && ReadObject.Size - i >= 5) {
local str = Rindro_Script.UnpackData(IO, i);
i += 5;
//名称
if (str == "[name]") {
local RealKey = str.slice(1, str.len() - 1);
EquipmentAtt[RealKey] <- Rindro_Script.UnpackData(IO, i);
i += 5;
}
//装备类型
else if (str == "[equipment type]") {
local Buf = Rindro_Script.UnpackData(IO, i);
EquipmentAtt["equipment_type"] <- Buf.slice(1, -1);
i += 5;
}
//称号动画
else if (str == "[custom animation]") {
local Buf = Rindro_Script.UnpackData(IO, i).tolower();
EquipmentAtt["custom_animation"] <- Buf;
i += 5;
}
//光环生成效果
else if (str == "[aurora graphic effects]") {
EquipmentAtt["Aurora"] <- {};
EquipmentAtt["Aurora"].Back <- [];
EquipmentAtt["Aurora"].Front <- [];
local Count = Rindro_Script.UnpackData(IO, i).tointeger() - 9;
i += 5;
for (local z = 0; z< Count; z++) {
local Layer = Rindro_Script.UnpackData(IO, i).tointeger() - 9;
i += 5;
local Path = Rindro_Script.UnpackData(IO, i).tolower();
i += 5;
if (Layer == 0) EquipmentAtt["Aurora"].Back.append(Path);
if (Layer == 1) EquipmentAtt["Aurora"].Front.append(Path);
}
i += 5;
}
//Ani
else if (str == "[animation job]") {
local Job = Rindro_Script.UnpackData(IO, i).slice(1, -1);
local SpacePos = Job.find(" ");
if (SpacePos) {
Job = Job.slice(0, SpacePos) + Job.slice(SpacePos + 1);
}
i += 5;
EquipmentAtt["Ani_" + Job] <- {};
i += 5;
local Index1 = Rindro_Script.UnpackData(IO, i).tointeger() - 9;
i += 5;
local Index2 = Rindro_Script.UnpackData(IO, i).tointeger() - 9;
i += 5;
EquipmentAtt["Ani_" + Job].variation <- [Index1, Index2];
EquipmentAtt["Ani_" + Job].layer_variation <- [];
while (true) {
try {
local Ret = Rindro_Script.UnpackData(IO, i);
i += 5;
if (Ret == "[animation job]" || (Rindro_Script.endswith(Ret, "]") && Ret != "[equipment ani script]" && Ret != "[layer variation]")) {
i -= 5;
break;
} else if (Ret == "[layer variation]") {
local InfoBuf = {};
InfoBuf.Zorder <- Rindro_Script.UnpackData(IO, i).tointeger() - 9;
i += 5;
InfoBuf.Path <- Rindro_Script.UnpackData(IO, i);
i += 5;
EquipmentAtt["Ani_" + Job].layer_variation.append(InfoBuf);
}
} catch (exception) {
break;
}
}
}
} else break;
}
}
return EquipmentAtt;
}
function ReadAnimation(ReadObject) {
local Ro = Sq_Point2Blob(L_sq_P2I(ReadObject.Buffer.C_Object), ReadObject.Size);
Ro = BlobEx(Ro.readblob(Ro.len()));
local AniObject = {
Img_List = [],
Frame = [],
Flag = {}
};
local Frame_Max = Ro.readn('s');
local Img_Count = Ro.readn('s');
//Img的路径读取 存入数组
for (local index = 0; index< Img_Count; index++) {
local Buf = Ro.readn('i');
local ImgPath = Ro.GetString(Buf);
//有可能Img有空路径
AniObject.Img_List.append(ImgPath);
}
//Ani头部标签数量
local Ani_H_Item_Count = Ro.readn('s');
//处理标签
for (local index = 0; index< Ani_H_Item_Count; index++) {
//标签类型
local Type = Ro.readn('s');
switch (Type) {
case 0:
case 1: {
local Key = Rindro_Script.Get_Ani_Flag(Type);
local Value = Ro.readn('c');
AniObject.Flag.rawset(Key, Value);
break;
}
case 3:
case 28: {
local Key = Rindro_Script.Get_Ani_Flag(Type);
local Value = Ro.readn('s');
AniObject.Flag.rawset(Key, Value);
break;
}
case 18:
// print("残影解析");
//此处无解析 暂时先保证运行 残影功能暂时用不上
Ro.readn('c');
Ro.readn('i');
Ro.readn('i');
Ro.readn('i');
Ro.Get256();
Ro.Get256();
Ro.Get256();
Ro.Get256();
Ro.readn('s');
break;
default:
break;
}
}
//读取每一个Img
for (local index = 0; index< Frame_Max; index++) {
//帧结构体对象
local FrameObject = {
AttackBox = [],
DamageBox = [],
Flag = {},
};
//碰撞框项目数量
local Ani_Box_Item_Count = Ro.readn('s');
for (local _i = 0; _i< Ani_Box_Item_Count; _i++) {
local Box_Type = Ro.readn('s');
local D_Box_b = [];
for (local _k = 0; _k< 6; _k++) {
D_Box_b.append(Ro.readn('i'));
}
if (Box_Type == 15) {
FrameObject.AttackBox.append(D_Box_b);
} else {
FrameObject.DamageBox.append(D_Box_b);
}
// //0是攻击框 1是受击框
// FrameObject.Box.rawset(15 - Box_Type, D_Box_b);
}
//调用的第几个Img
local Index_Buf = Ro.GetShort();
//如果等于-1说明是img路径为空
if (Index_Buf != 65535) {
FrameObject.Img_Path <- AniObject.Img_List[Index_Buf].tolower();
//Img中的PNG下标
FrameObject.Img_Index <- Ro.readn('s');
} else {
FrameObject.Img_Path <- "";
FrameObject.Img_Index <- 0;
}
//坐标
FrameObject.Pos <- {
x = Ro.readn('i'),
y = Ro.readn('i'),
};
//Img中的项目数量
local Img_Flag_Count = Ro.readn('s');
for (local _o = 0; _o< Img_Flag_Count; _o++) {
local Img_Flag_Type = Ro.readn('s');
local Key;
local Value;
switch (Img_Flag_Type) {
case 0:
case 1:
case 10:
Key = Rindro_Script.Get_Ani_Flag(Img_Flag_Type);
Value = Ro.readn('c');
FrameObject.Flag.rawset(Key, Value);
break;
case 3:
Key = "COORD";
Value = Ro.readn('s');
FrameObject.Flag.rawset(Key, Value);
break;
case 17:
Key = "PRELOAD";
Value = 1;
FrameObject.Flag.rawset(Key, Value);
break;
case 7:
Key = "IMAGE_RATE";
Value = {
x = Ro.GetFloat(),
y = Ro.GetFloat()
};
FrameObject.Flag.rawset(Key, Value);
break;
case 8:
Key = "IMAGE_ROTATE";
Value = Ro.GetFloat();
FrameObject.Flag.rawset(Key, Value);
break;
case 9:
Key = "RGBA";
Value = [
Ro.Get256(),
Ro.Get256(),
Ro.Get256(),
Ro.Get256(),
];
FrameObject.Flag.rawset(Key, Value);
break;
case 11:
local Effect_Type = Ro.readn('s');
Key = "GRAPHIC_EFFECT_" + Rindro_Script.Get_Ani_Effect_Type(Effect_Type);
switch (Effect_Type) {
case 5:
Value = [Ro.Get256(), Ro.Get256(), Ro.Get256()];
break;
case 6:
Value = [Ro.GetShort(), Ro.GetShort()];
break;
}
FrameObject.Flag.rawset(Key, Value);
break;
case 12:
Value = Ro.readn('i');
FrameObject.Delay <- Value;
break;
case 13:
Key = "DAMAGE_TYPE";
Value = Rindro_Script.Get_Ani_Damage_Type(Ro.readn('s'));
FrameObject.Flag.rawset(Key, Value);
break;
case 16:
local SoundTempSize = Ro.readn('i');
Key = "PLAY_SOUND";
Value = Ro.GetString(SoundTempSize);
FrameObject.Flag.rawset(Key, Value);
break;
case 23:
Key = "SET_FLAG";
Value = Ro.readn('i');
FrameObject.Flag.rawset(Key, Value);
break;
case 24:
Key = "FLIP_TYPE";
Value = Rindro_Script.Get_Ani_Flip_Type(Ro.readn('s'));
FrameObject.Flag.rawset(Key, Value);
break;
case 25:
Key = "LOOP_START";
FrameObject.Flag.rawset(Key, 1);
break;
case 26:
Key = "LOOP_END";
Value = Ro.readn('i');
FrameObject.Flag.rawset(Key, Value);
break;
case 27:
Key = "CLIP";
Value = [
Ro.GetShort(),
Ro.GetShort(),
Ro.GetShort(),
Ro.GetShort(),
];
FrameObject.Flag.rawset(Key, Value);
break;
default:
break;
}
}
//每一帧都是一个结构体 存入数组中
AniObject.Frame.append(FrameObject);
}
return AniObject;
}
}
Rindro_Script.GetBin();
Rindro_Script.InitLoad_String();

View File

@@ -399,12 +399,37 @@ class ItemInfoClass {
// L_Sq_CallFunc(0xF3B3B0, "int", FFI_THISCALL, ["int", "int", "int", "int", "int"], Ret, 600, 200, 28, 28);
// Rindro_Haker.LoadHook(0x11BD160, ["int", "int", "bool"],
// Rindro_Haker.LoadHook(0x8265A0, ["int", "int", "int", "void"],
// function(args) {
// args[0] = -1;
// // print(args[0]);
// return args;
// // print(args[1]);
// print(format("%02x", args[0]));
// // print(args[0]);
// return null;
// },
// function(args) {
// // print(args.pop());
// // print(">>>>>>");
// return null;
// });
// Rindro_Haker.LoadHook(0x7B64BA, ["int", "int", "int", "int", "int", "int", "char"],
// function(args) {
// // print("args[0] : " + args[0]);
// // print("args[1] : " + format("%02x", args[1]));
// // print("args[2] : " + format("%02x", args[2]));
// // print("args[3] : " + args[3]);
// // print("args[4] : " + args[4]);
// // print("args[5] : " + args[5]);
// // print(args[1]);
// // print(args[2]);
// // print(args[0]);
// return null;
// },
// function(args) {
// // print(args.pop());