132 lines
4.7 KiB
Plaintext
132 lines
4.7 KiB
Plaintext
/*
|
|
文件名:TransformEqu.nut
|
|
路径:Project/OddsPlugins/TransformEqu.nut
|
|
创建日期:2025-01-17 21:03
|
|
文件用途:变换装备
|
|
*/
|
|
class TransformEquC extends LenheartNewUI_Windows {
|
|
//调试模式
|
|
// DeBugMode = true;
|
|
|
|
//不是窗口
|
|
// NoWindow = true;
|
|
|
|
//是否可见
|
|
// Visible = false;
|
|
|
|
//属性记录表
|
|
Attributes = null;
|
|
//播报内容数组
|
|
BroadcastContent = null;
|
|
//是否需要绘制
|
|
DrawFlag = false;
|
|
|
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
|
Childrens = [];
|
|
Attributes = array(7, null);
|
|
BroadcastContent = {};
|
|
//注册控件
|
|
RegisterWidget();
|
|
|
|
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
|
|
|
RetrieveAndRecordAttributes(1);
|
|
|
|
Pack_Control.rawset(20072602, RetrieveAndRecordAttributes.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 RetrieveAndRecordAttributes(Chunk) {
|
|
//记录四维 力量 智力 体力 精神
|
|
local AttributesBuffer = [];
|
|
AttributesBuffer.append(L_sq_GetCharacterAttribute(0x2364));
|
|
AttributesBuffer.append(L_sq_GetCharacterAttribute(0x2394));
|
|
AttributesBuffer.append(L_sq_GetCharacterAttribute(0x237c));
|
|
AttributesBuffer.append(L_sq_GetCharacterAttribute(0x23ac));
|
|
|
|
local ObjectAddress = L_sq_RA(0x1AB7CDC);
|
|
local Wg = (MemoryTool.DecodeMemoryData(ObjectAddress + 0x1E54) * (AttributesBuffer[0].tofloat() * 0.004 + 1)).tointeger() + MemoryTool.DecodeMemoryData(ObjectAddress + 0x1EB4);
|
|
AttributesBuffer.append(Wg);
|
|
local Mg = (MemoryTool.DecodeMemoryData(ObjectAddress + 0x1E84) * (AttributesBuffer[1].tofloat() * 0.004 + 1)).tointeger() + MemoryTool.DecodeMemoryData(ObjectAddress + 0x1ED8);
|
|
AttributesBuffer.append(Mg);
|
|
local Dl = MemoryTool.DecodeMemoryData(ObjectAddress + 0x22C8) + MemoryTool.DecodeMemoryData(ObjectAddress + 0x22F8);
|
|
AttributesBuffer.append(Dl);
|
|
|
|
for (local i = 0; i< AttributesBuffer.len(); i++) {
|
|
if (AttributesBuffer[i] != Attributes[i]) {
|
|
if (Attributes[i] != null) {
|
|
BroadcastContent.rawset(i, AttributesBuffer[i] - Attributes[i]);
|
|
DrawFlag = Clock();
|
|
}
|
|
Attributes[i] = AttributesBuffer[i];
|
|
}
|
|
}
|
|
}
|
|
|
|
//绘制主界面
|
|
function DrawMain(obj) {
|
|
|
|
if (DrawFlag) {
|
|
if (sq_GetCurrentModuleType() == 3) {
|
|
local Xpos = sq_GetScreenXPos(obj) - 45;
|
|
local Ypos = sq_GetScreenYPos(obj) - 128;
|
|
|
|
setClip(Xpos, Ypos - 40, Xpos + 150, Ypos + 80); //开始裁切
|
|
local Time = Clock() - DrawFlag;
|
|
local pos = 0;
|
|
foreach(Index, Value in BroadcastContent) {
|
|
local RealAtt = "";
|
|
if (Index == 0) RealAtt = "力量";
|
|
if (Index == 1) RealAtt = "智力";
|
|
if (Index == 2) RealAtt = "体力";
|
|
if (Index == 3) RealAtt = "精神";
|
|
if (Index == 4) RealAtt = "物理攻击力";
|
|
if (Index == 5) RealAtt = "魔法攻击力";
|
|
if (Index == 6) RealAtt = "独立攻击力";
|
|
local Color = [65, 255, 78];
|
|
if (Value< 0) Color = [255, 50, 50];
|
|
local Ap = 250 - ((BroadcastContent.len() - pos) * Time * 0.05).tointeger();
|
|
if (Ap< 0) Ap = 0;
|
|
L_sq_DrawCode(RealAtt + " " + (Value > 0 ? "+ " : "- ") + (abs(Value)), Xpos, Ypos + (pos * 16) - (Time * 0.05), sq_RGBA(Color[0], Color[1], Color[2], Ap), 0, 1);
|
|
pos++;
|
|
}
|
|
releaseClip(); //裁切结束
|
|
}
|
|
}
|
|
}
|
|
|
|
function Show(obj) {
|
|
DrawMain(obj);
|
|
LenheartNewUI_Windows.Show(obj);
|
|
|
|
}
|
|
|
|
//逻辑入口
|
|
function Proc(obj) {
|
|
LenheartNewUI_Windows.SyncPos(X, Y);
|
|
}
|
|
|
|
}
|
|
getroottable().rawdelete("TransformEqu_Obj");
|
|
|
|
function Lenheart_TransformEqu_Fun(obj) {
|
|
local RootTab = getroottable();
|
|
if (!RootTab.rawin("TransformEqu_Obj")) {
|
|
RootTab.rawset("TransformEqu_Obj", true);
|
|
LenheartNewUI_CreateWindow(TransformEquC, "变换装备飘小字", 0, 0, 0, 0, 0);
|
|
}
|
|
}
|
|
|
|
getroottable()["LenheartFuncTab"].rawset("TransformEquFuncN", Lenheart_TransformEqu_Fun); |