最新同步版本 添加了很多json和csbase已经user文件夹
This commit is contained in:
parent
8459054b08
commit
6e0cf5f121
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
文件名:DrawHudMain.nut
|
||||||
|
路径:Base/CallBack/DrawHudMain.nut
|
||||||
|
创建日期:2024-08-29 09:39
|
||||||
|
文件用途:
|
||||||
|
*/
|
||||||
|
//血槽背景
|
||||||
|
function L_HUD_BloodBackground() {
|
||||||
|
local RootTab = getroottable();
|
||||||
|
local obj = sq_getMyCharacter();
|
||||||
|
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 <- {};
|
||||||
|
|
||||||
|
//城镇摄像机
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function Sq_DrawChannel() {
|
||||||
|
// L_sq_DrawImg("interface2/cs_shop/cs_packageevent/2021_summer/hearoursummer_calendarui.img", 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,231 @@
|
||||||
|
/*
|
||||||
|
文件名:DrawMain.nut
|
||||||
|
路径:Base/CallBack/DrawMain.nut
|
||||||
|
创建日期:2024-08-06 18:58
|
||||||
|
文件用途:绘制回调
|
||||||
|
*/
|
||||||
|
//在DrawMain后面调用
|
||||||
|
function L_drawMainCustomUI_All() {
|
||||||
|
|
||||||
|
local obj = sq_getMyCharacter();
|
||||||
|
if (!obj) return;
|
||||||
|
|
||||||
|
local RootTab = getroottable();
|
||||||
|
|
||||||
|
//获取与上一帧的dt
|
||||||
|
if (!(RootTab.rawin("Rindro_DurationFlag"))) {
|
||||||
|
Rindro_DurationFlag <- L_Getmicroseconds();
|
||||||
|
Rindro_Duration <- 0;
|
||||||
|
} else {
|
||||||
|
local NowM = L_Getmicroseconds();
|
||||||
|
Rindro_Duration = (NowM - Rindro_DurationFlag);
|
||||||
|
Rindro_DurationFlag = NowM;
|
||||||
|
}
|
||||||
|
|
||||||
|
//下帧执行任务事件
|
||||||
|
if (RootTab.rawin("LenheartNextFrameFuncTab")) {
|
||||||
|
foreach(Func in RootTab["LenheartNextFrameFuncTab"]) {
|
||||||
|
Func();
|
||||||
|
}
|
||||||
|
RootTab["LenheartNextFrameFuncTab"] = [];
|
||||||
|
} else {
|
||||||
|
RootTab.LenheartNextFrameFuncTab <- [];
|
||||||
|
}
|
||||||
|
|
||||||
|
//重载逻辑
|
||||||
|
Sq_ReloadLogic();
|
||||||
|
|
||||||
|
//初始化活动图标
|
||||||
|
Lenheart_EventList_Fun(obj);
|
||||||
|
|
||||||
|
//加载注册Base函数窗口
|
||||||
|
if (RootTab.rawin("LenheartBaseFuncTab")) {
|
||||||
|
local LenheartFunc = RootTab["LenheartBaseFuncTab"];
|
||||||
|
foreach(Func in LenheartFunc) {
|
||||||
|
Func(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//加载注册Ex函数窗口
|
||||||
|
if (RootTab.rawin("LenheartFuncTab")) {
|
||||||
|
local LenheartFunc = RootTab["LenheartFuncTab"];
|
||||||
|
foreach(name,Func in LenheartFunc) {
|
||||||
|
|
||||||
|
if(name = "GetDamageRateFuncN"){
|
||||||
|
print(name);
|
||||||
|
Func(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//所有插件初始化完毕
|
||||||
|
if (!getroottable().rawin("LenheartPluginsInitFlag")) {
|
||||||
|
local T = {
|
||||||
|
op = 25001021,
|
||||||
|
}
|
||||||
|
Rindro_BaseToolClass.SendPackEx(T);
|
||||||
|
getroottable().LenheartPluginsInitFlag <- true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for (local i = 0; i< 100; i++) {
|
||||||
|
// for (local z = 0; z < 100; z++) {
|
||||||
|
// sq_PutPixel(sq_RGBA(230, 200, 155, 255), 200 + i, 200 + z);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// sq_DrawBox(100, 100, 100, 100, 0xffffffff);
|
||||||
|
|
||||||
|
|
||||||
|
// L_Sq_CallFunc(0x11E86C0, "char", FFI_STDCALL, ["int", "int", "int", "int", "int"], 10, 10, 750, 350, 0xffffffff);
|
||||||
|
|
||||||
|
// for (local i = 0; i< 100; i++) {
|
||||||
|
// for (local z = 0; z< 100; z++) {
|
||||||
|
// sq_PutPixel(sq_RGBA(230, 200, 155, 255), 200 + i, 200 + z);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// L_sq_Test(0x11A7B65);
|
||||||
|
// local Device = NativePointer(0x1B45AB8).readInt();
|
||||||
|
// print(format("Device:0x%02x", Device));
|
||||||
|
// L_sq_Test(Device);
|
||||||
|
|
||||||
|
// if (!TTTAAA) TTTAAA = Rindro_Draw_Character(0, [601590000, 1751501, 601500069], "rest.ani", null);
|
||||||
|
// if (TTTAAA) TTTAAA.Draw(120, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// for (local i = 0; i < 42; i++) {
|
||||||
|
// local Value = MemoryTool.DecodeMemoryData(0x394e8c00+0x1050 + (i * 4));
|
||||||
|
// if(Value == 151)print("Value :" + i * 4);
|
||||||
|
// }
|
||||||
|
// print(MemoryTool.DecodeMemoryData(0x1DFFB240));
|
||||||
|
// MemoryTool.EncodeMemoryData(0x304bdc00+0x1054,7);
|
||||||
|
// TTTAAA <- null;
|
||||||
|
|
||||||
|
// L_NewWindows("Lenheart", 56, 0x1);
|
||||||
|
// L_Sq_CallFunc(0xE6E070, "int", FFI_THISCALL, ["int", "int", "int", "int"], 0x01ADE090, 56, 0, 0);
|
||||||
|
// getroottable().Lsnzz <- Clock();
|
||||||
|
|
||||||
|
// dofile("sqr/Base/_Tool/Json.nut");
|
||||||
|
|
||||||
|
// print(T);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Register_DPS_Pack(1, function(Jso) {
|
||||||
|
// printT(Jso);
|
||||||
|
// });
|
||||||
|
|
||||||
|
// for (local i = 0; i< 50; i++) {
|
||||||
|
// local asos = sq_CreateCharacter(0,0);
|
||||||
|
// // asos.setValid(false);
|
||||||
|
// // local obj = sq_GetCNRDObjectToActiveObject(asos);
|
||||||
|
// // sq_SendDestroyPacketPassiveObject(obj);
|
||||||
|
// // sendDestroyPacket(obj);
|
||||||
|
|
||||||
|
// // sq_SendDestroyPacketPassiveObject(asos);
|
||||||
|
|
||||||
|
// // sq_AddObject(sq_getMyCharacter(), asos, OBJECTTYPE_VIRTUALCHARACTER, false);
|
||||||
|
// // asos.setValid(false);
|
||||||
|
// // L_sq_Test(L_Sq_GetObjectAddress(asos));
|
||||||
|
// L_Sq_CallFunc(0x5A44B0, "void", FFI_MS_CDECL, ["int"], L_Sq_GetObjectAddress(asos));
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// local asos = sq_CreateAICharacter(900);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// // sq_DeleteParticleCreater(asos);
|
||||||
|
// local asos = sq_CreateAICharacter(419);
|
||||||
|
// asos.setCurrentPos(sq_getMyCharacter().getXPos() + 100, sq_getMyCharacter().getYPos(), 0);
|
||||||
|
// sq_AddObject(sq_getMyCharacter(), asos, OBJECTTYPE_VIRTUALCHARACTER, false);
|
||||||
|
// sq_ChangeDrawLayer(asos, ENUM_DRAWLAYER_CLOSEBACK);
|
||||||
|
|
||||||
|
|
||||||
|
// L_sq_GoDungeon(1504);
|
||||||
|
|
||||||
|
// CargoType <- 0;
|
||||||
|
// Sq_GetExeStr_Map[21910] <- function(Index) {
|
||||||
|
// CargoType = 0;
|
||||||
|
// return 21910;
|
||||||
|
// }
|
||||||
|
// Sq_GetExeStr_Map[21911] <- function(Index) {
|
||||||
|
// CargoType = 1;
|
||||||
|
// return 21911;
|
||||||
|
// }
|
||||||
|
// Rindro_Haker.LoadHook(0xE67800, ["int", "int"],
|
||||||
|
// function(args) {
|
||||||
|
// //点击了仓库转移物品
|
||||||
|
// if (args[0] == 0x2B) {
|
||||||
|
// if (CargoType == 0) {
|
||||||
|
// printf("点击个人仓库转移物品");
|
||||||
|
// local T = {
|
||||||
|
// op = 21091001,
|
||||||
|
// type = 0,
|
||||||
|
// }
|
||||||
|
// Rindro_BaseToolClass.SendPackEx(T);
|
||||||
|
// return [0];
|
||||||
|
// }
|
||||||
|
// if (CargoType == 1) {
|
||||||
|
// printf("点击账号仓库转移物品");
|
||||||
|
// local T = {
|
||||||
|
// op = 21091001,
|
||||||
|
// type = 1,
|
||||||
|
// }
|
||||||
|
// Rindro_BaseToolClass.SendPackEx(T);
|
||||||
|
// return [0];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// },
|
||||||
|
// function(args) {
|
||||||
|
// // print(666);
|
||||||
|
// // print(format("%02x", args.pop()));
|
||||||
|
// // TTTAni <- args.pop();
|
||||||
|
// return null;
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// function onAttack_Swordman(obj, damager, boundingBox, isStuck)
|
||||||
|
// {
|
||||||
|
// local Mon = sq_GetCNRDObjectToActiveObject(damager);
|
||||||
|
// Mon.setHp(0, null, true);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// function getCurrentModuleDamageRate(obj) {
|
||||||
|
// local LLJob = sq_getJob(obj);
|
||||||
|
// local LLGrowT = sq_getGrowType(obj);
|
||||||
|
// if (LLJob == 0 && LLGrowT == 2)
|
||||||
|
// return 2100000000.0;
|
||||||
|
|
||||||
|
// return 1.0;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// function onStartDungeon_Swordman(obj) {
|
||||||
|
// print(666);
|
||||||
|
// obj.setEnableDamageBox(false);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// local chrobj = sq_CreateCharacter(0, 4);
|
||||||
|
|
||||||
|
// print("-----------------------------------------------/");
|
||||||
|
// foreach(member, val in chrobj.getclass()) {
|
||||||
|
// ::print(member + "\n");
|
||||||
|
// local attr;
|
||||||
|
// if ((attr = chrobj.getclass().getattributes(member)) != null) {
|
||||||
|
// foreach(i, v in attr) {
|
||||||
|
// ::print("\t" + i + " = " + (typeof v) + "\n");
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// ::print("\t<no attributes>\n")
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
文件名:GetDamageRate.nut
|
||||||
|
路径:Base/CallBack/GetDamageRate.nut
|
||||||
|
创建日期:2024-08-09 14:10
|
||||||
|
文件用途:获取伤害倍率
|
||||||
|
*/
|
||||||
|
RindroDamageRate <- 1.0;
|
||||||
|
|
||||||
|
function L_getCurrentModuleDamageRate(obj) {
|
||||||
|
if (!obj)
|
||||||
|
return 1.0;
|
||||||
|
|
||||||
|
local ClientRat = 1.0;
|
||||||
|
try {
|
||||||
|
ClientRat = getCurrentModuleDamageRate(obj).tofloat();
|
||||||
|
} catch (exception) {
|
||||||
|
ClientRat = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
// ModuleDamageTable <- {
|
||||||
|
// //这个1是 副本编号
|
||||||
|
// [1] = {
|
||||||
|
// //这个0是大职业编号 比如说鬼剑士就是 0 女格斗家就是 1 在character/character.lst 这个文件里可以看
|
||||||
|
// [0] = {
|
||||||
|
// //这个0 和 1 是转职编号 0就是未转职 1 就是转了剑魂
|
||||||
|
// [0] = 1.0,
|
||||||
|
// [1] = 3.0
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// //2号副本
|
||||||
|
// [2] ={
|
||||||
|
// //女格斗家职业
|
||||||
|
// [1] = {
|
||||||
|
// [0] = 1.0,
|
||||||
|
// [1] = 3.0
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// function getCurrentModuleDamageRate(obj)
|
||||||
|
// {
|
||||||
|
// local Rate = 1.0;
|
||||||
|
// local stage = sq_GetGlobaludpModuleStage();
|
||||||
|
// local dungeon = sq_GetDungeonByStage(stage);
|
||||||
|
// local dungeonIndex = sq_GetDuegonIndex(dungeon);
|
||||||
|
|
||||||
|
// local LLJob = sq_getJob(obj);
|
||||||
|
// local LLGrowT = sq_getGrowType(obj);
|
||||||
|
|
||||||
|
// //处于生效副本中
|
||||||
|
// if(ModuleDamageTable.rawin(dungeonIndex)){
|
||||||
|
// //自己是生效职业
|
||||||
|
// if(ModuleDamageTable[dungeonIndex].rawin(LLJob)){
|
||||||
|
// //是生效转职
|
||||||
|
// if(ModuleDamageTable[dungeonIndex][LLJob].rawin(LLGrowT)){
|
||||||
|
// Rate += ModuleDamageTable[dungeonIndex][LLJob][LLGrowT].tofloat();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return Rate;
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,183 @@
|
||||||
|
/*
|
||||||
|
文件名:PackControl.nut
|
||||||
|
路径:Base/PackControl/PackControl.nut
|
||||||
|
创建日期:2024-08-06 22:13
|
||||||
|
文件用途:
|
||||||
|
*/
|
||||||
|
Pack_Control <- {}
|
||||||
|
Pack_Hex_Control <- {}
|
||||||
|
Pack_DPS_Control <- {}
|
||||||
|
|
||||||
|
function Register_DPS_Pack(Id, Func) {
|
||||||
|
Pack_DPS_Control.rawset(Id, Func);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Sq_Pack_Control(Chunk) {
|
||||||
|
try {
|
||||||
|
local Pack_Json = Json.Decode(Chunk);
|
||||||
|
if (Pack_Json.op == 2147483646) {
|
||||||
|
if (Pack_DPS_Control.rawin(Pack_Json.dps_id)) {
|
||||||
|
local Jso = Json.Decode(Chunk);
|
||||||
|
Jso.rawdelete("op");
|
||||||
|
Pack_DPS_Control[Pack_Json.dps_id](Jso);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Pack_Control.rawin(Pack_Json.op)) {
|
||||||
|
try {
|
||||||
|
Pack_Control[Pack_Json.op](Chunk);
|
||||||
|
} catch (exception) {
|
||||||
|
print("error pack: " + Pack_Json.op);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (exception) {
|
||||||
|
// print("error packmsg: " + Pack_Json.op);
|
||||||
|
print(exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function Sq_Pack_ControlLocal(Chunk) {
|
||||||
|
local Pack_Json = Json.Decode(Chunk);
|
||||||
|
if (Pack_Json.op == 2147483646) {
|
||||||
|
if (Pack_DPS_Control.rawin(Pack_Json.dps_id)) {
|
||||||
|
local Jso = Json.Decode(Chunk);
|
||||||
|
Jso.rawdelete("op");
|
||||||
|
Pack_DPS_Control[Pack_Json.dps_id](Jso);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Pack_Control.rawin(Pack_Json.op)) {
|
||||||
|
Pack_Control[Pack_Json.op](Chunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//字节流包
|
||||||
|
function Sq_BlobPack_Control(Size, Pointer) {
|
||||||
|
local Pack = Packet();
|
||||||
|
Pack.Load(Pointer, Size);
|
||||||
|
local Op = Pack.GetInt();
|
||||||
|
//读取位置回到原点
|
||||||
|
// Pack.Seek(0);
|
||||||
|
|
||||||
|
if (Pack_Hex_Control.rawin(Op)) {
|
||||||
|
Pack_Hex_Control[Op](Pack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function SendPackToDP_S(Id, T) {
|
||||||
|
T.op <- 2147483646;
|
||||||
|
T.dps_id <- Id;
|
||||||
|
Rindro_BaseToolClass.SendPackEx(T);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//进入副本回调
|
||||||
|
function LenheartGotoDgnCallBack(Chunk) {
|
||||||
|
local Jso = Json.Decode(Chunk);
|
||||||
|
local DgnId = Jso.map.id;
|
||||||
|
local DgnRate = Jso.map.ra;
|
||||||
|
L_sq_GoDungeon(DgnId);
|
||||||
|
}
|
||||||
|
Pack_Control.rawset(2024041602, LenheartGotoDgnCallBack);
|
||||||
|
|
||||||
|
|
||||||
|
//进入副本增加属性
|
||||||
|
function LenheartAdditionalAttributes(obj) {
|
||||||
|
obj = sq_ObjectToSQRCharacter(obj);
|
||||||
|
//在副本中
|
||||||
|
if (sq_GetCurrentModuleType() == 3) {
|
||||||
|
if (!CNSquirrelAppendage.sq_IsAppendAppendage(obj, "appendage/lenheartap.nut")) {
|
||||||
|
if ("LenheartAttributesTable" in getroottable()) {
|
||||||
|
local Abarr = {};
|
||||||
|
foreach(AtObj in getroottable()["LenheartAttributesTable"]) {
|
||||||
|
foreach(Apos, At in AtObj) {
|
||||||
|
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) {
|
||||||
|
change_appendage = appendage.sq_AddChangeStatusAppendageID(obj, obj, 0,
|
||||||
|
CHANGE_STATUS_TYPE_COOLTIME_DECLINE,
|
||||||
|
false, 0, 115514);
|
||||||
|
}
|
||||||
|
if (change_appendage) {
|
||||||
|
change_appendage.clearParameter();
|
||||||
|
|
||||||
|
foreach(Key, Value in Abarr) {
|
||||||
|
if (Key == 0) change_appendage.addParameter(13, false, Value.tofloat()); //HP
|
||||||
|
else if (Key == 1) change_appendage.addParameter(48, false, Value.tofloat()); //MP
|
||||||
|
else if (Key == "strength") change_appendage.addParameter(0, false, Value.tofloat()); //力量
|
||||||
|
else if (Key == "intelligence") change_appendage.addParameter(1, false, Value.tofloat()); //智力
|
||||||
|
else if (Key == "vitality") change_appendage.addParameter(2, false, Value.tofloat()); //体力
|
||||||
|
else if (Key == "spirit") change_appendage.addParameter(3, false, Value.tofloat()); //精神
|
||||||
|
else if (Key == "physicalAttack") change_appendage.addParameter(4, false, Value.tofloat()); //物攻
|
||||||
|
else if (Key == "magicAttack") change_appendage.addParameter(31, false, Value.tofloat()); //魔攻
|
||||||
|
else if (Key == "independentAttack") {
|
||||||
|
change_appendage.addParameter(53, false, Value.tofloat()); //独立
|
||||||
|
change_appendage.addParameter(54, false, Value.tofloat()); //独立
|
||||||
|
} else if (Key == "physicalDefense") change_appendage.addParameter(5, false, Value.tofloat()); //物理防御
|
||||||
|
else if (Key == "magicDefense") change_appendage.addParameter(32, false, Value.tofloat()); //魔法防御
|
||||||
|
else if (Key == "physicalCritical") change_appendage.addParameter(15, false, Value.tofloat() / 10.0); //物理暴击
|
||||||
|
else if (Key == "magicCritical") change_appendage.addParameter(16, false, Value.tofloat() / 10.0); //魔法暴击
|
||||||
|
else if (Key == "attackSpeed") change_appendage.addParameter(10, false, Value.tofloat()); //攻速
|
||||||
|
else if (Key == "releaseSpeed") change_appendage.addParameter(12, false, Value.tofloat()); //释放
|
||||||
|
else if (Key == "moveSpeed") change_appendage.addParameter(11, false, Value.tofloat()); //移速
|
||||||
|
else if (Key == "resistance") change_appendage.addParameter(39, false, Value.tofloat()); //抗磨
|
||||||
|
else if (Key == "hitRate") change_appendage.addParameter(33, false, Value.tofloat()); //命中
|
||||||
|
else if (Key == "avoidance") change_appendage.addParameter(27, false, Value.tofloat()); //闪避
|
||||||
|
else if (Key == "hpRecovery") change_appendage.addParameter(14, false, Value.tofloat()); //HP恢复
|
||||||
|
else if (Key == "mpRecovery") change_appendage.addParameter(29, false, Value.tofloat()); //MP恢复
|
||||||
|
else if (Key == "stun") change_appendage.addParameter(41, false, Value.tofloat()); //僵直
|
||||||
|
else if (Key == "hardStun") change_appendage.addParameter(34, false, Value.tofloat()); //硬直
|
||||||
|
else if (Key == "fire") change_appendage.addParameter(42, false, Value.tofloat()); //火强
|
||||||
|
else if (Key == "fireResistance") change_appendage.addParameter(20, false, Value.tofloat()); //火抗
|
||||||
|
else if (Key == "water") change_appendage.addParameter(43, false, Value.tofloat()); //冰强
|
||||||
|
else if (Key == "waterResistance") change_appendage.addParameter(21, false, Value.tofloat()); //冰抗
|
||||||
|
else if (Key == "light") change_appendage.addParameter(45, false, Value.tofloat()); //光强
|
||||||
|
else if (Key == "lightResistance") change_appendage.addParameter(23, false, Value.tofloat()); //光抗
|
||||||
|
else if (Key == "dark") change_appendage.addParameter(44, false, Value.tofloat()); //暗强
|
||||||
|
else if (Key == "darkResistance") change_appendage.addParameter(22, false, Value.tofloat()); //暗抗
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getroottable().rawin("LenheartFuncTab")) {
|
||||||
|
getroottable()["LenheartFuncTab"].rawset("LenheartAdditionalAttributesFunc", LenheartAdditionalAttributes);
|
||||||
|
} else {
|
||||||
|
local T = {};
|
||||||
|
T.rawset("LenheartAdditionalAttributesFunc", LenheartAdditionalAttributes);
|
||||||
|
getroottable().rawset("LenheartFuncTab", T);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//进入副本增加属性
|
||||||
|
function LenheartAdditionalCallBack(Chunk) {
|
||||||
|
local Jso = Json.Decode(Chunk);
|
||||||
|
if ("LenheartAttributesTable" in getroottable()) {
|
||||||
|
local T = getroottable()["LenheartAttributesTable"];
|
||||||
|
T.rawset("LenheartCollectBoxAb", Jso.Attribute);
|
||||||
|
} else {
|
||||||
|
local T = {};
|
||||||
|
T.rawset("LenheartCollectBoxAb", Jso.Attribute);
|
||||||
|
getroottable().rawset("LenheartAttributesTable", T);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Pack_Control.rawset(20069016, LenheartAdditionalCallBack);
|
||||||
|
|
||||||
|
|
||||||
|
getroottable().PluginsCompatibilityModeCallBack <- false;
|
||||||
|
//兼容模式
|
||||||
|
function CompatibilityModeCallBack(Chunk) {
|
||||||
|
getroottable().PluginsCompatibilityModeCallBack <- true;
|
||||||
|
}
|
||||||
|
Pack_Control.rawset(30004, CompatibilityModeCallBack);
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
文件名:PushDamage.nut
|
||||||
|
路径:Base/CallBack/PushDamage.nut
|
||||||
|
创建日期:2024-08-30 14:41
|
||||||
|
文件用途:发生伤害时
|
||||||
|
*/
|
||||||
|
PushDamageFontDataFuncTab <- {};
|
||||||
|
PushDamageFontFuncTab <- {};
|
||||||
|
|
||||||
|
function Sq_PushDamageData(ObjAddress, MySelfAddress, Value) {
|
||||||
|
// print("MyCharacter: " + format("%02x", L_sq_RA(0x1AB7CDC)));
|
||||||
|
// print("ObjAddress: " + format("%02x", ObjAddress));
|
||||||
|
// print("A1: " + format("%02x", A1));
|
||||||
|
// print("A2: " + format("%02x", A2));
|
||||||
|
// print(" ");
|
||||||
|
foreach(Func in PushDamageFontFuncTab) {
|
||||||
|
Func(ObjAddress, MySelfAddress, Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Sq_PushDamageFontData(ObjAddress, X, Y, Z, Value, Type, A1, A2) {
|
||||||
|
|
||||||
|
local Flag = true;
|
||||||
|
foreach(Func in PushDamageFontDataFuncTab) {
|
||||||
|
local Ret = Func(ObjAddress, X, Y, Z, Value, Type, A1, A2);
|
||||||
|
if (Ret == false) {
|
||||||
|
Flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Flag;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
文件名:Interface.nut
|
||||||
|
路径:Base/Interface.nut
|
||||||
|
创建日期:2025-05-01 07:39
|
||||||
|
文件用途:所有基础文件加载以后 将会执行的逻辑 用于初始化一些接口和默认设置
|
||||||
|
*/
|
||||||
|
|
||||||
|
//消息框黏贴
|
||||||
|
NativePointer(0x011C53B0).writeShort(0x1B0);
|
||||||
|
|
||||||
|
//修复233号弹窗
|
||||||
|
NativePointer(0x00727017).writeByteArray([0xEB, 0x11, 0x90, 0x90, 0x90, 0x90, 0x90]);
|
||||||
|
|
||||||
|
//反遍历函数
|
||||||
|
NativePointer(0x1370FD7).writeInt(0);
|
||||||
|
|
||||||
|
//全局的道具信息
|
||||||
|
if (!getroottable().rawin("Rindro_ItemInfoObject")) Rindro_ItemInfoObject <- {};
|
||||||
|
|
||||||
|
//开启热重载目录
|
||||||
|
if(getroottable().rawin("RINDROLOCAL") && RINDROLOCAL == true)Sq_AutoReload("sqr");
|
||||||
|
|
||||||
|
|
||||||
|
print("cs base ");
|
||||||
|
print("cs base ");
|
||||||
|
print("cs base ");
|
||||||
|
print("cs base ");
|
||||||
|
print("cs base ");
|
||||||
|
print("cs base ");
|
||||||
|
print("cs base ");
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
/*
|
||||||
|
文件名:Lenheart_Ani_Class.nut
|
||||||
|
路径:Base/UI/Lenheart_Ani_Class.nut
|
||||||
|
创建日期:2024-08-06 18:56
|
||||||
|
文件用途:Ani
|
||||||
|
*/
|
||||||
|
class Lenheart_Ani {
|
||||||
|
|
||||||
|
X = 0;
|
||||||
|
Y = 0;
|
||||||
|
|
||||||
|
ImgPath = null;
|
||||||
|
ImgFrame = null;
|
||||||
|
|
||||||
|
|
||||||
|
//播放状态
|
||||||
|
State = 0;
|
||||||
|
//循环
|
||||||
|
LoopFlag = true;
|
||||||
|
|
||||||
|
//当前帧数
|
||||||
|
CurFrame = 0;
|
||||||
|
//初始化时间
|
||||||
|
InitTime = 0;
|
||||||
|
//Ani当前帧播放时间
|
||||||
|
PlayCurTime = 0;
|
||||||
|
|
||||||
|
|
||||||
|
//img 路径 调用帧数组
|
||||||
|
constructor(path, frame, Pos) {
|
||||||
|
ImgPath = ("Character/" + path + ".img").tolower();
|
||||||
|
ImgFrame = frame;
|
||||||
|
InitTime = Clock();
|
||||||
|
State = 1;
|
||||||
|
X = Pos[0];
|
||||||
|
Y = Pos[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function Show(dt) {
|
||||||
|
if (State == 1) {
|
||||||
|
if (ImgFrame) {
|
||||||
|
local NowFrameObj = ImgFrame[CurFrame];
|
||||||
|
PlayCurTime += dt;
|
||||||
|
L_sq_DrawImg(ImgPath, NowFrameObj.ImgIndex, NowFrameObj.Pos[0] + X, NowFrameObj.Pos[1] + Y);
|
||||||
|
if (PlayCurTime >= NowFrameObj.Delay) {
|
||||||
|
CurFrame++;
|
||||||
|
//播放完成
|
||||||
|
if (CurFrame >= ImgFrame.len()) {
|
||||||
|
if (LoopFlag) CurFrame = 0;
|
||||||
|
else State = 0;
|
||||||
|
}
|
||||||
|
InitTime = Clock();
|
||||||
|
PlayCurTime = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShowEx(dt,gRgba,rate_x,rate_y) {
|
||||||
|
if (State == 1) {
|
||||||
|
if (ImgFrame) {
|
||||||
|
local NowFrameObj = ImgFrame[CurFrame];
|
||||||
|
PlayCurTime += dt;
|
||||||
|
L_sq_DrawImg(ImgPath, NowFrameObj.ImgIndex, NowFrameObj.Pos[0] + X, NowFrameObj.Pos[1] + Y,1,gRgba,rate_x,rate_y);
|
||||||
|
if (PlayCurTime >= NowFrameObj.Delay) {
|
||||||
|
CurFrame++;
|
||||||
|
//播放完成
|
||||||
|
if (CurFrame >= ImgFrame.len()) {
|
||||||
|
if (LoopFlag) CurFrame = 0;
|
||||||
|
else State = 0;
|
||||||
|
}
|
||||||
|
InitTime = Clock();
|
||||||
|
PlayCurTime = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Reset()
|
||||||
|
{
|
||||||
|
CurFrame = 0;
|
||||||
|
State = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,512 @@
|
||||||
|
/*
|
||||||
|
文件名:Lenheart_Character_Info_Class.nut
|
||||||
|
路径:Base/UI/Lenheart_Character_Info_Class.nut
|
||||||
|
创建日期:2024-08-27 12:13
|
||||||
|
文件用途:个人信息属性面板
|
||||||
|
*/
|
||||||
|
return;
|
||||||
|
class Lenheart_Character_Info_ClassC extends LenheartNewUI_Windows {
|
||||||
|
//调试模式
|
||||||
|
// DeBugMode = true;
|
||||||
|
|
||||||
|
//不是窗口
|
||||||
|
NoWindow = true;
|
||||||
|
|
||||||
|
//是否可见
|
||||||
|
Visible = false;
|
||||||
|
|
||||||
|
//图标路径
|
||||||
|
IconPath = "interface2/profile/profile_icon1.img";
|
||||||
|
|
||||||
|
//我的信息
|
||||||
|
MyInfo = null;
|
||||||
|
|
||||||
|
//滚轮偏移值
|
||||||
|
YOffset = 0;
|
||||||
|
|
||||||
|
|
||||||
|
function My_GetCharacterInfoCallBack(Chunk) {
|
||||||
|
local Jso = Json.Decode(Chunk);
|
||||||
|
MyInfo = Jso.Attribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
//初始化
|
||||||
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||||
|
Childrens = [];
|
||||||
|
//注册控件
|
||||||
|
RegisterWidget();
|
||||||
|
|
||||||
|
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||||
|
Pack_Control.rawset(20069014, My_GetCharacterInfoCallBack.bindenv(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
function RegisterWidget() {
|
||||||
|
// //关闭按钮
|
||||||
|
// local CloseButton = LenheartNewUI_BaseButton(278, 0, 11, 12, "interface/lenheartwindowcommon.img", 276);
|
||||||
|
// CloseButton.OnClick = function() {
|
||||||
|
// this.Visible = false;
|
||||||
|
// }.bindenv(this);
|
||||||
|
// Childrens.append(CloseButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
//绘制主界面
|
||||||
|
function DrawMain(obj) {
|
||||||
|
DrawInfo(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
function CheckPosInDrawBox(PosY) {
|
||||||
|
if ((PosY + YOffset) >= 0 && (PosY + YOffset)< 144) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//绘制信息
|
||||||
|
function DrawInfo(obj) {
|
||||||
|
if (MyInfo) {
|
||||||
|
|
||||||
|
//生命魔法值
|
||||||
|
local PosOffset = 0;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 0, X + 4, Y + 3 + YOffset);
|
||||||
|
L_sq_DrawCode("HP", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local HpStr = MyInfo.CurHp.tostring() + "/" + MyInfo.MaxHp.tostring();
|
||||||
|
L_sq_DrawCode(HpStr, X + 128 - LenheartTextClass.GetStringLength(HpStr), Y + 4 + (0 * 18) + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1);
|
||||||
|
|
||||||
|
L_sq_DrawImg(IconPath, 1, X + 130, Y + 3 + YOffset);
|
||||||
|
L_sq_DrawCode("MP", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local HpStr = MyInfo.CurMp.tostring() + "/" + MyInfo.MaxMp.tostring();
|
||||||
|
L_sq_DrawCode(HpStr, X + 248 - LenheartTextClass.GetStringLength(HpStr), Y + 4 + (0 * 18) + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//力量智力
|
||||||
|
PosOffset += 18;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 2, X + 4, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("力量", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str = MyInfo.Strength.tostring();
|
||||||
|
L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1);
|
||||||
|
|
||||||
|
L_sq_DrawImg(IconPath, 3, X + 130, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("智力", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str2 = MyInfo.Intellect.tostring();
|
||||||
|
L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//体力精神
|
||||||
|
PosOffset += 18;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 4, X + 4, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("体力", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str = MyInfo.Vitality.tostring();
|
||||||
|
L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1);
|
||||||
|
|
||||||
|
L_sq_DrawImg(IconPath, 5, X + 130, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("精神", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str2 = MyInfo.Spirit.tostring();
|
||||||
|
L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//物理攻击魔法攻击
|
||||||
|
PosOffset += 18;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 6, X + 4, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("物理攻击", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str = MyInfo.PhysicalAttack.tostring();
|
||||||
|
L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1);
|
||||||
|
|
||||||
|
L_sq_DrawImg(IconPath, 7, X + 130, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("魔法攻击", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str2 = MyInfo.MagicalAttack.tostring();
|
||||||
|
L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//独立攻击力
|
||||||
|
PosOffset += 18;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 31, X + 4, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("独立攻击力(物理/魔法)", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str = MyInfo.IndependentAttack.tostring();
|
||||||
|
L_sq_DrawCode(Str, X + 248 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//物理防御魔法防御
|
||||||
|
PosOffset += 18;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 8, X + 4, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("物理防御", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str = MyInfo.PhysicalDefend.tostring();
|
||||||
|
L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1);
|
||||||
|
|
||||||
|
L_sq_DrawImg(IconPath, 9, X + 130, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("魔法防御", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str2 = MyInfo.MagicalDefend.tostring();
|
||||||
|
L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//物理暴击 魔法暴击
|
||||||
|
PosOffset += 18;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 10, X + 4, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("物理暴击", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str = format("%0.1f%%", MyInfo.PhysicalCrit);
|
||||||
|
L_sq_DrawCode(Str, X + 133 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
|
||||||
|
L_sq_DrawImg(IconPath, 11, X + 130, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("魔法暴击", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str2 = format("%0.1f%%", MyInfo.MagicalCrit);
|
||||||
|
L_sq_DrawCode(Str2, X + 253 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//攻击速度 释放速度
|
||||||
|
PosOffset += 18;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 12, X + 4, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("攻击速度", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str = format("%0.1f%%", MyInfo.AttackSpeed);
|
||||||
|
L_sq_DrawCode(Str, X + 133 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
|
||||||
|
L_sq_DrawImg(IconPath, 13, X + 130, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("释放速度", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str2 = format("%0.1f%%", MyInfo.ReleaseSpeed);
|
||||||
|
L_sq_DrawCode(Str2, X + 253 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//移动速度 抗魔
|
||||||
|
PosOffset += 18;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 14, X + 4, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("移动速度", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str = format("%0.1f%%", MyInfo.MoveSpeed);
|
||||||
|
L_sq_DrawCode(Str, X + 133 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
|
||||||
|
L_sq_DrawImg(IconPath, 15, X + 130, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("抗魔", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str2 = MyInfo.AntiMagic.tostring();
|
||||||
|
L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//命中率 回避率
|
||||||
|
PosOffset += 18;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 16, X + 4, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("命中率", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str = format("%0.1f%%", MyInfo.HitRate);
|
||||||
|
L_sq_DrawCode(Str, X + 133 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
|
||||||
|
L_sq_DrawImg(IconPath, 17, X + 130, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("回避率", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str2 = format("%0.1f%%", MyInfo.DodgeRate);
|
||||||
|
L_sq_DrawCode(Str2, X + 253 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//HP恢复量 MP恢复量
|
||||||
|
PosOffset += 18;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 18, X + 4, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("HP恢复量", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str = MyInfo.HPRecovery.tostring();
|
||||||
|
L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
|
||||||
|
L_sq_DrawImg(IconPath, 19, X + 130, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("MP恢复量", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str2 = MyInfo.MPRecovery.tostring();
|
||||||
|
L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//僵直度 硬直
|
||||||
|
PosOffset += 18;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 20, X + 4, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("僵直度", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str = MyInfo.StunRate.tostring();
|
||||||
|
L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
|
||||||
|
L_sq_DrawImg(IconPath, 21, X + 130, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("硬直", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str2 = MyInfo.StunResist.tostring();
|
||||||
|
L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//火属性强化 火属性抗性
|
||||||
|
PosOffset += 18;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 22, X + 4, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("火属性强化", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str = MyInfo.FireStrength.tostring();
|
||||||
|
L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
|
||||||
|
L_sq_DrawImg(IconPath, 23, X + 130, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("火属性抗性", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str2 = MyInfo.FireResist.tostring();
|
||||||
|
L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//冰属性强化 冰属性抗性
|
||||||
|
PosOffset += 18;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 24, X + 4, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("冰属性强化", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str = MyInfo.IceStrength.tostring();
|
||||||
|
L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
|
||||||
|
L_sq_DrawImg(IconPath, 25, X + 130, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("冰属性抗性", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str2 = MyInfo.IceResist.tostring();
|
||||||
|
L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//光属性强化 光属性抗性
|
||||||
|
PosOffset += 18;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 26, X + 4, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("光属性强化", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str = MyInfo.LightStrength.tostring();
|
||||||
|
L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
|
||||||
|
L_sq_DrawImg(IconPath, 27, X + 130, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("光属性抗性", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str2 = MyInfo.LightResist.tostring();
|
||||||
|
L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//暗属性强化 暗属性抗性
|
||||||
|
PosOffset += 18;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 28, X + 4, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("暗属性强化", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str = MyInfo.DarkStrength.tostring();
|
||||||
|
L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
|
||||||
|
L_sq_DrawImg(IconPath, 29, X + 130, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("暗属性抗性", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str2 = MyInfo.DarkResist.tostring();
|
||||||
|
L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//名望值 罪恶值
|
||||||
|
PosOffset += 18;
|
||||||
|
if (CheckPosInDrawBox(PosOffset)) {
|
||||||
|
L_sq_DrawImg(IconPath, 53, X + 4, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("名望值", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str = MyInfo.Fame.tostring();
|
||||||
|
L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
|
||||||
|
L_sq_DrawImg(IconPath, 45, X + 130, Y + 3 + PosOffset + YOffset);
|
||||||
|
L_sq_DrawCode("最终伤害", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
local Str2 = MyInfo.FinalDamage.tostring();
|
||||||
|
L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Show(obj) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function RealShow(obj) {
|
||||||
|
|
||||||
|
DrawMain(obj);
|
||||||
|
LenheartNewUI_Windows.Show(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
//override
|
||||||
|
//鼠标滚轮事件回调
|
||||||
|
function OnMouseWheel(Flag, MousePos_X, MousePos_Y) {
|
||||||
|
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) {
|
||||||
|
if (Flag) {
|
||||||
|
if (YOffset< 0) YOffset += 18;
|
||||||
|
}
|
||||||
|
if (!Flag) {
|
||||||
|
if (YOffset > (-145)) YOffset -= 18;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//调用原生方法
|
||||||
|
LenheartNewUI_Windows.OnMouseWheel(Flag, MousePos_X, MousePos_Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
GetMyInfoFlag = false;
|
||||||
|
|
||||||
|
//逻辑入口
|
||||||
|
function Proc(obj) {
|
||||||
|
Visible = false;
|
||||||
|
LenheartNewUI_Windows.SyncPos(X, Y);
|
||||||
|
|
||||||
|
local WindowX = sq_GetPopupWindowMainCotrol(74);
|
||||||
|
|
||||||
|
if (!WindowX) {
|
||||||
|
GetMyInfoFlag = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!WindowX) return;
|
||||||
|
|
||||||
|
if (!GetMyInfoFlag) {
|
||||||
|
GetMyInfoFlag = true;
|
||||||
|
local T = {
|
||||||
|
op = 20069013,
|
||||||
|
Info = Lenheart_Character_GetAttribute(null)
|
||||||
|
}
|
||||||
|
SendPackEx(T);
|
||||||
|
}
|
||||||
|
|
||||||
|
X = Base_X;
|
||||||
|
Y = Base_Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
Base_X = 0;
|
||||||
|
Base_Y = 0;
|
||||||
|
|
||||||
|
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) {
|
||||||
|
return false;
|
||||||
|
// //返回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");
|
||||||
|
|
||||||
|
function Lenheart_Character_Info_Class_Fun(obj) {
|
||||||
|
local RootTab = getroottable();
|
||||||
|
if (!RootTab.rawin("Lenheart_Character_Info_Class_Obj")) {
|
||||||
|
RootTab.rawset("Lenheart_Character_Info_Class_Obj", LenheartNewUI_CreateWindow(Lenheart_Character_Info_ClassC, "个人信息属性面板窗口", 0, 0, 263, 146, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getroottable()["LenheartFuncTab"].rawset("Lenheart_Character_Info_ClassFuncN", Lenheart_Character_Info_Class_Fun);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Lenheart_Other_Character_Info_ClassC extends Lenheart_Character_Info_ClassC {
|
||||||
|
//调试模式
|
||||||
|
// DeBugMode = true;
|
||||||
|
|
||||||
|
//不是窗口
|
||||||
|
NoWindow = true;
|
||||||
|
|
||||||
|
//是否可见
|
||||||
|
Visible = false;
|
||||||
|
|
||||||
|
//图标路径
|
||||||
|
IconPath = "interface2/profile/profile_icon1.img";
|
||||||
|
|
||||||
|
//我的信息
|
||||||
|
MyInfo = null;
|
||||||
|
|
||||||
|
//滚轮偏移值
|
||||||
|
YOffset = 0;
|
||||||
|
|
||||||
|
function Other_GetCharacterInfoCallBack(Chunk) {
|
||||||
|
local Jso = Json.Decode(Chunk);
|
||||||
|
MyInfo = Jso.Attribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||||
|
Childrens = [];
|
||||||
|
//注册控件
|
||||||
|
RegisterWidget();
|
||||||
|
|
||||||
|
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||||
|
Pack_Control.rawset(20069012, Other_GetCharacterInfoCallBack.bindenv(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
function RegisterWidget() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function Show(obj) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function DrawMain(obj) {
|
||||||
|
DrawInfo(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
function RealShow(obj) {
|
||||||
|
DrawMain(obj);
|
||||||
|
LenheartNewUI_Windows.Show(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//override
|
||||||
|
//鼠标滚轮事件回调
|
||||||
|
function OnMouseWheel(Flag, MousePos_X, MousePos_Y) {
|
||||||
|
|
||||||
|
if (Flag) {
|
||||||
|
if (YOffset< 0) YOffset += 18;
|
||||||
|
}
|
||||||
|
if (!Flag) {
|
||||||
|
if (YOffset > (-145)) YOffset -= 18;
|
||||||
|
}
|
||||||
|
|
||||||
|
//调用原生方法
|
||||||
|
LenheartNewUI_Windows.OnMouseWheel(Flag, MousePos_X, MousePos_Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
//逻辑入口
|
||||||
|
function Proc(obj) {
|
||||||
|
Visible = false;
|
||||||
|
LenheartNewUI_Windows.SyncPos(X, Y);
|
||||||
|
|
||||||
|
local WindowX = sq_GetPopupWindowMainCotrol(74);
|
||||||
|
if (!WindowX || !OldWindowAddress) return;
|
||||||
|
X = L_sq_RA(OldWindowAddress + 0x14);
|
||||||
|
Y = L_sq_RA(OldWindowAddress + 0x18) + 154;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
OldWindowAddress = null;
|
||||||
|
|
||||||
|
function SyncState(Address) {
|
||||||
|
OldWindowAddress = Address;
|
||||||
|
local obj = sq_getMyCharacter();
|
||||||
|
RealShow(obj);
|
||||||
|
Visible = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//他人信息窗口逻辑
|
||||||
|
function L_Other_Character_Info_Window(WindowObject) {
|
||||||
|
return false;
|
||||||
|
//返回Flase 原逻辑继续执行 返回Tue 原逻辑终止执行
|
||||||
|
local Flag = false;
|
||||||
|
if (getroottable().rawin("Lenheart_Other_Character_Info_Class_Obj")) {
|
||||||
|
local MyWindow = getroottable().rawget("Lenheart_Other_Character_Info_Class_Obj");
|
||||||
|
local Ret = MyWindow.SyncState(WindowObject);
|
||||||
|
if (Ret) Flag = true;
|
||||||
|
}
|
||||||
|
return Flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
getroottable().rawdelete("Lenheart_Other_Character_Info_Class_Obj");
|
||||||
|
|
||||||
|
function Lenheart_Other_Character_Info_Class_Fun(obj) {
|
||||||
|
local RootTab = getroottable();
|
||||||
|
if (!RootTab.rawin("Lenheart_Other_Character_Info_Class_Obj")) {
|
||||||
|
RootTab.rawset("Lenheart_Other_Character_Info_Class_Obj", LenheartNewUI_CreateWindow(Lenheart_Other_Character_Info_ClassC, "他人信息属性面板窗口", 0, 0, 263, 146, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getroottable()["LenheartFuncTab"].rawset("Lenheart_Other_Character_Info_ClassFuncN", Lenheart_Other_Character_Info_Class_Fun);
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
文件名:Lenheart_Cursor_Class.nut
|
||||||
|
路径:Base/UI/Lenheart_Cursor_Class.nut
|
||||||
|
创建日期:2024-09-25 19:23
|
||||||
|
文件用途:鼠标绘制逻辑
|
||||||
|
*/
|
||||||
|
class Rindro_Cursor {
|
||||||
|
|
||||||
|
//强制锁
|
||||||
|
ForceLockState = false;
|
||||||
|
|
||||||
|
|
||||||
|
//是否启用
|
||||||
|
UseState = 0;
|
||||||
|
|
||||||
|
TypeState = 0;
|
||||||
|
SubState = 0;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function Proc(Xpos, Ypos) {
|
||||||
|
|
||||||
|
//使用自建的鼠标绘制函数
|
||||||
|
if (UseState) {
|
||||||
|
//工作类型为0
|
||||||
|
if (TypeState == 0) {
|
||||||
|
//常规状态
|
||||||
|
if (SubState == 0) {
|
||||||
|
L_sq_DrawImg("interface/newstyle/windows/cursor.img", 0, Xpos, Ypos);
|
||||||
|
}
|
||||||
|
//按下状态
|
||||||
|
else if (SubState == 1) {
|
||||||
|
L_sq_DrawImg("interface/newstyle/windows/cursor.img", 1, Xpos, Ypos);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
L_sq_DrawImg("interface/newstyle/windows/cursor.img", TypeState, Xpos, Ypos);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Sync(Xpos, Ypos) {
|
||||||
|
Proc(Xpos, Ypos);
|
||||||
|
return UseState;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_Rindro_Cusor_ <- Rindro_Cursor();
|
||||||
|
|
||||||
|
function SyncRindro_Cursor(Xpos, Ypos) {
|
||||||
|
if (getroottable().rawin("_Rindro_Cusor_")) {
|
||||||
|
local Ret = _Rindro_Cusor_.Sync(Xpos, Ypos);
|
||||||
|
return Ret;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,418 @@
|
||||||
|
/*
|
||||||
|
文件名:Lenheart_Each_Class.nut
|
||||||
|
路径:Base/UI/Lenheart_Each_Class.nut
|
||||||
|
创建日期:2024-09-30 14:46
|
||||||
|
文件用途:交互界面类
|
||||||
|
*/
|
||||||
|
class LenheartNewUI_Each_BaseButton extends LenheartNewUI_CommonUi {
|
||||||
|
State = 0;
|
||||||
|
BaseIdx = 29;
|
||||||
|
DWidth = null;
|
||||||
|
Path = null;
|
||||||
|
Idx = null;
|
||||||
|
SetFlag = null;
|
||||||
|
SetIndex = null;
|
||||||
|
|
||||||
|
Icon = null;
|
||||||
|
IconIdx = null;
|
||||||
|
Str = null;
|
||||||
|
StrColor = sq_RGBA(189, 159, 126, 250);
|
||||||
|
|
||||||
|
constructor(X, Y, W, H, Path, Idx) {
|
||||||
|
this.DWidth = W;
|
||||||
|
this.Path = Path;
|
||||||
|
this.Idx = Idx;
|
||||||
|
LenheartNewUI_CommonUi.constructor(X, Y, W, H);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function SetFrame(gPath, gIdx) {
|
||||||
|
if (gPath) Path = gPath;
|
||||||
|
Idx = gIdx;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Show(obj) {
|
||||||
|
//不可用
|
||||||
|
if (State == 8) {
|
||||||
|
// L_sq_DrawImg(Path, Idx + 3, X, Y);
|
||||||
|
} else {
|
||||||
|
//按下
|
||||||
|
if (isLBDown) {
|
||||||
|
L_sq_DrawImg(Path, Idx + 1, X, Y);
|
||||||
|
if (Icon) L_sq_DrawImg(Icon, IconIdx, X + 3, Y + 2);
|
||||||
|
if (Str) L_sq_DrawCode(Str, X + 60 - LenheartTextClass.GetStringLength(Str) / 2, Y + 5, StrColor, 0, 1);
|
||||||
|
}
|
||||||
|
//悬停
|
||||||
|
else if (isInRect) {
|
||||||
|
L_sq_DrawImg(Path, Idx, X, Y);
|
||||||
|
if (Icon) L_sq_DrawImg(Icon, IconIdx, X + 3, Y + 1);
|
||||||
|
if (Str) L_sq_DrawCode(Str, X + 60 - LenheartTextClass.GetStringLength(Str) / 2, Y + 4, StrColor, 0, 1);
|
||||||
|
}
|
||||||
|
//普通
|
||||||
|
else {
|
||||||
|
L_sq_DrawImg(Path, 0, X, Y);
|
||||||
|
if (Icon) L_sq_DrawImg(Icon, IconIdx, X + 3, Y + 1);
|
||||||
|
if (Str) L_sq_DrawCode(Str, X + 60 - LenheartTextClass.GetStringLength(Str) / 2, Y + 4, StrColor, 0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//鼠标左键弹起回调
|
||||||
|
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||||
|
if (isLBDown && OnClick) {
|
||||||
|
OnClick(this);
|
||||||
|
}
|
||||||
|
isLBDown = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Lenheart_EachC extends LenheartNewUI_Windows {
|
||||||
|
//调试模式
|
||||||
|
// DeBugMode = true;
|
||||||
|
|
||||||
|
//不是窗口
|
||||||
|
NoWindow = true;
|
||||||
|
|
||||||
|
//是否可见
|
||||||
|
// Visible = false;
|
||||||
|
|
||||||
|
Info = null;
|
||||||
|
|
||||||
|
NPC_Index = null;
|
||||||
|
NPC_Flag = false;
|
||||||
|
NPC_ButtonMap = null;
|
||||||
|
|
||||||
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||||
|
Childrens = [];
|
||||||
|
NPC_ButtonMap = {};
|
||||||
|
//注册控件
|
||||||
|
RegisterWidget();
|
||||||
|
|
||||||
|
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function RegisterWidget() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function Show(obj) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function TopShow(obj) {
|
||||||
|
if (NPC_Index) {
|
||||||
|
SyncPos();
|
||||||
|
LenheartNewUI_Windows.Show(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function DrawMain(obj) {
|
||||||
|
// if (Info) {
|
||||||
|
// local NPC_Index = Rindro_BaseToolClass.GetEachNpcId();
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// function BottomShow() {}
|
||||||
|
|
||||||
|
//初始化NPC按钮
|
||||||
|
function InitNpcButton() {
|
||||||
|
Childrens = [];
|
||||||
|
if (NPC_ButtonMap.rawin(NPC_Index)) {
|
||||||
|
foreach(Func in NPC_ButtonMap[NPC_Index]) {
|
||||||
|
Func(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.Visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function AddEachForNpc(Index, Func) {
|
||||||
|
if (NPC_ButtonMap.rawin(Index)) {
|
||||||
|
NPC_ButtonMap[Index].append(Func);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
NPC_ButtonMap.rawset(Index, [Func]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function RemoveEachForNpc(Index) {
|
||||||
|
NPC_ButtonMap.rawdelete(Index);
|
||||||
|
}
|
||||||
|
|
||||||
|
//逻辑入口
|
||||||
|
function Proc(obj) {
|
||||||
|
LenheartNewUI_Windows.SyncPos(X, Y);
|
||||||
|
|
||||||
|
NPC_Index = Rindro_BaseToolClass.GetEachNpcId();
|
||||||
|
if (NPC_Index) {
|
||||||
|
if (!NPC_Flag) {
|
||||||
|
NPC_Flag = true;
|
||||||
|
InitNpcButton();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
NPC_Flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function CloseAllEach() {
|
||||||
|
local EachClassObject = L_sq_RA(0x1ADE0E0);
|
||||||
|
if (EachClassObject) {
|
||||||
|
local FristChildOffset = (EachClassObject + 0x68);
|
||||||
|
for (local i = 0; i< 74; i++) {
|
||||||
|
local AddressBuf = FristChildOffset + (4 * i);
|
||||||
|
local ChildAddress = L_sq_RA(AddressBuf);
|
||||||
|
if (ChildAddress) {
|
||||||
|
local OpenFlag = L_sq_RA(ChildAddress + 0xC);
|
||||||
|
if (OpenFlag = 257) L_sq_WA(ChildAddress + 0xC, 256);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Lenheart_Get_Each_Info() {
|
||||||
|
local EachCount = 0;
|
||||||
|
local Xpos = 0;
|
||||||
|
local Ypos = 0;
|
||||||
|
local EachClassObject = L_sq_RA(0x1ADE0E0);
|
||||||
|
if (EachClassObject) {
|
||||||
|
local FristChildOffset = (EachClassObject + 0x68);
|
||||||
|
for (local i = 0; i< 74; i++) {
|
||||||
|
local AddressBuf = FristChildOffset + (4 * i);
|
||||||
|
local ChildAddress = L_sq_RA(AddressBuf);
|
||||||
|
if (ChildAddress) {
|
||||||
|
local OpenFlag = L_sq_RA(ChildAddress + 0xC);
|
||||||
|
if (OpenFlag == 257) EachCount++;
|
||||||
|
}
|
||||||
|
//第0个的时候记录一下坐标
|
||||||
|
if (i == 0) {
|
||||||
|
Xpos = L_sq_RA(ChildAddress + 0x14);
|
||||||
|
Ypos = L_sq_RA(ChildAddress + 0x18);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
Count = EachCount,
|
||||||
|
X = Xpos,
|
||||||
|
Y = Ypos
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//override
|
||||||
|
//鼠标左键弹起回调
|
||||||
|
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||||
|
//调用原生方法
|
||||||
|
LenheartNewUI_Windows.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function SyncPos() {
|
||||||
|
//读取交互坐标数据
|
||||||
|
Info = Lenheart_Get_Each_Info();
|
||||||
|
|
||||||
|
X = Info.X;
|
||||||
|
Y = Info.Y + (21 * Info.Count);
|
||||||
|
//宽度
|
||||||
|
Width = 100;
|
||||||
|
//高度
|
||||||
|
Height = (21 * Childrens.len());
|
||||||
|
//同步子对象坐标
|
||||||
|
foreach(pos, winobj in Childrens) {
|
||||||
|
winobj.X = Info.X;
|
||||||
|
winobj.Y = Info.Y + (21 * (Info.Count + pos));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function Lenheart_Each_Fun(obj) {
|
||||||
|
local RootTab = getroottable();
|
||||||
|
if (!RootTab.rawin("L_Each_Obj")) {
|
||||||
|
RootTab.rawset("L_Each_Obj", LenheartNewUI_CreateWindow(Lenheart_EachC, "玩家与NPC交互界面窗口", 0, 0, 0, 0, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getroottable()["LenheartFuncTab"].rawset("Lenheart_EachN", Lenheart_Each_Fun);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Lenheart_PlayerEachC extends LenheartNewUI_Windows {
|
||||||
|
//调试模式
|
||||||
|
// DeBugMode = true;
|
||||||
|
|
||||||
|
//不是窗口
|
||||||
|
NoWindow = true;
|
||||||
|
|
||||||
|
//是否可见
|
||||||
|
// Visible = false;
|
||||||
|
|
||||||
|
Info = null;
|
||||||
|
Basic = null;
|
||||||
|
|
||||||
|
//当前交互角色姓名
|
||||||
|
PlayerEach_Name = null;
|
||||||
|
PlayerEach_Flag = false;
|
||||||
|
PlayerEach_ButtonMap = null;
|
||||||
|
|
||||||
|
//通用按钮
|
||||||
|
PlayerEach_CommonButtonMap = null;
|
||||||
|
|
||||||
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||||
|
Childrens = [];
|
||||||
|
PlayerEach_ButtonMap = {};
|
||||||
|
PlayerEach_CommonButtonMap = {};
|
||||||
|
//注册控件
|
||||||
|
RegisterWidget();
|
||||||
|
|
||||||
|
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function RegisterWidget() {}
|
||||||
|
|
||||||
|
function Show(obj) {}
|
||||||
|
|
||||||
|
function TopShow(obj) {}
|
||||||
|
|
||||||
|
function DrawMain(obj) {}
|
||||||
|
|
||||||
|
function MySelfShow() {
|
||||||
|
if (PlayerEach_Name) {
|
||||||
|
local obj = sq_getMyCharacter();
|
||||||
|
LenheartNewUI_Windows.Show(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//初始化NPC按钮
|
||||||
|
function InitNpcButton() {
|
||||||
|
Childrens = [];
|
||||||
|
if (PlayerEach_ButtonMap.rawin(PlayerEach_Name)) {
|
||||||
|
foreach(Func in PlayerEach_ButtonMap[PlayerEach_Name]) {
|
||||||
|
Func(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach(Func in PlayerEach_CommonButtonMap) {
|
||||||
|
Func(this);
|
||||||
|
}
|
||||||
|
this.Visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function AddEachForCommon(Index, Func) {
|
||||||
|
PlayerEach_CommonButtonMap.rawset(Index, Func);
|
||||||
|
}
|
||||||
|
|
||||||
|
function RemoveEachForCommon(Index) {
|
||||||
|
PlayerEach_CommonButtonMap.rawdelete(Index);
|
||||||
|
}
|
||||||
|
|
||||||
|
function AddEachForPlayerName(Index, Func) {
|
||||||
|
if (PlayerEach_ButtonMap.rawin(Index)) {
|
||||||
|
PlayerEach_ButtonMap[Index].append(Func);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PlayerEach_ButtonMap.rawset(Index, [Func]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function RemoveEachForPlayerName(Index) {
|
||||||
|
PlayerEach_ButtonMap.rawdelete(Index);
|
||||||
|
}
|
||||||
|
|
||||||
|
function CloseAllEach() {
|
||||||
|
if (Basic) {
|
||||||
|
L_sq_WA(L_sq_P2I(Basic) + 0xC, 256);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//逻辑入口
|
||||||
|
function Proc(obj) {
|
||||||
|
LenheartNewUI_Windows.SyncPos(X, Y);
|
||||||
|
|
||||||
|
local Str = L_Sq_GetPlayerEachName();
|
||||||
|
if (Str.len() > 0) {
|
||||||
|
PlayerEach_Name = Str;
|
||||||
|
}
|
||||||
|
if (PlayerEach_Name) {
|
||||||
|
if (!PlayerEach_Flag) {
|
||||||
|
PlayerEach_Flag = true;
|
||||||
|
InitNpcButton();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PlayerEach_Flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//override
|
||||||
|
//鼠标左键弹起回调
|
||||||
|
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||||
|
LenheartNewUI_Windows.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
function SelfSyncPos(gInfo) {
|
||||||
|
//读取交互坐标数据
|
||||||
|
Info = gInfo;
|
||||||
|
Basic = gInfo.BasicAdd;
|
||||||
|
|
||||||
|
X = Info.X;
|
||||||
|
Y = Info.Y + (21 * Info.Count);
|
||||||
|
//宽度
|
||||||
|
Width = 100;
|
||||||
|
//高度
|
||||||
|
Height = (21 * Childrens.len());
|
||||||
|
//同步子对象坐标
|
||||||
|
foreach(pos, winobj in Childrens) {
|
||||||
|
winobj.X = Info.X;
|
||||||
|
winobj.Y = Info.Y + (21 * (Info.Count + pos));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RindroPlayerEachDrawFlag <- false;
|
||||||
|
RindroPlayerEachDrawCountBuffer <- 0;
|
||||||
|
RindroPlayerEachDrawCount <- 0;
|
||||||
|
Rindro_Haker.LoadHook(0x10002A0, ["pointer", "int", "int"],
|
||||||
|
function(args) {
|
||||||
|
if (L_Sq_GetPlayerEachName().len() <= 0) return;
|
||||||
|
local Xpos = L_sq_RA(L_sq_P2I(args[0]) + 0x14);
|
||||||
|
local Ypos = L_sq_RA(L_sq_P2I(args[0]) + 0x18);
|
||||||
|
|
||||||
|
if (!RindroPlayerEachDrawFlag) {
|
||||||
|
local RootTab = getroottable();
|
||||||
|
RindroPlayerEachDrawFlag = true;
|
||||||
|
if (RootTab.rawin("L_PlayerEach_Obj")) {
|
||||||
|
RootTab["L_PlayerEach_Obj"].SelfSyncPos({
|
||||||
|
X = Xpos,
|
||||||
|
Y = Ypos,
|
||||||
|
Count = RindroPlayerEachDrawCount,
|
||||||
|
BasicAdd = args[0]
|
||||||
|
});
|
||||||
|
RootTab["L_PlayerEach_Obj"].MySelfShow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RindroPlayerEachDrawCountBuffer++;
|
||||||
|
// print(args[0]);
|
||||||
|
return null;
|
||||||
|
|
||||||
|
},
|
||||||
|
function(args) {
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function Lenheart_PlayerEach_Fun(obj) {
|
||||||
|
local RootTab = getroottable();
|
||||||
|
RindroPlayerEachDrawFlag = false;
|
||||||
|
RindroPlayerEachDrawCount = RindroPlayerEachDrawCountBuffer;
|
||||||
|
RindroPlayerEachDrawCountBuffer = 0;
|
||||||
|
if (!RootTab.rawin("L_PlayerEach_Obj")) {
|
||||||
|
RootTab.rawset("L_PlayerEach_Obj", LenheartNewUI_CreateWindow(Lenheart_PlayerEachC, "玩家与玩家交互界面窗口", 0, 0, 0, 0, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getroottable()["LenheartFuncTab"].rawset("Lenheart_PlayerEachN", Lenheart_PlayerEach_Fun);
|
||||||
|
|
@ -0,0 +1,374 @@
|
||||||
|
/*
|
||||||
|
文件名:Lenheart_Event_Class.nut
|
||||||
|
路径:Base/UI/Lenheart_Event_Class.nut
|
||||||
|
创建日期:2024-08-11 09:47
|
||||||
|
文件用途:活动图标
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
class LenheartNewUI_EventButton extends LenheartNewUI_CommonUi {
|
||||||
|
State = 0;
|
||||||
|
BaseIdx = 29;
|
||||||
|
DWidth = null;
|
||||||
|
Path = null;
|
||||||
|
Idx = null;
|
||||||
|
BindObj = null;
|
||||||
|
Timer = 0;
|
||||||
|
EffFlag = true;
|
||||||
|
ShowName = null;
|
||||||
|
|
||||||
|
constructor(X, Y, Path, Idx) {
|
||||||
|
this.DWidth = 20;
|
||||||
|
this.Path = Path;
|
||||||
|
this.Idx = Idx;
|
||||||
|
LenheartNewUI_CommonUi.constructor(X, Y, 20, 20);
|
||||||
|
Timer = Clock();
|
||||||
|
}
|
||||||
|
|
||||||
|
function SetFrame(gPath, gIdx) {
|
||||||
|
if (gPath) Path = gPath;
|
||||||
|
Idx = gIdx;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Show(obj) {
|
||||||
|
T_DrawDynamicAni(obj, "common/yosinevent/eventsystemeff.ani", X, Y, "EventIcon" + ObjectId);
|
||||||
|
//不可用
|
||||||
|
if (State == 8) {
|
||||||
|
L_sq_DrawImg(Path, Idx + 3, X, Y + 1);
|
||||||
|
} else {
|
||||||
|
//按下
|
||||||
|
if (isLBDown) {
|
||||||
|
L_sq_DrawImg(Path, Idx + 1, X, Y);
|
||||||
|
}
|
||||||
|
//悬停
|
||||||
|
else if (isInRect) {
|
||||||
|
L_sq_DrawImg(Path, Idx, X, Y);
|
||||||
|
}
|
||||||
|
//普通
|
||||||
|
else {
|
||||||
|
L_sq_DrawImg(Path, Idx, X, Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//鼠标左键按下回调
|
||||||
|
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||||
|
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) isLBDown = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//鼠标左键弹起回调 overr
|
||||||
|
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||||
|
if (isLBDown && OnClick) {
|
||||||
|
local obj = sq_getMyCharacter();
|
||||||
|
obj.sq_PlaySound("CLICK_BUTTON1");
|
||||||
|
OnClick(this);
|
||||||
|
}
|
||||||
|
isLBDown = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Rindro_Event extends LenheartNewUI_Windows {
|
||||||
|
//调试模式
|
||||||
|
// DeBugMode = true;
|
||||||
|
|
||||||
|
EventFlag = true;
|
||||||
|
//不是窗口
|
||||||
|
NoWindow = true;
|
||||||
|
//显示标志位
|
||||||
|
PosIdx = null;
|
||||||
|
|
||||||
|
//闪烁透明度
|
||||||
|
Alpha = 250;
|
||||||
|
//闪烁模式
|
||||||
|
BlinkMode = false;
|
||||||
|
//时间
|
||||||
|
Timer = 0;
|
||||||
|
|
||||||
|
//是否可见
|
||||||
|
Visible = true;
|
||||||
|
|
||||||
|
//主要Button
|
||||||
|
MainButton = null;
|
||||||
|
|
||||||
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||||
|
Childrens = [];
|
||||||
|
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||||
|
|
||||||
|
Timer = Clock();
|
||||||
|
}
|
||||||
|
|
||||||
|
//绘制主界面
|
||||||
|
function DrawMain(obj) {
|
||||||
|
local RT = Clock() - Timer;
|
||||||
|
|
||||||
|
//根据模式调整透明度
|
||||||
|
if (!BlinkMode) Alpha = sq_GetUniformVelocity(250, 130, RT, 500);
|
||||||
|
else Alpha = sq_GetUniformVelocity(130, 250, RT, 500);
|
||||||
|
//转换模式
|
||||||
|
if (RT >= 500) {
|
||||||
|
Timer = Clock();
|
||||||
|
BlinkMode = !BlinkMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
L_sq_SetDrawImgModel(2, 0);
|
||||||
|
L_sq_DrawImg("interface2/yosin/eventsystemeff.img", 0, X, Y, 1, sq_RGBA(255, 255, 255, Alpha), 1.0, 1.0);
|
||||||
|
L_sq_ReleaseDrawImgModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
function Show(obj) {
|
||||||
|
// DrawMain(obj);
|
||||||
|
// LenheartNewUI_Windows.Show(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
function EventShow(obj) {
|
||||||
|
DrawMain(obj);
|
||||||
|
LenheartNewUI_Windows.Show(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
function TopShow(obj) {
|
||||||
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, 20, 20)) {
|
||||||
|
local XposOffset = 0;
|
||||||
|
local Len = LenheartTextClass.GetStringLength(MainButton.ShowName);
|
||||||
|
local Count = ((Len - 10) / 15) + 1;
|
||||||
|
XposOffset = (-(10 + Count * 15) / 2) + 10;
|
||||||
|
|
||||||
|
L_sq_DrawImg("interface2/yosin/eventsystem.img", 0, X + XposOffset, Y - 24);
|
||||||
|
for (local i = 0; i< Count; i++) {
|
||||||
|
L_sq_DrawImg("interface2/yosin/eventsystem.img", 1, X + XposOffset + 5 + (15 * i), Y - 24);
|
||||||
|
}
|
||||||
|
L_sq_DrawImg("interface2/yosin/eventsystem.img", 2, X + XposOffset + 5 + (15 * Count), Y - 24);
|
||||||
|
L_sq_DrawCode(MainButton.ShowName, X - Len / 2 + 12, Y - 17, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function SyncEventIcon() {
|
||||||
|
local Count = L_sq_RA(L_sq_RA(0x1A39C2C) + 0x6c);
|
||||||
|
X = EventList_Obj.X + (((Count + PosIdx) % 8) * 20);
|
||||||
|
Y = EventList_Obj.Y - ((Count + PosIdx) / 8) * 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
//逻辑入口
|
||||||
|
function Proc(obj) {
|
||||||
|
//同步图标位置
|
||||||
|
SyncEventIcon();
|
||||||
|
LenheartNewUI_Windows.SyncPos(X, Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Rindro_EventList {
|
||||||
|
|
||||||
|
X = 0;
|
||||||
|
Y = 0;
|
||||||
|
|
||||||
|
//活动数组
|
||||||
|
Events = null;
|
||||||
|
EventsMap = null;
|
||||||
|
|
||||||
|
function YosinEventIconInfoCallBack(Chunk) {
|
||||||
|
local Jso = Json.Decode(Chunk);
|
||||||
|
X = Jso.YosinEventIconInfoXpos;
|
||||||
|
Y = Jso.YosinEventIconInfoYpos;
|
||||||
|
|
||||||
|
|
||||||
|
getroottable()["LenheartEventOffset"] <- {
|
||||||
|
x = X - 456,
|
||||||
|
y = Y
|
||||||
|
};
|
||||||
|
|
||||||
|
L_sq_RefreshEventIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
|
||||||
|
Events = [];
|
||||||
|
EventsMap = {};
|
||||||
|
Pack_Control.rawset(30002, YosinEventIconInfoCallBack.bindenv(this));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加活动
|
||||||
|
function AddEvent(Name, Idx, WindowObject, ...) {
|
||||||
|
if (EventsMap.rawin(Name)) return EventsMap.rawget(Name);
|
||||||
|
local Window = LenheartNewUI_CreateWindow(Rindro_Event, Name, 0, 0, 20, 20, 0)
|
||||||
|
local Flag = Events.len();
|
||||||
|
local ImgPath = "interface2/yosin/eventsystemlist.img";
|
||||||
|
if (vargc == 1) ImgPath = vargv[0];
|
||||||
|
local ButtonBuf = LenheartNewUI_EventButton(0, 0, ImgPath, Idx);
|
||||||
|
ButtonBuf.BindObj = WindowObject;
|
||||||
|
ButtonBuf.ShowName = Name;
|
||||||
|
ButtonBuf.OnClick = function(B_obj) {
|
||||||
|
if (B_obj.BindObj) B_obj.BindObj.OpenCallBack();
|
||||||
|
}.bindenv(this);
|
||||||
|
Window.AddChild(ButtonBuf);
|
||||||
|
Window.PosIdx = Events.len();
|
||||||
|
Window.MainButton = ButtonBuf;
|
||||||
|
Events.append(Window);
|
||||||
|
EventsMap.rawset(Name, Window);
|
||||||
|
return Window;
|
||||||
|
}
|
||||||
|
|
||||||
|
//检测是否悬停活动图标
|
||||||
|
function CheckInEvent(MousePos_X, MousePos_Y) {
|
||||||
|
if (sq_GetPopupWindowMainCotrol(244)) return;
|
||||||
|
foreach(Window in Events) {
|
||||||
|
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Window.X, Window.Y, Window.Width, Window.Height)) {
|
||||||
|
getroottable().WindowsShowABFlag <- true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getroottable().rawdelete("EventList_Obj")
|
||||||
|
|
||||||
|
function Lenheart_EventList_Fun(obj) {
|
||||||
|
local RootTab = getroottable();
|
||||||
|
if (!RootTab.rawin("EventList_Obj")) {
|
||||||
|
RootTab.rawset("EventList_Obj", Rindro_EventList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取活动图标坐标 在活动图标变动时会被调用
|
||||||
|
function Sq_Get_Event_Pos_X() {
|
||||||
|
if (getroottable().rawin("LenheartEventOffset")) {
|
||||||
|
return getroottable()["LenheartEventOffset"].x;
|
||||||
|
} else {
|
||||||
|
getroottable()["LenheartEventOffset"] <- {
|
||||||
|
x = 277,
|
||||||
|
y = 530
|
||||||
|
};
|
||||||
|
return getroottable()["LenheartEventOffset"].x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Sq_Get_Event_Pos_Y() {
|
||||||
|
if (getroottable().rawin("LenheartEventOffset")) {
|
||||||
|
return getroottable()["LenheartEventOffset"].y;
|
||||||
|
} else {
|
||||||
|
getroottable()["LenheartEventOffset"] <- {
|
||||||
|
x = 277,
|
||||||
|
y = 530
|
||||||
|
};
|
||||||
|
return getroottable()["LenheartEventOffset"].y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
//活动图标类
|
||||||
|
class Rindro_EventIcon extends LenheartNewUI_CommonUi {
|
||||||
|
//Key
|
||||||
|
Key = null;
|
||||||
|
//活动图标文字
|
||||||
|
EventStr = null;
|
||||||
|
//活动图标Ani编号
|
||||||
|
EventFrame = null;
|
||||||
|
//绑定对象
|
||||||
|
BandObject = null;
|
||||||
|
|
||||||
|
//图标img路径
|
||||||
|
ImgPath = "interface2/yosin/eventsystemlist.img";
|
||||||
|
|
||||||
|
x = null;
|
||||||
|
y = null;
|
||||||
|
|
||||||
|
constructor(gEventStr, gEventFrame, gKey, gBandObject) {
|
||||||
|
this.EventStr = gEventStr;
|
||||||
|
this.EventFrame = gEventFrame;
|
||||||
|
this.Key = gKey;
|
||||||
|
this.BandObject = gBandObject;
|
||||||
|
|
||||||
|
local RootTab = getroottable();
|
||||||
|
if (RootTab.rawin("YosinEventSystem")) {
|
||||||
|
local Arr = RootTab["YosinEventSystem"];
|
||||||
|
local TryAppend = true;
|
||||||
|
local wpos;
|
||||||
|
foreach(pos, value in Arr) {
|
||||||
|
if (value.Key == this.Key) {
|
||||||
|
TryAppend = false;
|
||||||
|
wpos = pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (TryAppend) {
|
||||||
|
Arr.append(this);
|
||||||
|
RootTab.rawset("YosinEventSystem", Arr);
|
||||||
|
} else {
|
||||||
|
Arr[wpos] = this;
|
||||||
|
RootTab.rawset("YosinEventSystem", Arr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
local Arr = [];
|
||||||
|
Arr.append(this);
|
||||||
|
RootTab.rawset("YosinEventSystem", Arr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Show(obj, X, Y) {
|
||||||
|
x = X;
|
||||||
|
y = Y;
|
||||||
|
|
||||||
|
//绘制框
|
||||||
|
T_DrawDynamicAni(obj, "common/yosinevent/eventsystemeff.ani", X, Y, "YosinEventIconEffA");
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (isLBDown()) {
|
||||||
|
//绘制活动图标
|
||||||
|
L_sq_DrawImg(ImgPath, EventFrame, X, Y + 1);
|
||||||
|
//T_DrawStayAni(obj, "common/yosinevent/eventsystemlist.ani", X, Y + 1, EventFrame, "YosinEventIconKey" + Key);
|
||||||
|
} else {
|
||||||
|
//绘制活动图标
|
||||||
|
L_sq_DrawImg(ImgPath, EventFrame, X, Y);
|
||||||
|
}
|
||||||
|
} catch (exception) {
|
||||||
|
if (isLBDown()) {
|
||||||
|
//绘制活动图标
|
||||||
|
T_DrawStayAni(obj, "common/yosinevent/eventsystemlist.ani", X, Y + 1, EventFrame, "YosinEventIconKey" + Key);
|
||||||
|
} else {
|
||||||
|
//绘制活动图标
|
||||||
|
T_DrawStayAni(obj, "common/yosinevent/eventsystemlist.ani", X, Y, EventFrame, "YosinEventIconKey" + Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function StrShow(obj, X, Y) {
|
||||||
|
//悬停
|
||||||
|
if (isInRect() && EventStr) {
|
||||||
|
local count = EventStr.len() / 3;
|
||||||
|
T_DrawStayAni(obj, "common/yosinevent/eventsystem.ani", X - (count * 7), Y - 24, 0, "YosinEventIconStrEffL");
|
||||||
|
for (local i = 0; i< count; i++) {
|
||||||
|
T_DrawStayAni(obj, "common/yosinevent/eventsystem.ani", X - (count * 7) + 5 + (i * 15), Y - 24, 1, "YosinEventIconStrEffZ");
|
||||||
|
}
|
||||||
|
T_DrawStayAni(obj, "common/yosinevent/eventsystem.ani", X - (count * 7) + 5 + (count * 15), Y - 24, 2, "YosinEventIconStrEffR");
|
||||||
|
L_sq_DrawCode(EventStr, X - (count * 4), Y - 17, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||||
|
}
|
||||||
|
if (isLBActive()) {
|
||||||
|
BandObject.MainState = true;
|
||||||
|
BandObject.OpenClassCallBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//悬停状态
|
||||||
|
function isInRect() {
|
||||||
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, x, y, 20, 20)) return true;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
//左键按下状态
|
||||||
|
function isLBDown() {
|
||||||
|
if (isInRect() && Mobj.Lb == 1) return true;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
//左键弹起状态
|
||||||
|
function isLBUp() {
|
||||||
|
if (isInRect() && Mobj.Lb == 0) return true;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//左键单击状态
|
||||||
|
function isLBActive() {
|
||||||
|
if (isInRect() && Mobj.LbEvent) return true;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
文件名:OldWindowsMap.nut
|
||||||
|
路径:Base/UI/OldWindowsMap.nut
|
||||||
|
创建日期:2024-08-06 18:56
|
||||||
|
文件用途:用于查询是否鼠标悬停在原生窗口上的Flag 以下编号代表着没有悬停其他均为悬停在原生窗口
|
||||||
|
*/
|
||||||
|
NotOldWindowsMap <- {}
|
||||||
|
NotOldWindowsMap.rawset(92, 1);
|
||||||
|
NotOldWindowsMap.rawset(79, 1);
|
||||||
|
NotOldWindowsMap.rawset(2395, 1);
|
||||||
|
NotOldWindowsMap.rawset(2396, 1);
|
||||||
|
NotOldWindowsMap.rawset(3877, 1);
|
||||||
|
NotOldWindowsMap.rawset(3878, 1);
|
||||||
|
NotOldWindowsMap.rawset(3873, 1);
|
||||||
|
NotOldWindowsMap.rawset(3874, 1);
|
||||||
|
NotOldWindowsMap.rawset(3858, 1);
|
||||||
|
NotOldWindowsMap.rawset(3871, 1);
|
||||||
|
NotOldWindowsMap.rawset(3857, 1);
|
||||||
|
NotOldWindowsMap.rawset(3861, 1);
|
||||||
|
NotOldWindowsMap.rawset(3862, 1);
|
||||||
|
NotOldWindowsMap.rawset(93, 1);
|
||||||
|
NotOldWindowsMap.rawset(94, 1);
|
||||||
|
NotOldWindowsMap.rawset(95, 1);
|
||||||
|
NotOldWindowsMap.rawset(96, 1);
|
||||||
|
NotOldWindowsMap.rawset(97, 1);
|
||||||
|
NotOldWindowsMap.rawset(98, 1);
|
||||||
|
NotOldWindowsMap.rawset(99, 1);
|
||||||
|
NotOldWindowsMap.rawset(100, 1);
|
||||||
|
NotOldWindowsMap.rawset(101, 1);
|
||||||
|
NotOldWindowsMap.rawset(114, 1);
|
||||||
|
NotOldWindowsMap.rawset(88, 1);
|
||||||
|
NotOldWindowsMap.rawset(102, 1);
|
||||||
|
NotOldWindowsMap.rawset(108, 1);
|
||||||
|
NotOldWindowsMap.rawset(109, 1);
|
||||||
|
NotOldWindowsMap.rawset(103, 1);
|
||||||
|
NotOldWindowsMap.rawset(104, 1);
|
||||||
|
NotOldWindowsMap.rawset(110, 1);
|
||||||
|
NotOldWindowsMap.rawset(111, 1);
|
||||||
|
NotOldWindowsMap.rawset(105, 1);
|
||||||
|
NotOldWindowsMap.rawset(106, 1);
|
||||||
|
NotOldWindowsMap.rawset(112, 1);
|
||||||
|
NotOldWindowsMap.rawset(113, 1);
|
||||||
|
NotOldWindowsMap.rawset(107, 1);
|
||||||
|
NotOldWindowsMap.rawset(87, 1);
|
||||||
|
NotOldWindowsMap.rawset(86, 1);
|
||||||
|
NotOldWindowsMap.rawset(80, 1);
|
||||||
|
NotOldWindowsMap.rawset(81, 1);
|
||||||
|
NotOldWindowsMap.rawset(82, 1);
|
||||||
|
NotOldWindowsMap.rawset(83, 1);
|
||||||
|
NotOldWindowsMap.rawset(4067, 1);
|
||||||
|
NotOldWindowsMap.rawset(122, 1);
|
||||||
|
NotOldWindowsMap.rawset(120, 1);
|
||||||
|
|
@ -0,0 +1,426 @@
|
||||||
|
/*
|
||||||
|
文件名:_ENUM_KEY.nut
|
||||||
|
路径:Base/_ENUM/_ENUM_KEY.nut
|
||||||
|
创建日期:2024-08-06 22:09
|
||||||
|
文件用途:按键枚举类
|
||||||
|
*/
|
||||||
|
DIK_ESCAPE <- 0x01
|
||||||
|
DIK_1 <- 0x02
|
||||||
|
DIK_2 <- 0x03
|
||||||
|
DIK_3 <- 0x04
|
||||||
|
DIK_4 <- 0x05
|
||||||
|
DIK_5 <- 0x06
|
||||||
|
DIK_6 <- 0x07
|
||||||
|
DIK_7 <- 0x08
|
||||||
|
DIK_8 <- 0x09
|
||||||
|
DIK_9 <- 0x0A
|
||||||
|
DIK_0 <- 0x0B
|
||||||
|
DIK_MINUS <- 0x0C /* - on main keyboard */
|
||||||
|
DIK_EQUALS <- 0x0D
|
||||||
|
DIK_BACK <- 0x0E /* backspace */
|
||||||
|
DIK_TAB <- 0x0F
|
||||||
|
DIK_Q <- 0x10
|
||||||
|
DIK_W <- 0x11
|
||||||
|
DIK_E <- 0x12
|
||||||
|
DIK_R <- 0x13
|
||||||
|
DIK_T <- 0x14
|
||||||
|
DIK_Y <- 0x15
|
||||||
|
DIK_U <- 0x16
|
||||||
|
DIK_I <- 0x17
|
||||||
|
DIK_O <- 0x18
|
||||||
|
DIK_P <- 0x19
|
||||||
|
DIK_LBRACKET <- 0x1A
|
||||||
|
DIK_RBRACKET <- 0x1B
|
||||||
|
DIK_RETURN <- 0x1C /* Enter on main keyboard */
|
||||||
|
DIK_LCONTROL <- 0x1D
|
||||||
|
DIK_A <- 0x1E
|
||||||
|
DIK_S <- 0x1F
|
||||||
|
DIK_D <- 0x20
|
||||||
|
DIK_F <- 0x21
|
||||||
|
DIK_G <- 0x22
|
||||||
|
DIK_H <- 0x23
|
||||||
|
DIK_J <- 0x24
|
||||||
|
DIK_K <- 0x25
|
||||||
|
DIK_L <- 0x26
|
||||||
|
DIK_SEMICOLON <- 0x27
|
||||||
|
DIK_APOSTROPHE <- 0x28
|
||||||
|
DIK_GRAVE <- 0x29 /* accent grave */
|
||||||
|
DIK_LSHIFT <- 0x2A
|
||||||
|
DIK_BACKSLASH <- 0x2B
|
||||||
|
DIK_Z <- 0x2C
|
||||||
|
DIK_X <- 0x2D
|
||||||
|
DIK_C <- 0x2E
|
||||||
|
DIK_V <- 0x2F
|
||||||
|
DIK_B <- 0x30
|
||||||
|
DIK_N <- 0x31
|
||||||
|
DIK_M <- 0x32
|
||||||
|
DIK_COMMA <- 0x33
|
||||||
|
DIK_PERIOD <- 0x34 /* . on main keyboard */
|
||||||
|
DIK_SLASH <- 0x35 /* / on main keyboard */
|
||||||
|
DIK_RSHIFT <- 0x36
|
||||||
|
DIK_MULTIPLY <- 0x37 /* * on numeric keypad */
|
||||||
|
DIK_LMENU <- 0x38 /* left Alt */
|
||||||
|
DIK_SPACE <- 0x39
|
||||||
|
DIK_CAPITAL <- 0x3A
|
||||||
|
DIK_F1 <- 0x3B
|
||||||
|
DIK_F2 <- 0x3C
|
||||||
|
DIK_F3 <- 0x3D
|
||||||
|
DIK_F4 <- 0x3E
|
||||||
|
DIK_F5 <- 0x3F
|
||||||
|
DIK_F6 <- 0x40
|
||||||
|
DIK_F7 <- 0x41
|
||||||
|
DIK_F8 <- 0x42
|
||||||
|
DIK_F9 <- 0x43
|
||||||
|
DIK_F10 <- 0x44
|
||||||
|
DIK_NUMLOCK <- 0x45
|
||||||
|
DIK_SCROLL <- 0x46 /* Scroll Lock */
|
||||||
|
DIK_NUMPAD7 <- 0x47
|
||||||
|
DIK_NUMPAD8 <- 0x48
|
||||||
|
DIK_NUMPAD9 <- 0x49
|
||||||
|
DIK_SUBTRACT <- 0x4A /* - on numeric keypad */
|
||||||
|
DIK_NUMPAD4 <- 0x4B
|
||||||
|
DIK_NUMPAD5 <- 0x4C
|
||||||
|
DIK_NUMPAD6 <- 0x4D
|
||||||
|
DIK_ADD <- 0x4E /* + on numeric keypad */
|
||||||
|
DIK_NUMPAD1 <- 0x4F
|
||||||
|
DIK_NUMPAD2 <- 0x50
|
||||||
|
DIK_NUMPAD3 <- 0x51
|
||||||
|
DIK_NUMPAD0 <- 0x52
|
||||||
|
DIK_DECIMAL <- 0x53 /* . on numeric keypad */
|
||||||
|
DIK_OEM_102 <- 0x56 /* <> or \| on RT 102-key keyboard (Non-U.S.) */
|
||||||
|
DIK_F11 <- 0x57
|
||||||
|
DIK_F12 <- 0x58
|
||||||
|
DIK_F13 <- 0x64 /* (NEC PC98) */
|
||||||
|
DIK_F14 <- 0x65 /* (NEC PC98) */
|
||||||
|
DIK_F15 <- 0x66 /* (NEC PC98) */
|
||||||
|
DIK_KANA <- 0x70 /* (Japanese keyboard) */
|
||||||
|
DIK_ABNT_C1 <- 0x73 /* /? on Brazilian keyboard */
|
||||||
|
DIK_CONVERT <- 0x79 /* (Japanese keyboard) */
|
||||||
|
DIK_NOCONVERT <- 0x7B /* (Japanese keyboard) */
|
||||||
|
DIK_YEN <- 0x7D /* (Japanese keyboard) */
|
||||||
|
DIK_ABNT_C2 <- 0x7E /* Numpad . on Brazilian keyboard */
|
||||||
|
DIK_NUMPADEQUALS <- 0x8D /* = on numeric keypad (NEC PC98) */
|
||||||
|
DIK_PREVTRACK <- 0x90 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */
|
||||||
|
DIK_AT <- 0x91 /* (NEC PC98) */
|
||||||
|
DIK_COLON <- 0x92 /* (NEC PC98) */
|
||||||
|
DIK_UNDERLINE <- 0x93 /* (NEC PC98) */
|
||||||
|
DIK_KANJI <- 0x94 /* (Japanese keyboard) */
|
||||||
|
DIK_STOP <- 0x95 /* (NEC PC98) */
|
||||||
|
DIK_AX <- 0x96 /* (Japan AX) */
|
||||||
|
DIK_UNLABELED <- 0x97 /* (J3100) */
|
||||||
|
DIK_NEXTTRACK <- 0x99 /* Next Track */
|
||||||
|
DIK_NUMPADENTER <- 0x9C /* Enter on numeric keypad */
|
||||||
|
DIK_RCONTROL <- 0x9D
|
||||||
|
DIK_MUTE <- 0xA0 /* Mute */
|
||||||
|
DIK_CALCULATOR <- 0xA1 /* Calculator */
|
||||||
|
DIK_PLAYPAUSE <- 0xA2 /* Play / Pause */
|
||||||
|
DIK_MEDIASTOP <- 0xA4 /* Media Stop */
|
||||||
|
DIK_VOLUMEDOWN <- 0xAE /* Volume - */
|
||||||
|
DIK_VOLUMEUP <- 0xB0 /* Volume + */
|
||||||
|
DIK_WEBHOME <- 0xB2 /* Web home */
|
||||||
|
DIK_NUMPADCOMMA <- 0xB3 /* , on numeric keypad (NEC PC98) */
|
||||||
|
DIK_DIVIDE <- 0xB5 /* / on numeric keypad */
|
||||||
|
DIK_SYSRQ <- 0xB7
|
||||||
|
DIK_RMENU <- 0xB8 /* right Alt */
|
||||||
|
DIK_PAUSE <- 0xC5 /* Pause */
|
||||||
|
DIK_HOME <- 0xC7 /* Home on arrow keypad */
|
||||||
|
DIK_UP <- 0xC8 /* UpArrow on arrow keypad */
|
||||||
|
DIK_PRIOR <- 0xC9 /* PgUp on arrow keypad */
|
||||||
|
DIK_LEFT <- 0xCB /* LeftArrow on arrow keypad */
|
||||||
|
DIK_RIGHT <- 0xCD /* RightArrow on arrow keypad */
|
||||||
|
DIK_END <- 0xCF /* End on arrow keypad */
|
||||||
|
DIK_DOWN <- 0xD0 /* DownArrow on arrow keypad */
|
||||||
|
DIK_NEXT <- 0xD1 /* PgDn on arrow keypad */
|
||||||
|
DIK_INSERT <- 0xD2 /* Insert on arrow keypad */
|
||||||
|
DIK_DELETE <- 0xD3 /* Delete on arrow keypad */
|
||||||
|
DIK_LWIN <- 0xDB /* Left Windows key */
|
||||||
|
DIK_RWIN <- 0xDC /* Right Windows key */
|
||||||
|
DIK_APPS <- 0xDD /* AppMenu key */
|
||||||
|
DIK_POWER <- 0xDE /* System Power */
|
||||||
|
DIK_SLEEP <- 0xDF /* System Sleep */
|
||||||
|
DIK_WAKE <- 0xE3 /* System Wake */
|
||||||
|
DIK_WEBSEARCH <- 0xE5 /* Web Search */
|
||||||
|
DIK_WEBFAVORITES <- 0xE6 /* Web Favorites */
|
||||||
|
DIK_WEBREFRESH <- 0xE7 /* Web Refresh */
|
||||||
|
DIK_WEBSTOP <- 0xE8 /* Web Stop */
|
||||||
|
DIK_WEBFORWARD <- 0xE9 /* Web Forward */
|
||||||
|
DIK_WEBBACK <- 0xEA /* Web Back */
|
||||||
|
DIK_MYCOMPUTER <- 0xEB /* My Computer */
|
||||||
|
DIK_MAIL <- 0xEC /* Mail */
|
||||||
|
DIK_MEDIASELECT <- 0xED /* Media Select */
|
||||||
|
FFI_FIRST_ABI <- 0;
|
||||||
|
FFI_SYSV <- 1;
|
||||||
|
FFI_STDCALL <- 2;
|
||||||
|
FFI_THISCALL <- 3;
|
||||||
|
FFI_FASTCALL <- 4;
|
||||||
|
FFI_MS_CDECL <- 5;
|
||||||
|
FFI_PASCAL <- 6;
|
||||||
|
FFI_REGISTER <- 7;
|
||||||
|
|
||||||
|
|
||||||
|
function Sq_L_Medal(x, y) {}
|
||||||
|
|
||||||
|
function Sq_SettingWindowCallBack(x, y) {}
|
||||||
|
|
||||||
|
function Sq_BuffSwitchingCallBack(x, y) {}
|
||||||
|
|
||||||
|
function Sq_SwitchingCallBack(x, y) {}
|
||||||
|
|
||||||
|
function Sq_UpgradeCallBack(x, y) {}
|
||||||
|
|
||||||
|
function Sq_RecoveryCallBack(x, y) {}
|
||||||
|
|
||||||
|
function Sq_RecoveryTypeSetCallBack(Type) {}
|
||||||
|
|
||||||
|
function Sq_DrawMainMaxLayerCustomUI(pack) {}
|
||||||
|
|
||||||
|
function Lenheart(VmTop) {}
|
||||||
|
|
||||||
|
function Sq_MouseEventCallBack(Lb, Rb, Mb) {}
|
||||||
|
|
||||||
|
function Sq_SelectCharacter(Chunk) {}
|
||||||
|
|
||||||
|
function Sq_DrawMainTopLayerCustomUI(pack) {}
|
||||||
|
|
||||||
|
function Sq_GetExeStr_Event(StrIndex) {
|
||||||
|
return StrIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Sq_CreatChr(chunk) {}
|
||||||
|
|
||||||
|
function Sq_SendPackType_Event(Type) {}
|
||||||
|
|
||||||
|
function Sq_SendPackByte_Event(Parm) {}
|
||||||
|
|
||||||
|
function Sq_SendPackWord_Event(Parm) {}
|
||||||
|
|
||||||
|
function Sq_SendPackDWord_Event(Parm) {}
|
||||||
|
|
||||||
|
function Sq_SendPackChar_Event(Parm) {}
|
||||||
|
|
||||||
|
function Sq_SendPack_Event() {}
|
||||||
|
|
||||||
|
function Sq_DrawItemBack(Xpos, Ypos, Image) {}
|
||||||
|
|
||||||
|
function Sq_DrawItemFront(Xpos, Ypos, Image) {}
|
||||||
|
|
||||||
|
function Sq_GetDrawMonBloodSw() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Sq_DrawMonsterBlood(Object, X, Y) {}
|
||||||
|
|
||||||
|
function Sq_Set_Inventory_M_Pos(This) {}
|
||||||
|
|
||||||
|
function Sq_Get_Ex_IntData(SkillAddress, Idx, objAddress) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Sq_Get_Ex_SkillCoolTime(SkillAddress, Idx, objAddress) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Sq_Get_Ex_LevelData(SkillAddress, Idx, objAddress) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Sq_PlayerEachPos(x, y) {}
|
||||||
|
|
||||||
|
function Sq_DrawMainMaxLayerCustomUI(pack) {}
|
||||||
|
|
||||||
|
function Sq_PushDamageFontData(ObjAddress, X, Y, Z, Value, Type, A8, A9) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Sq_PushDamageData(ObjAddress, MySelfAddress, Value);
|
||||||
|
|
||||||
|
function Sq_Pack_Control(chunk) {}
|
||||||
|
|
||||||
|
function Sq_MessageWindowDraw(a, c) {}
|
||||||
|
|
||||||
|
function Sq_Get_Event_Pos_X() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Sq_Get_Event_Pos_Y() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Sq_L_OtherPlayerInfo(x, y, Type, Value, ImgBuf) {
|
||||||
|
local str = Value.tostring();
|
||||||
|
local lenght = L_sq_GetStringDrawLength(str);
|
||||||
|
L_sq_DrawImg(ImgBuf, x + 70 - lenght, y + 5);
|
||||||
|
return Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Sq_DrawMiniMapUI(a) {}
|
||||||
|
|
||||||
|
function Sq_CompleteTask(a1, a2, a3) {}
|
||||||
|
|
||||||
|
function L_drawMainCustomUI_All() {}
|
||||||
|
|
||||||
|
function L_MouseCallBack(a, b, c, d) {}
|
||||||
|
|
||||||
|
function L_DrawWindow_A() {}
|
||||||
|
|
||||||
|
function L_DrawWindow_B() {}
|
||||||
|
|
||||||
|
function L_OpenOldWindowCallBack(WindowIndex) {}
|
||||||
|
|
||||||
|
function L_Old_Window_Get(WindowObject) {}
|
||||||
|
|
||||||
|
function L_Character_Info_Window(WindowObject) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function L_Other_Character_Info_Window(WindowObject) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function L_Old_Window_Visible(WindowObject, Flag) {}
|
||||||
|
|
||||||
|
|
||||||
|
getroottable().LenheartBaseFuncTab <- {};
|
||||||
|
getroottable().LenheartFuncTab <- {};
|
||||||
|
getroottable().Rindro_Scr_Width <- L_sq_RA(0x4D848E);
|
||||||
|
getroottable().Rindro_Scr_High <- L_sq_RA(0x4D8495);
|
||||||
|
|
||||||
|
//获取装备偏移
|
||||||
|
function Rindro_GetEquAddr(addr) {
|
||||||
|
switch (addr) {
|
||||||
|
case 1:
|
||||||
|
return 0x3038;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return 0x304C;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
return 0x3048;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
return 0x3050;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
return 0x3044;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
return 0x3040;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
return 0x3058;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
return 0x305C;
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
return 0x3054;
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
return 0x3060;
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
return 0x3064;
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
return 0x303c;
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case 13: //帽子
|
||||||
|
return 0x3010;
|
||||||
|
break;
|
||||||
|
case 14: //头部
|
||||||
|
return 0x3014;
|
||||||
|
break;
|
||||||
|
case 15: //脸
|
||||||
|
return 0x3018;
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
return 0x301c;
|
||||||
|
break;
|
||||||
|
case 17:
|
||||||
|
return 0x3020;
|
||||||
|
break;
|
||||||
|
case 18:
|
||||||
|
return 0x3024;
|
||||||
|
break;
|
||||||
|
case 19:
|
||||||
|
return 0x3028;
|
||||||
|
break;
|
||||||
|
case 20:
|
||||||
|
return 0x302c;
|
||||||
|
break;
|
||||||
|
case 21:
|
||||||
|
return 0x3030;
|
||||||
|
break;
|
||||||
|
case 22:
|
||||||
|
return 0x3034;
|
||||||
|
break;
|
||||||
|
case 23:
|
||||||
|
return 0x3030;
|
||||||
|
break;
|
||||||
|
case 24:
|
||||||
|
return 0x3068;
|
||||||
|
break;
|
||||||
|
case 25:
|
||||||
|
return 0x306C;
|
||||||
|
break;
|
||||||
|
case 26:
|
||||||
|
return 0x3070;
|
||||||
|
break;
|
||||||
|
case 27:
|
||||||
|
return 0x3074;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//本地模式
|
||||||
|
if(!getroottable().rawin("RINDROLOCAL"))RINDROLOCAL <- false;
|
||||||
|
|
||||||
|
function deepcopy(obj) {
|
||||||
|
local copies = {}; // 用于跟踪已拷贝对象的表
|
||||||
|
return _deepcopy(obj, copies);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _deepcopy(obj, copies) {
|
||||||
|
local type = typeof obj;
|
||||||
|
|
||||||
|
// 处理基本类型
|
||||||
|
if (type != "table" && type != "array" && type != "class" && type != "instance") {
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理循环引用
|
||||||
|
if (obj in copies) {
|
||||||
|
return copies[obj];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建新容器
|
||||||
|
local newObj;
|
||||||
|
if (type == "array") {
|
||||||
|
newObj = array(obj.len());
|
||||||
|
copies[obj] <- newObj; // 在拷贝前记录
|
||||||
|
|
||||||
|
for (local i = 0; i < obj.len(); i++) {
|
||||||
|
newObj[i] = _deepcopy(obj[i], copies);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == "table") {
|
||||||
|
newObj = {};
|
||||||
|
copies[obj] <- newObj; // 在拷贝前记录
|
||||||
|
|
||||||
|
foreach(key, val in obj) {
|
||||||
|
// 键也需要深拷贝
|
||||||
|
local newKey = _deepcopy(key, copies);
|
||||||
|
local newVal = _deepcopy(val, copies);
|
||||||
|
newObj[newKey] <- newVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // 类和实例(浅拷贝)
|
||||||
|
newObj = obj;
|
||||||
|
copies[obj] <- newObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
return newObj;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,545 @@
|
||||||
|
/*
|
||||||
|
文件名: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);
|
||||||
|
// 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 {
|
||||||
|
AnimationFlag = {};
|
||||||
|
FrameList.append({
|
||||||
|
AttackBox = [],
|
||||||
|
DamageBox = [],
|
||||||
|
Delay = 800,
|
||||||
|
Flag = {},
|
||||||
|
Img_Index = 0,
|
||||||
|
Img_Path = "",
|
||||||
|
Pos = {
|
||||||
|
x = -248,
|
||||||
|
y = -331
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// print(Data);
|
||||||
|
// print("创建Ani失败,找不到Ani数据");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//重置Ani
|
||||||
|
function Reset() {
|
||||||
|
IsUsability = true;
|
||||||
|
FlushFrame(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取当前帧信息
|
||||||
|
function GetCurrentFrameInfo() {
|
||||||
|
return FrameList[CurrentFrameIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
function FlushFrame(Index) {
|
||||||
|
if (PngList.len() <= 0) return;
|
||||||
|
//同步当前帧
|
||||||
|
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;
|
||||||
|
if (FrameList.len() <= 0) return;
|
||||||
|
local FrameObj = FrameList[CurrentFrameIndex];
|
||||||
|
// printT(FrameObj);
|
||||||
|
|
||||||
|
|
||||||
|
//坐标偏移
|
||||||
|
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 ("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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function DrawIndex(X, Y, Index) {
|
||||||
|
// return;
|
||||||
|
if (IsUsability) {
|
||||||
|
FlushFrame(Index);
|
||||||
|
DrawFrame(X, Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//绘制角色类
|
||||||
|
class Rindro_Draw_Character {
|
||||||
|
|
||||||
|
//名字
|
||||||
|
Name = null;
|
||||||
|
//职业
|
||||||
|
Job = null;
|
||||||
|
|
||||||
|
//绘制体信息
|
||||||
|
DrawInfo = null;
|
||||||
|
|
||||||
|
//隐藏图层Map
|
||||||
|
HideMap = 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
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
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) {
|
||||||
|
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 = Path,
|
||||||
|
AniName = Path + Clock(),
|
||||||
|
Layer = -10000,
|
||||||
|
DrawType = "Native"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
foreach(Path in Equ.Aurora.Front) {
|
||||||
|
// local AniBuf = Rindro_Animation(Path);
|
||||||
|
AniList.append({
|
||||||
|
Ani = Path,
|
||||||
|
AniName = Path + Clock(),
|
||||||
|
Layer = 10000,
|
||||||
|
DrawType = "Native"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//称号
|
||||||
|
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;
|
||||||
|
|
||||||
|
//记录时装的隐藏图层值
|
||||||
|
if (Equ.rawin("hidelayer")) {
|
||||||
|
foreach(value in Equ["hidelayer"]) {
|
||||||
|
HideMap.rawset(value, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//读取Ani配置
|
||||||
|
local AniScript = Equ["Ani_" + JobName];
|
||||||
|
// printT(AniScript);
|
||||||
|
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 = -1,
|
||||||
|
});
|
||||||
|
} 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) {
|
||||||
|
HideMap = {};
|
||||||
|
DrawInfo = GetCharacAniByEqu(Job, EquipmentArr, Action);
|
||||||
|
this.Job = Job;
|
||||||
|
this.Name = Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Draw(X, Y) {
|
||||||
|
foreach(AniInfo in DrawInfo) {
|
||||||
|
// print(AniInfo.Layer);
|
||||||
|
if (!HideMap.rawin(AniInfo.Layer)) {
|
||||||
|
if (!AniInfo.rawin("DrawType") || AniInfo["DrawType"] != "Native") {
|
||||||
|
AniInfo.Ani.Draw(X, Y);
|
||||||
|
} else {
|
||||||
|
Rindro_BaseToolClass.DrawAniEx(X, Y, AniInfo.Ani, AniInfo.AniName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function DrawFace(X, Y) {
|
||||||
|
//兼容模式
|
||||||
|
if (getroottable().PluginsCompatibilityModeCallBack){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setClip(X, Y, X + 22, Y + 18); //开始裁切
|
||||||
|
foreach(AniInfo in DrawInfo) {
|
||||||
|
try {
|
||||||
|
AniInfo.Ani.DrawIndex(X + ENUM_RINDRO_JOB_FACE_HEIGHT[Job].x, Y + ENUM_RINDRO_JOB_FACE_HEIGHT[Job].y, 0);
|
||||||
|
} catch (exception) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
releaseClip(); //裁切结束
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//鬼剑士
|
||||||
|
//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")
|
||||||
|
|
@ -0,0 +1,516 @@
|
||||||
|
/*
|
||||||
|
文件名:BaseTool_Class.nut
|
||||||
|
路径:Base/_Tool/BaseTool_Class.nut
|
||||||
|
创建日期: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 = "{";
|
||||||
|
foreach(Key, Value in Table) {
|
||||||
|
++Pos;
|
||||||
|
Str += "\"";
|
||||||
|
Str += Key.tostring();
|
||||||
|
Str += "\"";
|
||||||
|
Str += ":";
|
||||||
|
if (typeof(Value) == "string") {
|
||||||
|
Str += "\"";
|
||||||
|
Str += Value;
|
||||||
|
Str += "\"";
|
||||||
|
} else if (typeof(Value) == "table") {
|
||||||
|
Str += Json.Encode(Value);
|
||||||
|
} else if (typeof(Value) == "array") {
|
||||||
|
Str += "[";
|
||||||
|
foreach(ArrObj in Value) {
|
||||||
|
if (typeof(ArrObj) == "table") Str += Json.Encode(Value);
|
||||||
|
else {
|
||||||
|
Str += ArrObj;
|
||||||
|
Str += ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Str = Str.slice(0, Str.len() - 1);
|
||||||
|
Str += "]";
|
||||||
|
} else Str += Value;
|
||||||
|
if (Pos != Size) Str += ",";
|
||||||
|
}
|
||||||
|
Str += "}";
|
||||||
|
return Str;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Decode(Str) {
|
||||||
|
// Str = L_sq_DecondeJson(Str);
|
||||||
|
// local Str = "local _M = " + Str + ";\n return _M;\n";
|
||||||
|
// local Func = compilestring(Str);
|
||||||
|
// return Func();
|
||||||
|
|
||||||
|
local JsonObj = JSONParser();
|
||||||
|
return JsonObj.parse(Str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Key 键盘按键类
|
||||||
|
class KeyPress {
|
||||||
|
function KeyDown(obj, KeyValue) {
|
||||||
|
local KeyEvent = obj.getVar(KeyValue.tostring()); //声明储存器
|
||||||
|
KeyEvent.clear_vector(); //清空储存器的向量位
|
||||||
|
if (sq_IsKeyDown(KeyValue, ENUM_SUBKEY_TYPE_ALL) && KeyEvent.getInt(0) == 0) {
|
||||||
|
KeyEvent.setInt(0, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function KeyUp(obj, KeyValue) {
|
||||||
|
local KeyEvent = obj.getVar(KeyValue.tostring()); //声明储存器
|
||||||
|
if (sq_IsKeyUp(KeyValue, ENUM_SUBKEY_TYPE_ALL)) {
|
||||||
|
KeyEvent.setInt(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isKeyPress(KeyValue) {
|
||||||
|
local obj = sq_getMyCharacter();
|
||||||
|
if (KeyPress.KeyDown(obj, KeyValue)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
KeyPress.KeyUp(obj, KeyValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Key 键盘按键类
|
||||||
|
class KeyPressNB {
|
||||||
|
function KeyDown(obj, KeyValue, VarKey) {
|
||||||
|
local KeyEvent = obj.getVar(VarKey); //声明储存器
|
||||||
|
KeyEvent.clear_vector(); //清空储存器的向量位
|
||||||
|
if (sq_IsKeyDown(KeyValue, ENUM_SUBKEY_TYPE_ALL) && KeyEvent.getInt(0) == 0) {
|
||||||
|
KeyEvent.setInt(0, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function KeyUp(obj, KeyValue, VarKey) {
|
||||||
|
local KeyEvent = obj.getVar(VarKey); //声明储存器
|
||||||
|
if (sq_IsKeyUp(KeyValue, ENUM_SUBKEY_TYPE_ALL)) {
|
||||||
|
KeyEvent.setInt(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isKeyPress(KeyValue, VarKey) {
|
||||||
|
local obj = sq_getMyCharacter();
|
||||||
|
obj = sq_GetCNRDObjectToActiveObject(obj);
|
||||||
|
if (KeyPressNB.KeyDown(obj, KeyValue, VarKey)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
KeyPressNB.KeyUp(obj, KeyValue, VarKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//基础工具类
|
||||||
|
class Rindro_BaseToolClass {
|
||||||
|
|
||||||
|
function IsNumber(value) {
|
||||||
|
try {
|
||||||
|
local Buffer = value.tointeger();
|
||||||
|
return true;
|
||||||
|
} catch (exception) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function GetItemNameById(ItemId) {
|
||||||
|
local ItemObject = L_sq_GetItem(ItemId);
|
||||||
|
local NamePointer = L_sq_RA(ItemObject + 0x20);
|
||||||
|
local ItemName = NativePointer(L_sq_I2P(NamePointer)).readUnicodeString();
|
||||||
|
return ItemName;
|
||||||
|
}
|
||||||
|
|
||||||
|
function SendPack(T) {
|
||||||
|
local str = Json.Encode(T);
|
||||||
|
L_sq_SendPackType(130);
|
||||||
|
L_sq_SendPackWChar(str);
|
||||||
|
L_sq_SendPack();
|
||||||
|
}
|
||||||
|
|
||||||
|
function SendPackEx(T) {
|
||||||
|
local str = L_sq_EncondeJson(T);
|
||||||
|
L_sq_SendPackType(130);
|
||||||
|
L_sq_SendPackWChar(str);
|
||||||
|
L_sq_SendPack();
|
||||||
|
}
|
||||||
|
|
||||||
|
function RegisterPack(Id, CallBack) {
|
||||||
|
Pack_Control.rawset(Id, CallBack);
|
||||||
|
}
|
||||||
|
|
||||||
|
function RegisterHexPack(Id, CallBack)
|
||||||
|
{
|
||||||
|
Pack_Hex_Control.rawset(Id, CallBack);
|
||||||
|
}
|
||||||
|
|
||||||
|
//绘制简易静态Ani // obj -- ani路径 -- X -- Y -- 第几帧 -- ani名字
|
||||||
|
function T_DrawStayAni(obj, aniFileName, x, y, index, aniname) {
|
||||||
|
local SelectAni = obj.getVar().GetAnimationMap(aniname, aniFileName);
|
||||||
|
//sq_AnimationProc(SelectAni);
|
||||||
|
sq_DrawSpecificFrame(SelectAni, x, y, false, index, false, 1.0);
|
||||||
|
return SelectAni;
|
||||||
|
}
|
||||||
|
|
||||||
|
//绘制简易静态Ani // obj -- ani路径 -- X -- Y -- 第几帧 -- ani名字
|
||||||
|
function T_DrawStayAniRate(obj, aniFileName, x, y, index, aniname, rate) {
|
||||||
|
local SelectAni = obj.getVar().GetAnimationMap(aniname, aniFileName);
|
||||||
|
SelectAni.setImageRateFromOriginal(rate, rate);
|
||||||
|
//sq_AnimationProc(SelectAni);
|
||||||
|
sq_DrawSpecificFrame(SelectAni, x, y, false, index, false, 1.0);
|
||||||
|
return SelectAni;
|
||||||
|
}
|
||||||
|
|
||||||
|
//绘制简易动态Ani // obj -- ani路径 -- X -- Y -- ani名字
|
||||||
|
function T_DrawDynamicAni(obj, aniFileName, x, y, aniname) {
|
||||||
|
local ani = obj.getVar().GetAnimationMap(aniname, aniFileName);
|
||||||
|
sq_AnimationProc(ani);
|
||||||
|
sq_drawCurrentFrame(ani, x, y, true);
|
||||||
|
return ani;
|
||||||
|
}
|
||||||
|
|
||||||
|
//超简易绘制动态Ani
|
||||||
|
function DrawAniEx(X, Y, AniPath, ...) {
|
||||||
|
local AniName = "简易播放Ani:" + AniPath;
|
||||||
|
if (vargc > 0) AniName = vargv[0];
|
||||||
|
local obj = sq_getMyCharacter();
|
||||||
|
local ani = obj.getVar().GetAnimationMap(AniName, AniPath);
|
||||||
|
sq_AnimationProc(ani);
|
||||||
|
sq_drawCurrentFrame(ani, X, Y, true);
|
||||||
|
return ani;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//初始化根表成员
|
||||||
|
function InitClass(Name) {
|
||||||
|
local RootTab = getroottable();
|
||||||
|
if (RootTab.rawin(Name) == true) {
|
||||||
|
RootTab.rawdelete(Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取交互Npc名称
|
||||||
|
function GetEachNpcId() {
|
||||||
|
local OneAddress = L_sq_RA(0x1ADE0E0);
|
||||||
|
if (OneAddress) {
|
||||||
|
local TowAddress = L_sq_RA(OneAddress + 8);
|
||||||
|
if (TowAddress) {
|
||||||
|
local Id = L_sq_RA(TowAddress + 0x210);
|
||||||
|
return Id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function DrawTriptych(X, Y, Width, Img, StartIndex) {
|
||||||
|
//如果没有载入img就载入
|
||||||
|
if (!Rindro_Image_GlobalMap.rawin(Img)) {
|
||||||
|
Rindro_Image_GlobalMap[Img] <- Rindro_Image(Img);
|
||||||
|
}
|
||||||
|
Rindro_Image_GlobalMap[Img].DrawPng(StartIndex, X, Y);
|
||||||
|
//获取第一张图片的宽
|
||||||
|
local FirstW = Rindro_Image_GlobalMap[Img].GetPng(StartIndex).GetWidth();
|
||||||
|
//获取中间的图片宽
|
||||||
|
local MiddleW = Rindro_Image_GlobalMap[Img].GetPng(StartIndex + 1).GetWidth();
|
||||||
|
//获得最后一张图片的宽
|
||||||
|
local LastW = Rindro_Image_GlobalMap[Img].GetPng(StartIndex + 2).GetWidth();
|
||||||
|
//绘制中间
|
||||||
|
Rindro_Image_GlobalMap[Img].DrawExPng(StartIndex + 1, X + FirstW, Y, 0, sq_RGBA(255, 255, 255, 250), (Width - LastW - FirstW).tofloat() / MiddleW, 1.0);
|
||||||
|
//绘制最后一张
|
||||||
|
Rindro_Image_GlobalMap[Img].DrawPng(StartIndex + 2, X + Width - LastW, Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
function DrawTriptychDetail(X, Y, Width, Img, Fi, Mi, La) {
|
||||||
|
//如果没有载入img就载入
|
||||||
|
if (!Rindro_Image_GlobalMap.rawin(Img)) {
|
||||||
|
Rindro_Image_GlobalMap[Img] <- Rindro_Image(Img);
|
||||||
|
}
|
||||||
|
Rindro_Image_GlobalMap[Img].DrawPng(Fi, X, Y);
|
||||||
|
//获取第一张图片的宽
|
||||||
|
local FirstW = Rindro_Image_GlobalMap[Img].GetPng(Fi).GetWidth();
|
||||||
|
//获取中间的图片宽
|
||||||
|
local MiddleW = Rindro_Image_GlobalMap[Img].GetPng(Mi).GetWidth();
|
||||||
|
//获得最后一张图片的宽
|
||||||
|
local LastW = Rindro_Image_GlobalMap[Img].GetPng(La).GetWidth();
|
||||||
|
//绘制中间
|
||||||
|
Rindro_Image_GlobalMap[Img].DrawExPng(Mi, X + FirstW, Y, 0, sq_RGBA(255, 255, 255, 250), (Width - LastW - FirstW).tofloat() / MiddleW, 1.0);
|
||||||
|
//绘制最后一张
|
||||||
|
Rindro_Image_GlobalMap[Img].DrawPng(La, X + Width - LastW, Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
function DrawNineBox(X, Y, Width, Height, Img, StartIndex) {
|
||||||
|
//如果没有载入img就载入
|
||||||
|
if (!Rindro_Image_GlobalMap.rawin(Img)) {
|
||||||
|
Rindro_Image_GlobalMap[Img] <- Rindro_Image(Img);
|
||||||
|
}
|
||||||
|
//绘制左上角
|
||||||
|
Rindro_Image_GlobalMap[Img].DrawPng(StartIndex, X, Y);
|
||||||
|
//获取左上角的图片宽高
|
||||||
|
local LeftTopW = Rindro_Image_GlobalMap[Img].GetPng(StartIndex).GetWidth();
|
||||||
|
local LeftTopH = Rindro_Image_GlobalMap[Img].GetPng(StartIndex).GetHeight();
|
||||||
|
|
||||||
|
//绘制上边
|
||||||
|
//获取上边的宽
|
||||||
|
local TopW = Rindro_Image_GlobalMap[Img].GetPng(StartIndex + 1).GetWidth();
|
||||||
|
Rindro_Image_GlobalMap[Img].DrawExPng(StartIndex + 1, X + LeftTopW, Y, 0, sq_RGBA(255, 255, 255, 250), (Width - LeftTopW * 2).tofloat() / TopW, 1.0);
|
||||||
|
|
||||||
|
//绘制右上角
|
||||||
|
Rindro_Image_GlobalMap[Img].DrawPng(StartIndex + 2, X + Width - LeftTopW, Y);
|
||||||
|
|
||||||
|
//绘制左边
|
||||||
|
//获取左边的高
|
||||||
|
local LeftH = Rindro_Image_GlobalMap[Img].GetPng(StartIndex + 3).GetHeight();
|
||||||
|
Rindro_Image_GlobalMap[Img].DrawExPng(StartIndex + 3, X, Y + LeftTopH, 0, sq_RGBA(255, 255, 255, 250), 1.0, (Height - LeftTopH * 2).tofloat() / LeftH);
|
||||||
|
|
||||||
|
//绘制中间
|
||||||
|
//获取中间的宽高
|
||||||
|
local MiddleW = Rindro_Image_GlobalMap[Img].GetPng(StartIndex + 4).GetWidth();
|
||||||
|
local MiddleH = Rindro_Image_GlobalMap[Img].GetPng(StartIndex + 4).GetHeight();
|
||||||
|
Rindro_Image_GlobalMap[Img].DrawExPng(StartIndex + 4, X + LeftTopW, Y + LeftTopH, 0, sq_RGBA(255, 255, 255, 250), (Width - LeftTopW * 2).tofloat() / MiddleW, (Height - LeftTopH * 2).tofloat() / MiddleH);
|
||||||
|
|
||||||
|
//绘制右边
|
||||||
|
Rindro_Image_GlobalMap[Img].DrawExPng(StartIndex + 5, X + Width - LeftTopW, Y + LeftTopH, 0, sq_RGBA(255, 255, 255, 250), 1.0, (Height - LeftTopH * 2).tofloat() / LeftH);
|
||||||
|
|
||||||
|
//绘制左下角
|
||||||
|
Rindro_Image_GlobalMap[Img].DrawPng(StartIndex + 6, X, Y + Height - LeftTopH);
|
||||||
|
|
||||||
|
//绘制下边
|
||||||
|
Rindro_Image_GlobalMap[Img].DrawExPng(StartIndex + 7, X + LeftTopW, Y + Height - LeftTopH, 0, sq_RGBA(255, 255, 255, 250), (Width - LeftTopW * 2).tofloat() / TopW, 1.0);
|
||||||
|
|
||||||
|
//绘制右下角
|
||||||
|
Rindro_Image_GlobalMap[Img].DrawPng(StartIndex + 8, X + Width - LeftTopW, Y + Height - LeftTopH);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
//获取文字绘制长度
|
||||||
|
class LenheartTextClass {
|
||||||
|
function GetStringLength(str) {
|
||||||
|
if (typeof str != "string") str = "无字符";
|
||||||
|
return L_sq_GetStringDrawLength(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MemoryTool {
|
||||||
|
//给指定地址写入字节数组
|
||||||
|
function WirteByteArr(Address, ByteArr) {
|
||||||
|
for (local i = 0; i< ByteArr.len(); i++) {
|
||||||
|
L_sq_WAB(Address + i, ByteArr[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//解密读取内存地址的数据
|
||||||
|
function DecodeMemoryData(Address) {
|
||||||
|
local nEax, nEcx8, nEsi, nEdx, nTmp;
|
||||||
|
nEax = NativePointer(L_sq_I2P(Address)).readInt();
|
||||||
|
if (nEax == -1) return nEax;
|
||||||
|
nEcx8 = NativePointer(L_sq_I2P(Address + 8)).readInt();
|
||||||
|
if (nEcx8 == -1) return nEcx8;
|
||||||
|
nEsi = NativePointer(L_sq_I2P(0x1AF8D78)).readInt();
|
||||||
|
if (nEsi == -1) return nEdx;
|
||||||
|
nEdx = nEax >> 16;
|
||||||
|
nTmp = (nEdx << 2) + nEsi + 36;
|
||||||
|
nEdx = NativePointer(L_sq_I2P(nTmp)).readInt();
|
||||||
|
if (nEdx == -1) return nEdx;
|
||||||
|
nEax = nEax & 65535;
|
||||||
|
nTmp = (nEax << 2) + nEdx + 8468;
|
||||||
|
nEax = NativePointer(L_sq_I2P(nTmp)).readInt();
|
||||||
|
if (nEax == -1) return nEax;
|
||||||
|
nEdx = nEax & 0xFFFF;
|
||||||
|
nEsi = nEdx << 16;
|
||||||
|
nEsi = nEsi | nEdx;
|
||||||
|
nEax = nEsi ^ nEcx8;
|
||||||
|
return nEax;
|
||||||
|
}
|
||||||
|
|
||||||
|
//加密写入内存地址数据
|
||||||
|
function EncodeMemoryData(AddreSs, Data) {
|
||||||
|
local JEdi, JEcx, JEax, JEsi, JEdx, JSs;
|
||||||
|
JEcx = AddreSs;
|
||||||
|
JEax = L_sq_RA(0x1AF8DB8);
|
||||||
|
JEax = JEax + 1;
|
||||||
|
L_sq_WA(0x1AF8DB8, JEax);
|
||||||
|
JEdx = JEax;
|
||||||
|
JEdx = JEdx >> 8;
|
||||||
|
JEdx = JEdx << 24;
|
||||||
|
JEdx = JEdx >> 24;
|
||||||
|
JEdx = L_sq_RA(JEdx * 2 + 0x1843F58);
|
||||||
|
JEdx = JEdx & 0xFFFF;
|
||||||
|
JEax = JEax << 24;
|
||||||
|
JEax = JEax >> 24;
|
||||||
|
JSs = L_sq_RA(JEax * 2 + 0x1844158);
|
||||||
|
JSs = JSs & 0xFFFF;
|
||||||
|
JEdx = JEdx ^ JSs;
|
||||||
|
JEax = JEdx;
|
||||||
|
JEax = JEax & 0xFFFF;
|
||||||
|
JEsi = Data;
|
||||||
|
JEdx = JEsi >> 16;
|
||||||
|
|
||||||
|
JSs = JEsi & 0xFFFF;
|
||||||
|
JEdx = JEdx + JSs;
|
||||||
|
JEdx = JEdx ^ JEax;
|
||||||
|
JEdi = JEdx;
|
||||||
|
JEdx = JEax;
|
||||||
|
JEax = JEax << 16;
|
||||||
|
JEax = JEax + JEdx;
|
||||||
|
JEsi = Data;
|
||||||
|
JEax = JEax ^ JEsi;
|
||||||
|
JEsi = AddreSs + 8;
|
||||||
|
L_sq_WA(JEsi, JEax);
|
||||||
|
JEax = L_sq_RA(AddreSs);
|
||||||
|
JEsi = L_sq_RA(0x1AF8D78);
|
||||||
|
|
||||||
|
JEcx = JEdi;
|
||||||
|
JEcx = JEcx << 16;
|
||||||
|
JEcx = JEcx + JEdx;
|
||||||
|
JEdx = JEax;
|
||||||
|
JEdx = JEdx >> 16;
|
||||||
|
JEdx = L_sq_RA(JEsi + JEdx * 4 + 36);
|
||||||
|
JEax = JEax & 0xFFFF;
|
||||||
|
L_sq_WA(JEdx + JEax * 4 + 8468, JEcx);
|
||||||
|
}
|
||||||
|
|
||||||
|
function DecodeMemoryDataF(Address) {
|
||||||
|
local Value = MemoryTool.DecodeMemoryData(Address);
|
||||||
|
local Bl = blob();
|
||||||
|
Bl.writen(Value, 'i');
|
||||||
|
Bl.seek(0);
|
||||||
|
return Bl.readn('f');
|
||||||
|
}
|
||||||
|
|
||||||
|
function ReadFloat(Address) {
|
||||||
|
local Arr = [];
|
||||||
|
for (local i = 0; i< 4; i++) {
|
||||||
|
Arr.append(L_sq_RAB(Address + i));
|
||||||
|
}
|
||||||
|
// local Value = L_sq_RAB(Address);
|
||||||
|
// print(Value);
|
||||||
|
local Bl = blob();
|
||||||
|
foreach(intvalue in Arr) {
|
||||||
|
Bl.writen(intvalue, 'c');
|
||||||
|
}
|
||||||
|
// Bl.writen(Value, 'i');
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//任务队列
|
||||||
|
class QuestQueue {
|
||||||
|
//队列
|
||||||
|
Queue = null;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
Queue = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加任务
|
||||||
|
function AddQuest(QuestName, QuestLogic, ...) {
|
||||||
|
local args = null;
|
||||||
|
if (vargc > 0) {
|
||||||
|
args = [];
|
||||||
|
for (local i = 0; i< vargc; i++) {
|
||||||
|
args.append(vargv[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Queue[QuestName] <- {
|
||||||
|
Logic = QuestLogic,
|
||||||
|
InseartTime = Clock(),
|
||||||
|
arg = args
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//移除任务
|
||||||
|
function RemoveQuest(QuestName) {
|
||||||
|
if (Queue) {
|
||||||
|
Queue.rawdelete(QuestName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//执行任务
|
||||||
|
function Run() {
|
||||||
|
if (Queue) {
|
||||||
|
local NowTime = Clock();
|
||||||
|
foreach(QuestName, QuestInfo in Queue) {
|
||||||
|
if (QuestInfo.arg && QuestInfo.arg.len() > 0) {
|
||||||
|
local Arr = [];
|
||||||
|
Arr.append(getroottable());
|
||||||
|
Arr.append(QuestName);
|
||||||
|
Arr.append(NowTime);
|
||||||
|
foreach(value in QuestInfo.arg) {
|
||||||
|
Arr.append(value);
|
||||||
|
}
|
||||||
|
QuestInfo.Logic.acall(Arr);
|
||||||
|
// QuestInfo.Logic(QuestName, NowTime - QuestInfo.InseartTime, QuestInfo.arg);
|
||||||
|
} else QuestInfo.Logic(QuestName, NowTime - QuestInfo.InseartTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//示例
|
||||||
|
|
||||||
|
/*
|
||||||
|
Obj.AddQuest("测试任务",function (Name,Time)
|
||||||
|
{
|
||||||
|
print(Time);
|
||||||
|
if(Time >= 2000)Obj.RemoveQuest(Name);
|
||||||
|
}.bindenv(this));
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
文件名:Hacker_Class.nut
|
||||||
|
路径:Base/_Tool/Hacker_Class.nut
|
||||||
|
创建日期:2024-09-24 06:25
|
||||||
|
文件用途:
|
||||||
|
*/
|
||||||
|
class _Rindro_Hacker {
|
||||||
|
HookTable = null;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
HookTable = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
function UnLoadHook(AddressStr) {
|
||||||
|
Sq_DeHookFunc(HookTable[AddressStr]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function LoadHook(AddressStr, ArgumentArr, EnterFunc, LeaveFunc) {
|
||||||
|
//如果已经HOOK过 需要先卸载原来的HOOK
|
||||||
|
if (HookTable.rawin(AddressStr)) {
|
||||||
|
UnLoadHook(AddressStr);
|
||||||
|
print("地址: " + AddressStr + " 已经装载了Hook,本次操作将会卸载之前的Hook在执行。")
|
||||||
|
}
|
||||||
|
|
||||||
|
local Controler = Sq_HookFunc(AddressStr, ArgumentArr, EnterFunc, LeaveFunc);
|
||||||
|
HookTable.rawset(AddressStr, Controler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//初始化Hacker
|
||||||
|
if (!(getroottable().rawin("Rindro_Haker"))) Rindro_Haker <- _Rindro_Hacker();
|
||||||
|
|
||||||
|
|
||||||
|
//重选角色时触发的回调函数(进入赛利亚房间)
|
||||||
|
OnSetCharacter_Control <- {}
|
||||||
|
Rindro_Haker.LoadHook(0x674350, ["pointer", "int"],
|
||||||
|
function(args) {
|
||||||
|
foreach(Func in OnSetCharacter_Control) {
|
||||||
|
Func();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,301 @@
|
||||||
|
/*
|
||||||
|
文件名:Hacker_RegApi.nut
|
||||||
|
路径:Base/_Tool/Hacker_RegApi.nut
|
||||||
|
创建日期:2024-09-25 18:31
|
||||||
|
文件用途:注册API
|
||||||
|
*/
|
||||||
|
//工具类
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
//读取文件内容
|
||||||
|
function ReadScript(Path, Size, CodePage) {
|
||||||
|
local ReadPath = L_sq_P2I(Memory.allocUtf8String(Path).C_Object);
|
||||||
|
local Reader = Memory.alloc(Size);
|
||||||
|
local ReadBuffer = L_sq_P2I(Reader.C_Object);
|
||||||
|
L_Sq_CallFunc(0x11A2030, "int", FFI_FASTCALL, ["int", "int", "int", "int", "int", "int"], 0x1D17638, 0, ReadPath, ReadBuffer, 0x100000, 0x19DAF4);
|
||||||
|
|
||||||
|
|
||||||
|
if (CodePage == "utf8")
|
||||||
|
return Reader.readUtf8String();
|
||||||
|
if (CodePage == "unicode")
|
||||||
|
return Reader.readUnicodeString();
|
||||||
|
if (CodePage == "big5")
|
||||||
|
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";
|
||||||
|
if (vargc > 0) CodePage = vargv[0];
|
||||||
|
local Script = R_Utils.ReadScript(Path, Size, CodePage);
|
||||||
|
local Func = compilestring("return " + Script);
|
||||||
|
local Ret = Func();
|
||||||
|
return Ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取一个指定装备的角色对象
|
||||||
|
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(0x8265A0, "void", FFI_THISCALL, ["int", "int", "int"], ObjAddress, ItemObject, -1);
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//根据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]) {
|
||||||
|
// // for (local i = 0; i< 10000; i++) {
|
||||||
|
// local DrawCode = NativePointer((args[3])).readUnicodeString();
|
||||||
|
// if (DrawCode in DrawCodeCallBackFunc)
|
||||||
|
// DrawCodeCallBackFunc[DrawCode](args);
|
||||||
|
// // }
|
||||||
|
// }
|
||||||
|
// 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(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().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;
|
||||||
|
// });
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*
|
||||||
|
文件名:Image_Class.nut
|
||||||
|
路径:Base/_Tool/Image_Class.nut
|
||||||
|
创建日期:2024-10-21 16:58
|
||||||
|
文件用途: 图片类
|
||||||
|
*/
|
||||||
|
class Rindro_Png {
|
||||||
|
C_Object = null;
|
||||||
|
Path = null;
|
||||||
|
Idx = null;
|
||||||
|
|
||||||
|
constructor(Object, Path, Idx) {
|
||||||
|
this.Path = Path;
|
||||||
|
this.Idx = Idx;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
function GetWidth()
|
||||||
|
{
|
||||||
|
return NativePointer(this.C_Object + 0x1C).readShort();
|
||||||
|
}
|
||||||
|
|
||||||
|
function GetHeight()
|
||||||
|
{
|
||||||
|
return NativePointer(this.C_Object + 0x1E).readShort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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) {
|
||||||
|
local PngObject = L_Sq_CallFunc(0x11AA190, "int", FFI_THISCALL, ["int", "int"], Img, Idx);
|
||||||
|
return Rindro_Png(PngObject, Path, 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];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Rindro_Image_GlobalMap <- {};
|
||||||
|
Rindro_Image_GlobalMap["lenheartui"] <- Rindro_Image("interface/lenheartwindowcommon.img");
|
||||||
|
/*
|
||||||
|
local Png = TestImg.GetPng(0);
|
||||||
|
Png.Draw(200, 200);
|
||||||
|
Png.DrawEx(100, 400, 0, sq_RGBA(255, 255, 255, 255), 1.5, 1.5);
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,661 @@
|
||||||
|
/*
|
||||||
|
文件名:Json_Class.nut
|
||||||
|
路径:Base/_Tool/Json_Class.nut
|
||||||
|
创建日期:2024-09-27 23:54
|
||||||
|
文件用途:Json类
|
||||||
|
*/
|
||||||
|
|
||||||
|
class JSONParser {
|
||||||
|
|
||||||
|
|
||||||
|
static version = "1.0.1";
|
||||||
|
|
||||||
|
|
||||||
|
state = "";
|
||||||
|
stack = null;
|
||||||
|
container = null;
|
||||||
|
key = "";
|
||||||
|
value = "";
|
||||||
|
converter = null;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
stack = [];
|
||||||
|
container = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
function parse(str, ...) {
|
||||||
|
if (vargc > 0) converter = vargc[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local string = {
|
||||||
|
go = function() {
|
||||||
|
state = "ok";
|
||||||
|
}.bindenv(this),
|
||||||
|
firstokey = function() {
|
||||||
|
key = value;
|
||||||
|
state = "colon";
|
||||||
|
}.bindenv(this),
|
||||||
|
okey = function() {
|
||||||
|
key = value;
|
||||||
|
state = "colon";
|
||||||
|
}.bindenv(this),
|
||||||
|
ovalue = function() {
|
||||||
|
value = this._convert(value, "string", converter);
|
||||||
|
state = "ocomma";
|
||||||
|
}.bindenv(this),
|
||||||
|
firstavalue = function() {
|
||||||
|
value = this._convert(value, "string", converter);
|
||||||
|
state = "acomma";
|
||||||
|
}.bindenv(this),
|
||||||
|
avalue = function() {
|
||||||
|
value = value;
|
||||||
|
this._convert(value, "string", converter);
|
||||||
|
state = "acomma";
|
||||||
|
}.bindenv(this)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
local number = {
|
||||||
|
go = function() {
|
||||||
|
state = "ok";
|
||||||
|
}.bindenv(this),
|
||||||
|
ovalue = function() {
|
||||||
|
value = this._convert(value, "number", converter);
|
||||||
|
state = "ocomma";
|
||||||
|
}.bindenv(this),
|
||||||
|
firstavalue = function() {
|
||||||
|
value = this._convert(value, "number", converter);
|
||||||
|
state = "acomma";
|
||||||
|
}.bindenv(this),
|
||||||
|
avalue = function() {
|
||||||
|
value = this._convert(value, "number", converter);
|
||||||
|
state = "acomma";
|
||||||
|
}.bindenv(this)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local action = {};
|
||||||
|
|
||||||
|
|
||||||
|
action["{"] <- {
|
||||||
|
go = function() {
|
||||||
|
stack.push({
|
||||||
|
state = "ok"
|
||||||
|
});
|
||||||
|
container = {};
|
||||||
|
state = "firstokey";
|
||||||
|
}.bindenv(this),
|
||||||
|
ovalue = function() {
|
||||||
|
stack.push({
|
||||||
|
container = container,
|
||||||
|
state = "ocomma",
|
||||||
|
key = key
|
||||||
|
});
|
||||||
|
container = {};
|
||||||
|
state = "firstokey";
|
||||||
|
}.bindenv(this),
|
||||||
|
firstavalue = function() {
|
||||||
|
stack.push({
|
||||||
|
container = container,
|
||||||
|
state = "acomma"
|
||||||
|
});
|
||||||
|
container = {};
|
||||||
|
state = "firstokey";
|
||||||
|
}.bindenv(this),
|
||||||
|
avalue = function() {
|
||||||
|
stack.push({
|
||||||
|
container = container,
|
||||||
|
state = "acomma"
|
||||||
|
});
|
||||||
|
container = {};
|
||||||
|
state = "firstokey";
|
||||||
|
}.bindenv(this)
|
||||||
|
},
|
||||||
|
|
||||||
|
action["}"] <- {
|
||||||
|
firstokey = function() {
|
||||||
|
local pop = stack.pop();
|
||||||
|
value = container;
|
||||||
|
container = ("container" in pop) ? pop.container : null;
|
||||||
|
key = ("key" in pop) ? pop.key : null;
|
||||||
|
state = pop.state;
|
||||||
|
}.bindenv(this),
|
||||||
|
ocomma = function() {
|
||||||
|
local pop = stack.pop();
|
||||||
|
container[key] <- value;
|
||||||
|
value = container;
|
||||||
|
container = ("container" in pop) ? pop.container : null;
|
||||||
|
key = ("key" in pop) ? pop.key : null;
|
||||||
|
state = pop.state;
|
||||||
|
}.bindenv(this)
|
||||||
|
},
|
||||||
|
|
||||||
|
action["["] <- {
|
||||||
|
go = function() {
|
||||||
|
stack.push({
|
||||||
|
state = "ok"
|
||||||
|
});
|
||||||
|
container = [];
|
||||||
|
state = "firstavalue";
|
||||||
|
}.bindenv(this),
|
||||||
|
ovalue = function() {
|
||||||
|
stack.push({
|
||||||
|
container = container,
|
||||||
|
state = "ocomma",
|
||||||
|
key = key
|
||||||
|
});
|
||||||
|
container = [];
|
||||||
|
state = "firstavalue";
|
||||||
|
}.bindenv(this),
|
||||||
|
firstavalue = function() {
|
||||||
|
stack.push({
|
||||||
|
container = container,
|
||||||
|
state = "acomma"
|
||||||
|
});
|
||||||
|
container = [];
|
||||||
|
state = "firstavalue";
|
||||||
|
}.bindenv(this),
|
||||||
|
avalue = function() {
|
||||||
|
stack.push({
|
||||||
|
container = container,
|
||||||
|
state = "acomma"
|
||||||
|
});
|
||||||
|
container = [];
|
||||||
|
state = "firstavalue";
|
||||||
|
}.bindenv(this)
|
||||||
|
},
|
||||||
|
|
||||||
|
action["]"] <- {
|
||||||
|
firstavalue = function() {
|
||||||
|
local pop = stack.pop();
|
||||||
|
value = container;
|
||||||
|
container = ("container" in pop) ? pop.container : null;
|
||||||
|
key = ("key" in pop) ? pop.key : null;
|
||||||
|
state = pop.state;
|
||||||
|
}.bindenv(this),
|
||||||
|
acomma = function() {
|
||||||
|
local pop = stack.pop();
|
||||||
|
container.push(value);
|
||||||
|
value = container;
|
||||||
|
container = ("container" in pop) ? pop.container : null;
|
||||||
|
key = ("key" in pop) ? pop.key : null;
|
||||||
|
state = pop.state;
|
||||||
|
}.bindenv(this)
|
||||||
|
},
|
||||||
|
|
||||||
|
action[":"] <- {
|
||||||
|
colon = function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local err = false;
|
||||||
|
foreach(akey, avalue in container) {
|
||||||
|
if (akey == key) err = true;
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if (err) throw "Duplicate key \"" + key + "\"";
|
||||||
|
state = "ovalue";
|
||||||
|
}.bindenv(this)
|
||||||
|
},
|
||||||
|
|
||||||
|
action[","] <- {
|
||||||
|
ocomma = function() {
|
||||||
|
container[key] <- value;
|
||||||
|
state = "okey";
|
||||||
|
}.bindenv(this),
|
||||||
|
acomma = function() {
|
||||||
|
container.push(value);
|
||||||
|
state = "avalue";
|
||||||
|
}.bindenv(this)
|
||||||
|
},
|
||||||
|
|
||||||
|
action["true"] <- {
|
||||||
|
go = function() {
|
||||||
|
value = true;
|
||||||
|
state = "ok";
|
||||||
|
}.bindenv(this),
|
||||||
|
ovalue = function() {
|
||||||
|
value = true;
|
||||||
|
state = "ocomma";
|
||||||
|
}.bindenv(this),
|
||||||
|
firstavalue = function() {
|
||||||
|
value = true;
|
||||||
|
state = "acomma";
|
||||||
|
}.bindenv(this),
|
||||||
|
avalue = function() {
|
||||||
|
value = true;
|
||||||
|
state = "acomma";
|
||||||
|
}.bindenv(this)
|
||||||
|
},
|
||||||
|
|
||||||
|
action["false"] <- {
|
||||||
|
go = function() {
|
||||||
|
value = false;
|
||||||
|
state = "ok";
|
||||||
|
}.bindenv(this),
|
||||||
|
ovalue = function() {
|
||||||
|
value = false;
|
||||||
|
state = "ocomma";
|
||||||
|
}.bindenv(this),
|
||||||
|
firstavalue = function() {
|
||||||
|
value = false;
|
||||||
|
state = "acomma";
|
||||||
|
}.bindenv(this),
|
||||||
|
avalue = function() {
|
||||||
|
value = false;
|
||||||
|
state = "acomma";
|
||||||
|
}.bindenv(this)
|
||||||
|
},
|
||||||
|
|
||||||
|
action["null"] <- {
|
||||||
|
go = function() {
|
||||||
|
value = null;
|
||||||
|
state = "ok";
|
||||||
|
}.bindenv(this),
|
||||||
|
ovalue = function() {
|
||||||
|
value = null;
|
||||||
|
state = "ocomma";
|
||||||
|
}.bindenv(this),
|
||||||
|
firstavalue = function() {
|
||||||
|
value = null;
|
||||||
|
state = "acomma";
|
||||||
|
}.bindenv(this),
|
||||||
|
avalue = function() {
|
||||||
|
value = null;
|
||||||
|
state = "acomma";
|
||||||
|
}.bindenv(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
state = "go";
|
||||||
|
stack = [];
|
||||||
|
|
||||||
|
|
||||||
|
local start = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
local result, token, tokenizer = _JSONTokenizer();
|
||||||
|
|
||||||
|
while (token = tokenizer.nextToken(str, start)) {
|
||||||
|
|
||||||
|
if ("ptfn" == token.type) {
|
||||||
|
|
||||||
|
action[token.value][state]();
|
||||||
|
} else if ("number" == token.type) {
|
||||||
|
|
||||||
|
value = token.value;
|
||||||
|
number[state]();
|
||||||
|
} else if ("string" == token.type) {
|
||||||
|
|
||||||
|
value = tokenizer.unescape(token.value);
|
||||||
|
string[state]();
|
||||||
|
}
|
||||||
|
|
||||||
|
start += token.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
state = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (state != "ok" || regexp("[^\\s]").capture(str, start)) {
|
||||||
|
local near = str.slice(start, GetMin(str.len(), start + 10));
|
||||||
|
throw "JSON Syntax Error near `" + near + "`";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function GetMin(a, b) {
|
||||||
|
return a< b ? a : b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function _convert(value, type, converter) {
|
||||||
|
if ("function" == typeof converter) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local parametercCount = 2;
|
||||||
|
|
||||||
|
|
||||||
|
if ("getinfos" in converter) {
|
||||||
|
parametercCount = converter.getinfos().parameters.len() -
|
||||||
|
1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parametercCount == 1) {
|
||||||
|
return converter(value);
|
||||||
|
} else if (parametercCount == 2) {
|
||||||
|
return converter(value, type);
|
||||||
|
} else {
|
||||||
|
throw "Error: converter function must take 1 or 2 parameters"
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if ("number" == type) {
|
||||||
|
local Ret = (value.find(".") == null && value.find("e") == null && value.find("E") == null) ? value.tointeger() : value.tofloat();
|
||||||
|
return Ret;
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class _JSONTokenizer {
|
||||||
|
|
||||||
|
_ptfnRegex = null;
|
||||||
|
_numberRegex = null;
|
||||||
|
_stringRegex = null;
|
||||||
|
_ltrimRegex = null;
|
||||||
|
_unescapeRegex = null;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
|
||||||
|
this._ptfnRegex = regexp("^(?:\\,|\\:|\\[|\\]|\\{|\\}|true|false|null)");
|
||||||
|
|
||||||
|
|
||||||
|
this._numberRegex = regexp("^(?:\\-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)");
|
||||||
|
|
||||||
|
|
||||||
|
this._stringRegex = regexp("^(?:\\\"((?:[^\\r\\n\\t\\\\\\\"]|\\\\(?:[\"\\\\\\/trnfb]|u[0-9a-fA-F]{4}))*)\\\")");
|
||||||
|
|
||||||
|
|
||||||
|
this._ltrimRegex = regexp("^[\\s\\t\\n\\r]*");
|
||||||
|
|
||||||
|
|
||||||
|
this._unescapeRegex = regexp("\\\\(?:(?:u\\d{4})|[\\\"\\\\/bfnrt])");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function nextToken(str, ...) {
|
||||||
|
local start = 0;
|
||||||
|
if (vargc > 0) start = vargv[0];
|
||||||
|
local
|
||||||
|
m,
|
||||||
|
type,
|
||||||
|
token,
|
||||||
|
value,
|
||||||
|
length,
|
||||||
|
whitespaces;
|
||||||
|
|
||||||
|
|
||||||
|
whitespaces = this._leadingWhitespaces(str, start);
|
||||||
|
start += whitespaces;
|
||||||
|
|
||||||
|
if (m = this._ptfnRegex.capture(str, start)) {
|
||||||
|
|
||||||
|
value = str.slice(m[0].begin, m[0].end);
|
||||||
|
type = "ptfn";
|
||||||
|
} else if (m = this._numberRegex.capture(str, start)) {
|
||||||
|
|
||||||
|
value = str.slice(m[0].begin, m[0].end);
|
||||||
|
type = "number";
|
||||||
|
} else if (m = this._stringRegex.capture(str, start)) {
|
||||||
|
|
||||||
|
value = str.slice(m[1].begin, m[1].end);
|
||||||
|
type = "string";
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
token = {
|
||||||
|
type = type,
|
||||||
|
value = value,
|
||||||
|
length = m[0].end - m[0].begin + whitespaces
|
||||||
|
};
|
||||||
|
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function _leadingWhitespaces(str, start) {
|
||||||
|
local r = this._ltrimRegex.capture(str, start);
|
||||||
|
|
||||||
|
if (r) {
|
||||||
|
return r[0].end - r[0].begin;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_unescapeReplacements = {
|
||||||
|
b = "\b",
|
||||||
|
f = "\f",
|
||||||
|
n = "\n",
|
||||||
|
r = "\r",
|
||||||
|
t = "\t"
|
||||||
|
};
|
||||||
|
|
||||||
|
function unescape(str) {
|
||||||
|
|
||||||
|
local start = 0;
|
||||||
|
local res = "";
|
||||||
|
|
||||||
|
while (start< str.len()) {
|
||||||
|
local m = this._unescapeRegex.capture(str, start);
|
||||||
|
|
||||||
|
if (m) {
|
||||||
|
local token = str.slice(m[0].begin, m[0].end);
|
||||||
|
|
||||||
|
|
||||||
|
local pre = str.slice(start, m[0].begin);
|
||||||
|
res += pre;
|
||||||
|
|
||||||
|
if (token.len() == 6) {
|
||||||
|
res += token;
|
||||||
|
} else {
|
||||||
|
local char = token.slice(1);
|
||||||
|
|
||||||
|
if (char in this._unescapeReplacements) {
|
||||||
|
res += this._unescapeReplacements[char];
|
||||||
|
} else {
|
||||||
|
res += char;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
res += str.slice(start);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
start = m[0].end;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class JSONEncoder {
|
||||||
|
|
||||||
|
static VERSION = "2.0.0";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static _maxDepth = 32;
|
||||||
|
|
||||||
|
|
||||||
|
function encode(value) {
|
||||||
|
return this._encode(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function _encode(val, ...) {
|
||||||
|
local depth = 0;
|
||||||
|
if (vargc > 0) depth = vargv[0];
|
||||||
|
|
||||||
|
if (depth > this._maxDepth) {
|
||||||
|
throw "Possible cyclic reference";
|
||||||
|
}
|
||||||
|
|
||||||
|
local
|
||||||
|
r = "",
|
||||||
|
s = "",
|
||||||
|
i = 0;
|
||||||
|
|
||||||
|
switch (typeof val) {
|
||||||
|
|
||||||
|
case "table":
|
||||||
|
case "class":
|
||||||
|
s = "";
|
||||||
|
|
||||||
|
|
||||||
|
foreach(k, v in val) {
|
||||||
|
if (typeof v != "function") {
|
||||||
|
s += ",\"" + k + "\":" + this._encode(v, depth + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
s = s.len() > 0 ? s.slice(1) : s;
|
||||||
|
r += "{" + s + "}";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "array":
|
||||||
|
s = "";
|
||||||
|
|
||||||
|
for (i = 0; i< val.len(); i++) {
|
||||||
|
s += "," + this._encode(val[i], depth + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
s = (i > 0) ? s.slice(1) : s;
|
||||||
|
r += "[" + s + "]";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "integer":
|
||||||
|
case "float":
|
||||||
|
case "bool":
|
||||||
|
r += val;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "null":
|
||||||
|
r += "null";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "instance":
|
||||||
|
|
||||||
|
if ("_serializeRaw" in val && typeof val._serializeRaw == "function") {
|
||||||
|
|
||||||
|
|
||||||
|
r += val._serializeRaw().tostring();
|
||||||
|
|
||||||
|
} else if ("_serialize" in val && typeof val._serialize == "function") {
|
||||||
|
|
||||||
|
|
||||||
|
r += this._encode(val._serialize(), depth + 1);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
s = "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
foreach(k, v in val) {
|
||||||
|
s += ",\"" + k + "\":" + this._encode(v, depth + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach(k, v in val.getclass()) {
|
||||||
|
if (typeof v != "function") {
|
||||||
|
s += ",\"" + k + "\":" + this._encode(val[k], depth + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
s = s.len() > 0 ? s.slice(1) : s;
|
||||||
|
r += "{" + s + "}";
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "blob":
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
r += "\"" + (val.len() ? this._escape(val.tostring()) : "") + "\"";
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
r += "\"" + this._escape(val.tostring()) + "\"";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _escape(str) {
|
||||||
|
local res = "";
|
||||||
|
|
||||||
|
for (local i = 0; i< str.len(); i++) {
|
||||||
|
|
||||||
|
local ch1 = (str[i] & 0xFF);
|
||||||
|
|
||||||
|
if ((ch1 & 0x80) == 0x00) {
|
||||||
|
|
||||||
|
|
||||||
|
ch1 = format("%c", ch1);
|
||||||
|
|
||||||
|
if (ch1 == "\"") {
|
||||||
|
res += "\\\"";
|
||||||
|
} else if (ch1 == "\\") {
|
||||||
|
res += "\\\\";
|
||||||
|
} else if (ch1 == "/") {
|
||||||
|
res += "\\/";
|
||||||
|
} else if (ch1 == "\b") {
|
||||||
|
res += "\\b";
|
||||||
|
} else if (ch1 == "\f") {
|
||||||
|
res += "\\f";
|
||||||
|
} else if (ch1 == "\n") {
|
||||||
|
res += "\\n";
|
||||||
|
} else if (ch1 == "\r") {
|
||||||
|
res += "\\r";
|
||||||
|
} else if (ch1 == "\t") {
|
||||||
|
res += "\\t";
|
||||||
|
} else if (ch1 == "\0") {
|
||||||
|
res += "\\u0000";
|
||||||
|
} else {
|
||||||
|
res += ch1;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if ((ch1 & 0xE0) == 0xC0) {
|
||||||
|
|
||||||
|
local ch2 = (str[++i] & 0xFF);
|
||||||
|
res += format("%c%c", ch1, ch2);
|
||||||
|
} else if ((ch1 & 0xF0) == 0xE0) {
|
||||||
|
|
||||||
|
local ch2 = (str[++i] & 0xFF);
|
||||||
|
local ch3 = (str[++i] & 0xFF);
|
||||||
|
res += format("%c%c%c", ch1, ch2, ch3);
|
||||||
|
} else if ((ch1 & 0xF8) == 0xF0) {
|
||||||
|
|
||||||
|
local ch2 = (str[++i] & 0xFF);
|
||||||
|
local ch3 = (str[++i] & 0xFF);
|
||||||
|
local ch4 = (str[++i] & 0xFF);
|
||||||
|
res += format("%c%c%c%c", ch1, ch2, ch3, ch4);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,204 @@
|
||||||
|
/*
|
||||||
|
文件名:MemoryClass.nut
|
||||||
|
路径:Base/_Tool/MemoryClass.nut
|
||||||
|
创建日期:2024-09-24 08:22
|
||||||
|
文件用途:
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Memory {
|
||||||
|
|
||||||
|
function alloc(Size) {
|
||||||
|
return NativePointer(Size.tostring());
|
||||||
|
}
|
||||||
|
|
||||||
|
function allocUtf8String(Str) {
|
||||||
|
return NativePointer(Str_Ptr(Str));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class NativePointer {
|
||||||
|
//大小
|
||||||
|
Size = -1;
|
||||||
|
|
||||||
|
C_Object = null;
|
||||||
|
|
||||||
|
constructor(T) {
|
||||||
|
if (type(T) == "integer") {
|
||||||
|
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());
|
||||||
|
Size = T;
|
||||||
|
//注册销毁伪析构
|
||||||
|
Register_Destruction(C_Object, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function add(intoffset) {
|
||||||
|
return NativePointer(L_sq_I2P(L_sq_P2I(this.C_Object) + intoffset));
|
||||||
|
}
|
||||||
|
|
||||||
|
function sub(intoffset) {
|
||||||
|
return NativePointer(L_sq_I2P(L_sq_P2I(this.C_Object) - intoffset));
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeByteArray(arr) {
|
||||||
|
Sq_Memory_WriteByteArr(this.C_Object, arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
function readByteArray(size) {
|
||||||
|
local PointB = Sq_Point2Blob(this.C_Object, size);
|
||||||
|
local arr = [];
|
||||||
|
foreach(value in PointB) {
|
||||||
|
arr.append(value);
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function write(value, type) {
|
||||||
|
local Buf = blob(0);
|
||||||
|
Buf.writen(value, type);
|
||||||
|
local arr = [];
|
||||||
|
foreach(value in Buf) {
|
||||||
|
arr.append(value);
|
||||||
|
}
|
||||||
|
writeByteArray(arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeS8(value) {
|
||||||
|
write(value, 'c');
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeU8(value) {
|
||||||
|
write(value, 'b');
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeS16(value) {
|
||||||
|
write(value, 's');
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeU16(value) {
|
||||||
|
write(value, 'w');
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeS32(value) {
|
||||||
|
write(value, 'i');
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeU32(value) {
|
||||||
|
write(value, 'i');
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeShort(value) {
|
||||||
|
write(value, 's');
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeUShort(value) {
|
||||||
|
write(value, 'w');
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeInt(value) {
|
||||||
|
write(value, 'i');
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeUInt(value) {
|
||||||
|
write(value, 'i');
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeFloat(value) {
|
||||||
|
write(value, 'f');
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeDouble(value) {
|
||||||
|
write(value, 'd');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function read(type) {
|
||||||
|
local Buf = Sq_Point2Blob(L_sq_P2I(this.C_Object), 4);
|
||||||
|
return Buf.readn(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
function readS8() {
|
||||||
|
return read('c');
|
||||||
|
}
|
||||||
|
|
||||||
|
function readU8() {
|
||||||
|
return read('b');
|
||||||
|
}
|
||||||
|
|
||||||
|
function readS16() {
|
||||||
|
return read('s');
|
||||||
|
}
|
||||||
|
|
||||||
|
function readU16() {
|
||||||
|
return read('w');
|
||||||
|
}
|
||||||
|
|
||||||
|
function readS32() {
|
||||||
|
return read('i');
|
||||||
|
}
|
||||||
|
|
||||||
|
function readU32() {
|
||||||
|
return read('i');
|
||||||
|
}
|
||||||
|
|
||||||
|
function readShort() {
|
||||||
|
return read('s');
|
||||||
|
}
|
||||||
|
|
||||||
|
function readUShort() {
|
||||||
|
return read('w');
|
||||||
|
}
|
||||||
|
|
||||||
|
function readInt() {
|
||||||
|
return read('i');
|
||||||
|
}
|
||||||
|
|
||||||
|
function readUInt() {
|
||||||
|
return read('i');
|
||||||
|
}
|
||||||
|
|
||||||
|
function readFloat() {
|
||||||
|
return read('f');
|
||||||
|
}
|
||||||
|
|
||||||
|
function readDouble() {
|
||||||
|
return read('d');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function readUnicodeString(...) {
|
||||||
|
if (vargc > 0) {
|
||||||
|
return Sq_Memory_ReadString(this.C_Object, vargv[0]);
|
||||||
|
} else {
|
||||||
|
return Sq_Memory_ReadString(this.C_Object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function readUtf8String(...) {
|
||||||
|
if (vargc > 0) {
|
||||||
|
return Sq_Memory_ReadStringByUtf8(this.C_Object, vargv[0]);
|
||||||
|
} else {
|
||||||
|
return Sq_Memory_ReadStringByUtf8(this.C_Object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function readBig5String(...) {
|
||||||
|
if (vargc > 0) {
|
||||||
|
return Sq_Memory_ReadStringByBig5(this.C_Object, vargv[0]);
|
||||||
|
} else {
|
||||||
|
return Sq_Memory_ReadStringByBig5(this.C_Object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function readPointer() {
|
||||||
|
return Sq_ReadPoint(this.C_Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
function tostring() {
|
||||||
|
return this.C_Object.tostring();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
文件名:Pack_Class.nut
|
||||||
|
路径:Base/_Tool/Pack_Class.nut
|
||||||
|
创建日期:2025-06-30 09:24
|
||||||
|
文件用途:字节包
|
||||||
|
*/
|
||||||
|
class Packet {
|
||||||
|
|
||||||
|
//读取指针位置
|
||||||
|
Index = 0;
|
||||||
|
|
||||||
|
//内存数据
|
||||||
|
Pointer = null;
|
||||||
|
//包大小
|
||||||
|
Size = 0;
|
||||||
|
|
||||||
|
|
||||||
|
//加载包
|
||||||
|
function Load(P, S) {
|
||||||
|
Pointer = P;
|
||||||
|
Size = S;
|
||||||
|
}
|
||||||
|
|
||||||
|
//读取指针跳转
|
||||||
|
function Seek(...) {
|
||||||
|
local Pos = vargv[0];
|
||||||
|
local Mode = 0;
|
||||||
|
if(vargc > 1) Mode = vargv[1];
|
||||||
|
if (Mode == 0) {
|
||||||
|
Index = Pos;
|
||||||
|
} else if (Mode == 1) {
|
||||||
|
Index += Pos;
|
||||||
|
} else if (Mode == 2) {
|
||||||
|
Index -= Pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//读取整形
|
||||||
|
function GetInt() {
|
||||||
|
local Size_t = 4;
|
||||||
|
if (Index + Size_t > Size) {
|
||||||
|
print("读取包越界!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
local Buf = NativePointer(Pointer).add(Index).readInt();
|
||||||
|
Index += Size_t;
|
||||||
|
return Buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
//读取流
|
||||||
|
function GetStream(Size_t) {
|
||||||
|
if (Index + Size_t > Size) {
|
||||||
|
print("读取包越界!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
local Np = NativePointer(Pointer).add(Index);
|
||||||
|
Np.Size = Size_t;
|
||||||
|
Index += Size_t;
|
||||||
|
return Np;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,713 @@
|
||||||
|
/*
|
||||||
|
文件名: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 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) {
|
||||||
|
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 _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) {
|
||||||
|
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);
|
||||||
|
} else {
|
||||||
|
Rindro_Script_Bin_Data.append("");
|
||||||
|
}
|
||||||
|
CurrentIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function GetBinString(Index) {
|
||||||
|
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) {
|
||||||
|
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.GetInt();
|
||||||
|
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: {
|
||||||
|
IO.seek(-4, 'c');
|
||||||
|
local ret = IO.readn('i');
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
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 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) {
|
||||||
|
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);
|
||||||
|
i += 5;
|
||||||
|
for (local z = 0; z< Count; z++) {
|
||||||
|
local Layer = Rindro_Script.UnpackData(IO, i);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
//隐藏图层
|
||||||
|
else if (str == "[hide layer]") {
|
||||||
|
EquipmentAtt["hidelayer"] <- [];
|
||||||
|
while (true) {
|
||||||
|
local Buffer = Rindro_Script.UnpackData(IO, i);
|
||||||
|
i += 5;
|
||||||
|
if (Buffer == "[/hide layer]") {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
EquipmentAtt["hidelayer"].append(Buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//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);
|
||||||
|
i += 5;
|
||||||
|
local Index2 = Rindro_Script.UnpackData(IO, i);
|
||||||
|
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);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取文件并处理
|
||||||
|
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.InitLoad_String();
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
/*
|
||||||
|
文件名:CharacterInfoData.nut
|
||||||
|
路径:Base/_Z_Data/CharacterInfoData.nut
|
||||||
|
创建日期:2024-09-03 11:34
|
||||||
|
文件用途:角色信息数据
|
||||||
|
*/
|
||||||
|
|
||||||
|
//读取属性数据
|
||||||
|
function Lenheart_Character_GetAttribute(Address) {
|
||||||
|
//传入读传入不传读自己
|
||||||
|
local ObjectAddress = Address;
|
||||||
|
if (ObjectAddress == null)
|
||||||
|
ObjectAddress = L_sq_RA(0x1AB7CDC);
|
||||||
|
if (!ObjectAddress) return;
|
||||||
|
|
||||||
|
local Info = {};
|
||||||
|
//当前HP
|
||||||
|
Info.CurHp <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x2BEC);
|
||||||
|
//总HP
|
||||||
|
Info.MaxHp <- L_sq_RA(ObjectAddress + 0x36A0);
|
||||||
|
//当前MP
|
||||||
|
Info.CurMp <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x2BF8);
|
||||||
|
//总MP
|
||||||
|
Info.MaxMp <- L_sq_RA(ObjectAddress + 0x36A4);
|
||||||
|
|
||||||
|
//力量
|
||||||
|
Info.Strength <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x2364);
|
||||||
|
//智力
|
||||||
|
Info.Intellect <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x2394);
|
||||||
|
//体力
|
||||||
|
Info.Vitality <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x237C);
|
||||||
|
//精神
|
||||||
|
Info.Spirit <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x23AC);
|
||||||
|
//物理攻击 (没读武器精通)
|
||||||
|
Info.PhysicalAttack <- (MemoryTool.DecodeMemoryData(ObjectAddress + 0x1E54) * (Info.Strength.tofloat() * 0.004 + 1)).tointeger() + MemoryTool.DecodeMemoryData(ObjectAddress + 0x1EB4);
|
||||||
|
//魔法攻击
|
||||||
|
Info.MagicalAttack <- (MemoryTool.DecodeMemoryData(ObjectAddress + 0x1E84) * (Info.Intellect.tofloat() * 0.004 + 1)).tointeger() + MemoryTool.DecodeMemoryData(ObjectAddress + 0x1ED8);
|
||||||
|
//独立攻击力 //TODO 需要加上成长独立攻击力 需要服务端发送给我
|
||||||
|
Info.IndependentAttack <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x22C8) + MemoryTool.DecodeMemoryData(ObjectAddress + 0x22F8);
|
||||||
|
|
||||||
|
//物理防御
|
||||||
|
Info.PhysicalDefend <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x273C);
|
||||||
|
//魔法防御
|
||||||
|
Info.MagicalDefend <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x276C);
|
||||||
|
//物理暴击
|
||||||
|
Info.PhysicalCrit <- MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x1F14);
|
||||||
|
//魔法暴击
|
||||||
|
Info.MagicalCrit <- MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x1F20);
|
||||||
|
|
||||||
|
//攻击速度
|
||||||
|
Info.AttackSpeed <- (MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x2688) - 1.0) * 100.0;
|
||||||
|
//释放速度
|
||||||
|
Info.ReleaseSpeed <- (MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x26A0) - 1.0) * 100.0;
|
||||||
|
//移动速度
|
||||||
|
Info.MoveSpeed <- (MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x2670) - 1.0) * 100.0;
|
||||||
|
|
||||||
|
//抗魔值
|
||||||
|
local Kbuf = 0;
|
||||||
|
for (local i = 1; i< 13; ++i) {
|
||||||
|
local EquOffset = Rindro_GetEquAddr(i);
|
||||||
|
local AbAddress = L_sq_RA(ObjectAddress + EquOffset);
|
||||||
|
if (AbAddress) {
|
||||||
|
Kbuf += MemoryTool.DecodeMemoryData(AbAddress + 0xAD4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Info.AntiMagic <- Kbuf;
|
||||||
|
|
||||||
|
|
||||||
|
//命中率
|
||||||
|
Info.HitRate <- MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x1F50);
|
||||||
|
//闪避率
|
||||||
|
Info.DodgeRate <- MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x1C50);
|
||||||
|
//HP回复量
|
||||||
|
Info.HPRecovery <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1D64) * 1.6;
|
||||||
|
//MP回复量
|
||||||
|
Info.MPRecovery <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1D7C) * 7.2;
|
||||||
|
//僵直度
|
||||||
|
Info.StunRate <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1DF4);
|
||||||
|
//硬直
|
||||||
|
Info.StunResist <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1DDC);
|
||||||
|
|
||||||
|
//火属性强化
|
||||||
|
Info.FireStrength <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B54);
|
||||||
|
//冰属性强化
|
||||||
|
Info.IceStrength <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B60);
|
||||||
|
//光属性强化
|
||||||
|
Info.LightStrength <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B78);
|
||||||
|
//暗属性强化
|
||||||
|
Info.DarkStrength <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B6C);
|
||||||
|
//火属性抗性
|
||||||
|
Info.FireResist <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1AF4);
|
||||||
|
//冰属性抗性
|
||||||
|
Info.IceResist <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B00);
|
||||||
|
//光属性抗性
|
||||||
|
Info.LightResist <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B18);
|
||||||
|
//暗属性抗性
|
||||||
|
Info.DarkResist <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B0C);
|
||||||
|
|
||||||
|
//名望值
|
||||||
|
Info.Fame <- 0;
|
||||||
|
//最终伤害
|
||||||
|
Info.FinalDamage <- 0;
|
||||||
|
|
||||||
|
return Info;
|
||||||
|
}
|
||||||
|
|
||||||
|
// function Rindro_GetCharacterInfoCallBack(Chunk) {
|
||||||
|
// local Jso = Json.Decode(Chunk);
|
||||||
|
// Jso.op <- 20069011;
|
||||||
|
// Jso.Info <- Lenheart_Character_GetAttribute(null);
|
||||||
|
// Rindro_BaseToolClass.SendPackEx(Jso);
|
||||||
|
// }
|
||||||
|
// Pack_Control.rawset(20069010, Rindro_GetCharacterInfoCallBack);
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,2 @@
|
||||||
|
test1.nut
|
||||||
|
test2.nut
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1 @@
|
||||||
|
a.nut
|
||||||
Loading…
Reference in New Issue