425 lines
14 KiB
Plaintext
425 lines
14 KiB
Plaintext
/*
|
|
文件名:ItemData.nut
|
|
路径:Base/_Z_Data/ItemData.nut
|
|
创建日期:2024-08-06 23:58
|
|
文件用途:用于存放Item数据
|
|
*/
|
|
if (!getroottable().rawin("Rindro_ItemInfoObject")) Rindro_ItemInfoObject <- {};
|
|
if (!getroottable().rawin("Rindro_ItemInfoBuf")) Rindro_ItemInfoBuf <- "";
|
|
if (!getroottable().rawin("RINDRO_INIT_FLAG")) RINDRO_INIT_FLAG <- true;
|
|
|
|
//获取本地配置
|
|
function Rindro_GetLocalConfig() {
|
|
// local Buf = L_sq_GetLocalConfig();
|
|
// if (!Buf) {
|
|
// return {
|
|
// md5 = -1
|
|
// };
|
|
// } else return dofile("Rindro_Config.cfg");
|
|
}
|
|
|
|
//获取本地信息版本
|
|
function Rindro_GetMd5() {
|
|
// return RINDRO_CONFIG.md5;
|
|
return -1;
|
|
}
|
|
|
|
//初始化各种信息
|
|
function Rindro_Init() {
|
|
// //道具信息
|
|
// local ItemArray = getroottable().RINDRO_CONFIG.itemInfo;
|
|
// Rindro_ItemInfoBuf = "";
|
|
// foreach(Value in ItemArray) {
|
|
// if (Value.Name2.len() == 0)
|
|
// Value.Name2 = "Rindro-Team";
|
|
// getroottable().Rindro_ItemInfoObject[Value.Id] <- Value;
|
|
// }
|
|
// RINDRO_INIT_FLAG = true;
|
|
}
|
|
//更新本地配置
|
|
function Rindro_ItemInfoCallBack(Chunk) {
|
|
// local Jso = Json.Decode(Chunk);
|
|
// if ("ZipSEnd" in Jso) {
|
|
// getroottable().Rindro_ItemInfoObject <- {};
|
|
// Rindro_ItemInfoBuf += Jso.ZipS;
|
|
// local ZlibStrBuf = L_sq_Dezlib(Rindro_ItemInfoBuf);
|
|
// if (ZlibStrBuf == "null") {
|
|
// Rindro_ItemInfoBuf = "";
|
|
// return;
|
|
// }
|
|
// ZlibStrBuf = L_sq_DecondeJson(ZlibStrBuf);
|
|
// L_sq_SetLocalConfig("return " + ZlibStrBuf);
|
|
// getroottable().RINDRO_CONFIG <- dofile("Rindro_Config.cfg");
|
|
// Rindro_Init();
|
|
// } else {
|
|
// Rindro_ItemInfoBuf += Jso.ZipS;
|
|
// }
|
|
}
|
|
Pack_Control.rawset(20240422, Rindro_ItemInfoCallBack);
|
|
//无需更新本地配置
|
|
Pack_Control.rawset(20240424, function(Chunk) {
|
|
Rindro_Init();
|
|
});
|
|
|
|
|
|
//道具绘制类
|
|
class ItemInfoClass {
|
|
|
|
//Gm模式
|
|
GmModel = true;
|
|
|
|
Info = null;
|
|
PageLength = 0;
|
|
|
|
//静态品级颜色
|
|
static RarityColor = [
|
|
0xFFFFFFFF, //白
|
|
0xFFEDD568, //蓝
|
|
0xFFFF6BB3, //紫
|
|
0xFFF000FF, //粉
|
|
0xFF00B1FF, //黄
|
|
0xFF6666FF, //红
|
|
0xFF0055FF, //橙
|
|
];
|
|
|
|
//我的品级颜色
|
|
MyRarityColor = null;
|
|
//我的售价长度
|
|
MyPriceLength = null;
|
|
//我的冷却时间长度
|
|
MyCoolTimeLength = null;
|
|
|
|
//获取真实类型
|
|
function GetRealType(Type) {
|
|
switch (Type) {
|
|
case "[material]":
|
|
return "材料";
|
|
case "[recipe]":
|
|
return "设计图";
|
|
case "[upgradable legacy]":
|
|
return "袖珍罐";
|
|
case "[quest]":
|
|
return "任务";
|
|
case "[booster random]":
|
|
case "[multi upgradable legacy]":
|
|
case "[booster selection]":
|
|
case "[cera booster]":
|
|
case "[unlimited waste]":
|
|
case "[usable cera package]":
|
|
case "[only effect]":
|
|
return "消耗品";
|
|
case "[weapon]":
|
|
return "武器";
|
|
case "[title name]":
|
|
return "称号";
|
|
case "[coat]":
|
|
return "上衣";
|
|
case "[pants]":
|
|
return "下衣";
|
|
case "[hat]":
|
|
return "帽子";
|
|
case "[shoulder]":
|
|
return "护肩";
|
|
case "[waist]":
|
|
return "腰带";
|
|
case "[shoes]":
|
|
return "鞋子";
|
|
case "[amulet]":
|
|
return "项链";
|
|
case "[wrist]":
|
|
return "手镯";
|
|
case "[ring]":
|
|
return "戒指";
|
|
case "[support]":
|
|
return "辅助装备";
|
|
case "[aurora avatar]":
|
|
return "光环";
|
|
case "[magic stone]":
|
|
return "魔法石";
|
|
case "[creature]":
|
|
return "寵物";
|
|
case "[artifact red]":
|
|
return "宠物装备 红";
|
|
case "[artifact blue]":
|
|
return "宠物装备 蓝";
|
|
case "[artifact green]":
|
|
return "宠物装备 绿";
|
|
case "[skin avatar]":
|
|
return "皮肤";
|
|
case "[hair avatar]":
|
|
return "头部装扮";
|
|
case "[waist avatar]":
|
|
return "腰部装扮";
|
|
case "[hat avatar]":
|
|
return "帽子装扮";
|
|
case "[coat avatar]":
|
|
return "上衣装扮";
|
|
case "[face avatar]":
|
|
return "脸部装扮";
|
|
case "[breast avatar]":
|
|
return "胸部装扮";
|
|
case "[pants avatar]":
|
|
return "下装装扮";
|
|
case "[shoes avatar]":
|
|
return "鞋装扮";
|
|
default:
|
|
return "道具";
|
|
}
|
|
}
|
|
|
|
constructor(gInfo) {
|
|
Info = clone(gInfo);
|
|
|
|
//Gm模式显示编号
|
|
if (GmModel) Info.Name += "[" + Info.Id + "]";
|
|
|
|
//配置品级颜色
|
|
if (Info.Rarity< 0 || Info.Rarity > 6) {
|
|
MyRarityColor = Info.Rarity;
|
|
} else {
|
|
MyRarityColor = RarityColor[Info.Rarity];
|
|
}
|
|
|
|
//配置售价长度
|
|
if ("Price" in Info) {
|
|
MyPriceLength = LenheartTextClass.GetStringLength(Info.Price.tostring());
|
|
}
|
|
|
|
//配置冷却时间长度
|
|
if ("CoolTime" in Info) {
|
|
MyCoolTimeLength = LenheartTextClass.GetStringLength((Info.CoolTime / 1000.0).tostring());
|
|
}
|
|
|
|
//配置类型
|
|
if ("Type" in Info) {
|
|
Info.Type = GetRealType(Info.Type);
|
|
}
|
|
//配置装备类型
|
|
else if ("EquipmentType" in Info) {
|
|
Info.Type <- GetRealType(Info.EquipmentType);
|
|
}
|
|
|
|
PageLength += 72;
|
|
CheckStrLength();
|
|
}
|
|
|
|
function CheckInfoLength(TableKey, AddLength) {
|
|
if (TableKey in Info) {
|
|
PageLength += AddLength;
|
|
}
|
|
}
|
|
|
|
function CheckStrLength() {
|
|
if ("Explain" in Info) {
|
|
// local Buf = LenheartTextClass.GetStringLength(Info.Explain.tostring());
|
|
// local Pn = (Buf / 211.0);
|
|
// if (Pn< 1) PageLength += 12;
|
|
// if (Pn > 1) Pn = Pn.tointeger() + 1;
|
|
// PageLength += (16 * Pn);
|
|
|
|
local Buf = L_sq_GetStringDrawArray(Info.Explain, 220);
|
|
PageLength += (Buf.len() * 16);
|
|
// PageLength += 12;
|
|
}
|
|
}
|
|
|
|
//高级绘制文字(带换行)
|
|
function L_sq_DrawCode_Ex(str, x, y, rgba, mb, jc, hl) {
|
|
local strarr = [];
|
|
if (str.find("\n") == null) L_sq_DrawCode(str, x, y, rgba, mb, jc);
|
|
else {
|
|
local Bpos = 0;
|
|
while (true) {
|
|
local Npos = str.find("\n", Bpos);
|
|
if (!Npos) {
|
|
local strbuff = str.slice(Bpos, str.len());
|
|
strarr.append(strbuff);
|
|
break;
|
|
}
|
|
local strbuff = str.slice(Bpos, Npos);
|
|
strarr.append(strbuff);
|
|
Bpos = Npos + 1;
|
|
}
|
|
for (local z = 0; z< strarr.len(); z++) {
|
|
L_sq_DrawCode(strarr[z], x, y + (z * 14), rgba, mb, jc);
|
|
}
|
|
}
|
|
}
|
|
|
|
function Show(X, Y) {
|
|
if (X< 0) X = 0;
|
|
if ((X + 211) > 800) X = (800 - 211);
|
|
if (Y< 0) Y = 0;
|
|
if (Y + PageLength > 600) Y = 600 - PageLength;
|
|
|
|
//Item信息框一般为211的宽度
|
|
L_sq_DrawWindow(X, Y, 211, PageLength, "interface2/popup/popup.img", 134, 6, 12, 6, 13);
|
|
|
|
//绘制名字 和 图标
|
|
if ("Id" in Info) L_Sq_DrawItem(X + 8 + 174, Y + 8, Info.Id, 1, 0, 0, 0);
|
|
if ("Name2" in Info) L_sq_DrawCode(Info.Name2, X + 8, Y + 9, MyRarityColor, 1, 1);
|
|
if ("Name" in Info) L_sq_DrawCode(Info.Name, X + 8, Y + 23, MyRarityColor, 1, 1);
|
|
|
|
|
|
//绘制线
|
|
L_sq_DrawImg("interface2/popup/popup.img", 270, X + 7, Y + 26 + 16);
|
|
|
|
//绘制重量
|
|
if ("Weight" in Info) {
|
|
L_sq_DrawCode((Info.Weight.tofloat() / 1000.0).tostring() + "kg", X + 7, Y + 24 + 24, 0xFFFFFFFF, 1, 1);
|
|
}
|
|
|
|
//绘制售价
|
|
if ("Price" in Info) {
|
|
L_sq_DrawCode("金币", X + 186, Y + 24 + 24, 0xFFFFFFFF, 1, 1);
|
|
L_sq_DrawCode(Info.Price.tostring(), X - MyPriceLength + 186, Y + 24 + 24, 0xFFFFFFFF, 1, 1);
|
|
}
|
|
|
|
|
|
//绘制类型
|
|
if ("Type" in Info) {
|
|
L_sq_DrawCode(Info.Type.tostring(), X + 7, Y + 48 + 16, 0xFFFFFFFF, 1, 1);
|
|
}
|
|
|
|
|
|
|
|
//绘制冷却时间
|
|
if ("CoolTime" in Info) {
|
|
L_sq_DrawCode("秒", X + 186 + 12, Y + 48 + 16, 0xFFFFFFFF, 1, 1);
|
|
L_sq_DrawCode((Info.CoolTime / 1000.0).tostring(), X - MyCoolTimeLength + 214 - 18, Y + 48 + 16, 0xFFFFFFFF, 1, 1);
|
|
}
|
|
|
|
//绘制普通描述
|
|
if ("Explain" in Info) {
|
|
local a = L_sq_GetStringDrawArray(Info.Explain, 220);
|
|
foreach(Pos, va in a) {
|
|
L_sq_DrawCode(va, X + 7, Y + 48 + 12 + 24 + (Pos * 16), 0xFFEDD568, 1, 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// print(L_sq_P2I(Memory.allocUtf8String("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img").C_Object));
|
|
// local Npk = L_Sq_CallFunc(0x11C0410, "int", FFI_THISCALL, ["int", "int", "int"], L_sq_RA(0x1B4684C), 0, L_sq_P2I(Memory.allocUtf8String("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img").C_Object));
|
|
// print(Npk);
|
|
// local Img = L_Sq_CallFunc(0x11AA190, "int", FFI_THISCALL, ["int", "int"], Npk, 0);
|
|
// print(format("%02x", Img));
|
|
// print("width: " + NativePointer(Img).add(0x1C).readShort());
|
|
// print("height: " + NativePointer(Img).add(0x20).readShort());
|
|
|
|
// local ReadPath = L_sq_P2I(Memory.allocUtf8String("etc/rindro/horseguessing/horseguessing.dat").C_Object);
|
|
// print(format("%02x", ReadPath));
|
|
// local Reader = Memory.alloc(1024);
|
|
// local ReadBuffer = L_sq_P2I(Reader.C_Object);
|
|
// print(format("%02x", ReadBuffer));
|
|
// L_Sq_CallFunc(0x11A2030, "int", FFI_FASTCALL, ["int", "int", "int", "int", "int", "int"], 0x1D17638, 0, ReadPath, ReadBuffer, 0x100000, 0x19DAF4);
|
|
// // print(Reader.readUtf8String());
|
|
// local Func = compilestring(Reader.readUtf8String());
|
|
// local Ret = Func();
|
|
// print(Ret);
|
|
|
|
// local Tabs = dofile("aw.nut");
|
|
// print(Tabs.itemInfo.len());
|
|
// local Address = L_Sq_GetExportByName("fopen");
|
|
// print(Address);
|
|
// L_Sq_CallFunc(0xE6E070, "void", 4, ["int", "int", "int", "int", "char"], L_sq_RA(0x1A5FB20), 0, 33, "", 0x65535);
|
|
|
|
// Rindro_Haker.LoadHook(0x4C9FA0, ["pointer", "int", "void"],
|
|
// function(args) {
|
|
// // print(555);
|
|
// return null;
|
|
// },
|
|
// function(args) {
|
|
// // print(666);
|
|
// return null;
|
|
// });
|
|
|
|
|
|
// print(L_sq_StringBinById(435110));
|
|
|
|
// Rindro_Haker.LoadHook(0x4017F0, ["int", "int", "int", "int"],
|
|
// function(args) {
|
|
// print(args[0]);
|
|
// print(args[1]);
|
|
// print(args[2]);
|
|
// return null;
|
|
// },
|
|
// function(args) {
|
|
|
|
// return null;
|
|
// });
|
|
|
|
|
|
// 0x121a1e2
|
|
//this 0x1D17638
|
|
// local Read = Memory.alloc(10000);
|
|
// print(Read);
|
|
// L_Sq_CallFunc(0x11A2030, "int", FFI_THISCALL, ["int", "int", "int", "int", "int"], 0x1D17638, Memory.allocUtf8String("sqr/a.nut").C_Object, Read.C_Object, 0x100000,0x19DAF4);
|
|
// local Str = Read.readUtf8String();
|
|
// print(Str);
|
|
|
|
// local A = IRDSQRCharacter.pushScriptFiles("a.nut");
|
|
// local Read = Memory.alloc(10000);
|
|
// print(Read);
|
|
// L_Sq_CallFunc(0x121A100, "char", FFI_MS_CDECL, ["int", "int", "int", "int", "int"], Memory.allocUtf8String("").C_Object, Memory.allocUtf8String("sqr/a.nut").C_Object, Read.C_Object, 0x100000,0x19DAF4);
|
|
// local Str = Read.readUtf8String();
|
|
// print(Str);
|
|
|
|
// L_Sq_CallFunc(0xE6E070, "int", FFI_THISCALL, ["int", "int", "int", "int"], L_sq_RA(0x1A5FB20), 79, 0, 0);
|
|
|
|
// local Old = L_sq_RA(0x1AB7CDC);
|
|
// Old = L_sq_RA(Old + 0x3038);
|
|
// local ItemObject = L_sq_GetItem(27582);
|
|
// //移除
|
|
// L_Sq_CallFunc(0x825AD0, "void", FFI_THISCALL, ["int","int"], L_sq_RA(0x1AB7CDC),Old);
|
|
// //移除Ani
|
|
// L_Sq_CallFunc(0x84CD10, "void", FFI_THISCALL, ["int","int"], L_sq_RA(0x1AB7CDC),Old);
|
|
// //穿戴
|
|
// L_Sq_CallFunc(0x825570, "void", FFI_THISCALL, ["int","int"], L_sq_RA(0x1AB7CDC),ItemObject);
|
|
|
|
// local ItemObject = L_sq_GetItem(101020037);
|
|
// // print(ItemObject);
|
|
// // L_Sq_CallFunc(0x4B0F10, "int", FFI_THISCALL, ["int"], L_sq_RA(0x1AE45B4));
|
|
// local Hs = L_Sq_CallFunc(0x779EB0, "pointer", FFI_THISCALL, ["int"], L_sq_RA(0x1AE45B4));
|
|
// print(Hs);
|
|
// Hs = L_sq_P2I(Hs);
|
|
// print(format("%02x", Hs));
|
|
// L_Sq_CallFunc(0x825AD0, "void", FFI_THISCALL, ["int","int"], Hs, ItemObject);
|
|
// L_Sq_CallFunc(0x84CD10, "void", FFI_THISCALL, ["int","int"], L_sq_RA(0x1AB7CDC), ItemObject);
|
|
// local PP = L_Sq_CallFunc(0x65DE50, "pointer", FFI_THISCALL, ["pointer"], 0xE8675E97, 0);
|
|
// print("PP: " + PP);
|
|
|
|
// local WuseAdd = L_Sq_CallFunc(0x972220, "int", FFI_MS_CDECL, ["int", "int", "int"], 27582, 0x19E990, 0);
|
|
// print("MY: " + WuseAdd);
|
|
// print(L_sq_Test());
|
|
// local Address = L_sq_Test(26058);
|
|
// print(Address);
|
|
// local Ret = L_Sq_CallFunc(0xE6E070, "int", FFI_THISCALL, ["int", "int", "int", "int"], L_sq_RA(0x1A5FB20), 275, Address, 41);
|
|
// print(Ret);
|
|
// L_Sq_CallFunc(0xF3B3B0, "int", FFI_THISCALL, ["int", "int", "int", "int", "int"], Ret, 600, 200, 28, 28);
|
|
|
|
|
|
// Rindro_Haker.LoadHook(0x11C0410, ["int", "int", "int", "int"],
|
|
// function(args) {
|
|
// // print(args[0]);
|
|
// return null;
|
|
// },
|
|
// function(args) {
|
|
// // print(args.pop());
|
|
// // print(">>>>>>");
|
|
// return null;
|
|
// });
|
|
|
|
// local Str = "{\"stringValue\":\"thisiszifuchuan\",\"numberValue\":123.45,\"integerValue\":42,\"booleanValue\":true,\"arrayValue\":[1,\"two\",true,{\"key\":\"value\"}],\"objectValue\":{\"name\":\"John Doe\",\"age\":30,\"address\":{\"street\":\"123 Main St\",\"city\":\"Anytown\",\"state\":\"CA\",\"zip\":\"12345\"}}}";
|
|
// print("***********************");
|
|
// print(Str);
|
|
// print(Str.len());
|
|
// local JsonObj = JSONParser();
|
|
// local T = JsonObj.parse(Str);
|
|
// print(">>>>>>>>>>>>>>");
|
|
// print(T);
|
|
// print(">>>>>>>>>>>>>>");
|
|
// local Str2 = Json.Encode(T);
|
|
// print("***********************");
|
|
// print(Str2);
|
|
// print(Str2.len()); |