Sqr/Plugins/100UI/100UI.nut

1108 lines
37 KiB
Plaintext

/*
文件名:100UI.nut
路径:Plugins/100UI/100UI.nut
创建日期:2023-11-01 20:56
文件用途:
*/
function Lenheart_100UI_DrawHPMP(obj) {
//我的异常
local HPRGBA = {
R = 255,
G = 0,
B = 0,
A = 250,
};
local MPRGBA = {
R = 0,
G = 0,
B = 255,
A = 250
};
local HPK = 212;
local HPB = 1;
local MPK = 213;
local MPB = 2;
//中毒
if (sq_IsValidActiveStatus(obj, ACTIVESTATUS_POISON)) {
HPRGBA = {
R = 128,
G = 0,
B = 128,
A = 250
};
HPK = 214;
HPB = 20;
}
if (sq_IsRidingObject(obj)) {
HPRGBA = {
R = 255,
G = 128,
B = 0,
A = 250
};
MPRGBA = {
R = 255,
G = 128,
B = 0,
A = 250
};
HPK = 215;
HPB = 64;
MPK = 215;
MPB = 64;
local objectManager = obj.getObjectManager();
if (objectManager) {
local CollisionObjectNumber = objectManager.getCollisionObjectNumber();
for (local i = 0; i< CollisionObjectNumber; i += 1) {
local object = objectManager.getCollisionObject(i);
local Address = L_Sq_GetObjectAddress(object);
if (Address == L_Sq_GetRidingObjectAddress(obj)) {
local activeObj = sq_GetCNRDObjectToActiveObject(object);
getroottable()["Lenheart100UIMyRidingObject"] <- activeObj;
}
}
}
} else {
getroottable().rawdelete("Lenheart100UIMyRidingObject");
}
local Gobj = obj;
if (sq_IsRidingObject(obj) && getroottable().rawin("Lenheart100UIMyRidingObject")) Gobj = getroottable().Lenheart100UIMyRidingObject;
// local Str = "生命值: " + Gobj.getHp() + "/" + Gobj.getHpMax();
//生命值比例
local HpRate = (Gobj.getHp().tofloat() / Gobj.getHpMax().tofloat());
//生命值损失数组
if (!("Lenheart_100UI_HpDamageArr" in getroottable())) {
getroottable().Lenheart_100UI_HpDamageArr <- [];
}
//生命值损失标志
if (!("Lenheart_100UI_HpDamageRateFlag" in getroottable())) {
getroottable().Lenheart_100UI_HpDamageRateFlag <- HpRate;
}
//Push
if (getroottable().Lenheart_100UI_HpDamageRateFlag != HpRate && (abs((getroottable().Lenheart_100UI_HpDamageRateFlag * 1000.0 - HpRate * 1000.0)) >= 10)) {
local MaxHpDamgeArrLen = 100;
if (getroottable().Lenheart_100UI_HpDamageArr.len()< MaxHpDamgeArrLen) {
local T = {
OldHpRate = getroottable().Lenheart_100UI_HpDamageRateFlag,
NowHpRate = HpRate,
Time = Clock(),
}
getroottable().Lenheart_100UI_HpDamageArr.append(T);
if (!("Lenheart_100UI_HpDamageEff" in getroottable())) {
getroottable().Lenheart_100UI_HpDamageEff <- {
OldHpRate = getroottable().Lenheart_100UI_HpDamageRateFlag,
Time = Clock(),
};
}
}
}
getroottable().Lenheart_100UI_HpDamageRateFlag <- HpRate;
if ("Lenheart_100UI_HpDamageEff" in getroottable()) {
local ValueHpBack = getroottable().Lenheart_100UI_HpDamageEff;
local DstTime = Clock() - ValueHpBack.Time;
local HpOffset = 534 + (63 * (1.0 - ValueHpBack.OldHpRate)).tointeger();
if (DstTime > 500) {
HpOffset = sq_GetUniformVelocity(534 + (63 * (1.0 - ValueHpBack.OldHpRate)).tointeger(), 534 + (63 * (1.0 - HpRate)).tointeger(), DstTime - 500, 500);
}
setClip(222, HpOffset, 222 + 64, 534 + (63 * (1.0 - HpRate)).tointeger()); //开始裁切
local HpAni = BasicsDrawTool.T_DrawDynamicAni(obj, "ui/hud/lenheartnew/hpmp_vessel.ani", 222 - 45, 534 + 31, "ui/hud/lenheartnew/hpmp_vesselHp");
HpAni.setRGBA(HPRGBA.R, HPRGBA.G, HPRGBA.B, HPRGBA.A);
releaseClip(); //裁切结束
if (DstTime > 1000) {
getroottable().rawdelete("Lenheart_100UI_HpDamageEff");
}
}
foreach(Pos, Value in getroottable().Lenheart_100UI_HpDamageArr) {
local DstTime = Clock() - Value.Time;
if (DstTime <= 1000) {
if (DstTime <= 500) {
local HP_Eff_Alpha = sq_GetUniformVelocity(250, 0, DstTime, 500);
setClip(222, 534 + (63 * (1.0 - Value.OldHpRate)).tointeger(), 222 + 64, 534 + (63 * (1.0 - Value.NowHpRate)).tointeger()); //开始裁切
L_sq_DrawImg("interface2/hud/hud.img", 36, 226, 536, 0, sq_RGBA(255, 255, 255, HP_Eff_Alpha), 1.0, 1.0);
releaseClip(); //裁切结束
}
} else {
getroottable().Lenheart_100UI_HpDamageArr.remove(Pos);
}
}
//血球绘制逻辑
setClip(222, 534 + (63 * (1.0 - HpRate)).tointeger(), 222 + 64, 534 + 63); //开始裁切
L_sq_DrawImg("interface2/hud/hud.img", HPB, 226, 536);
local HpAni = BasicsDrawTool.T_DrawDynamicAni(obj, "ui/hud/lenheartnew/hpmp_vessel.ani", 222 - 45, 534 + 31, "ui/hud/lenheartnew/hpmp_vesselHp");
HpAni.setRGBA(HPRGBA.R, HPRGBA.G, HPRGBA.B, HPRGBA.A);
releaseClip(); //裁切结束
//悬停逻辑
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 222, 534, 64, 63)) {
local T = {
X = IMouse.GetXPos(),
Y = IMouse.GetYPos(),
}
getroottable().rawset("Lenheart100UIHPSTR", T);
} else {
getroottable().rawdelete("Lenheart100UIHPSTR");
}
//血槽外框逻辑
L_sq_DrawImg("interface2/hud/hud.img", HPK, 222, 534);
//魔法值比例
local MpRate = (Gobj.getMp().tofloat() / Gobj.getMpMax().tofloat());
//生命值损失数组
if (!("Lenheart_100UI_MpDamageArr" in getroottable())) {
getroottable().Lenheart_100UI_MpDamageArr <- [];
}
//生命值损失标志
if (!("Lenheart_100UI_MpDamageRateFlag" in getroottable())) {
getroottable().Lenheart_100UI_MpDamageRateFlag <- MpRate;
}
//Push
if (getroottable().Lenheart_100UI_MpDamageRateFlag != MpRate && (abs((getroottable().Lenheart_100UI_MpDamageRateFlag * 1000.0 - MpRate * 1000.0)) >= 10)) {
local MaxMpDamgeArrLen = 100;
if (getroottable().Lenheart_100UI_MpDamageArr.len()< MaxMpDamgeArrLen) {
local T = {
OldMpRate = getroottable().Lenheart_100UI_MpDamageRateFlag,
NowMpRate = MpRate,
Time = Clock(),
}
getroottable().Lenheart_100UI_MpDamageArr.append(T);
if (!("Lenheart_100UI_MpDamageEff" in getroottable())) {
getroottable().Lenheart_100UI_MpDamageEff <- {
OldMpRate = getroottable().Lenheart_100UI_MpDamageRateFlag,
Time = Clock(),
};
}
}
}
getroottable().Lenheart_100UI_MpDamageRateFlag <- MpRate;
if ("Lenheart_100UI_MpDamageEff" in getroottable()) {
local ValueMpBack = getroottable().Lenheart_100UI_MpDamageEff;
local DstTime = Clock() - ValueMpBack.Time;
local MpOffset = 534 + (63 * (1.0 - ValueMpBack.OldMpRate)).tointeger();
if (DstTime > 500) {
MpOffset = sq_GetUniformVelocity(534 + (63 * (1.0 - ValueMpBack.OldMpRate)).tointeger(), 534 + (63 * (1.0 - MpRate)).tointeger(), DstTime - 500, 500);
}
setClip(514, MpOffset, 514 + 64, 534 + (63 * (1.0 - MpRate)).tointeger()); //开始裁切
local MpAni = BasicsDrawTool.T_DrawDynamicAni(obj, "ui/hud/lenheartnew/hpmp_vessel.ani", 514 - 45, 534 + 31, "ui/hud/lenheartnew/Mpmp_vesselMp");
MpAni.setRGBA(MPRGBA.R, MPRGBA.G, MPRGBA.B, MPRGBA.A);
releaseClip(); //裁切结束
if (DstTime > 1000) {
getroottable().rawdelete("Lenheart_100UI_MpDamageEff");
}
}
foreach(Pos, Value in getroottable().Lenheart_100UI_MpDamageArr) {
local DstTime = Clock() - Value.Time;
if (DstTime <= 1000) {
if (DstTime <= 500) {
local Mp_Eff_Alpha = sq_GetUniformVelocity(250, 0, DstTime, 500);
setClip(514, 534 + (63 * (1.0 - Value.OldMpRate)).tointeger(), 514 + 64, 534 + (63 * (1.0 - Value.NowMpRate)).tointeger()); //开始裁切
L_sq_DrawImg("interface2/hud/hud.img", 36, 518, 536, 0, sq_RGBA(255, 255, 255, Mp_Eff_Alpha), 1.0, 1.0);
releaseClip(); //裁切结束
}
} else {
getroottable().Lenheart_100UI_MpDamageArr.remove(Pos);
}
}
//蓝球绘制逻辑
setClip(518, 534 + (63 * (1.0 - MpRate)).tointeger(), 518 + 64, 534 + 63); //开始裁切
L_sq_DrawImg("interface2/hud/hud.img", MPB, 518, 536);
local MpAni = BasicsDrawTool.T_DrawDynamicAni(obj, "ui/hud/lenheartnew/hpmp_vessel.ani", 514 - 45, 534 + 31, "ui/hud/lenheartnew/hpmp_vesselMp");
MpAni.setRGBA(MPRGBA.R, MPRGBA.G, MPRGBA.B, MPRGBA.A);
releaseClip(); //裁切结束
//悬停逻辑
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 514, 534, 64, 63)) {
local T = {
X = IMouse.GetXPos(),
Y = IMouse.GetYPos(),
}
getroottable().rawset("Lenheart100UIMPSTR", T);
} else {
getroottable().rawdelete("Lenheart100UIMPSTR");
}
//血槽外框逻辑
L_sq_DrawImg("interface2/hud/hud.img", MPK, 514, 534);
}
function Lenheart_100UI_Event_BackGround() {
if (getroottable().rawin("LenheartEventOffset") && getroottable()["LenheartEventOffset"] == 519) {
local Yl = 0;
if (getroottable().rawin("YosinEventSystem")) {
local Count = (getroottable().YosinEventSystem.len() + (L_sq_RA(L_sq_RA(0x1A39C2C) + 0x6c)));
if (Count > 8) Count = 8;
Yl = Count * 20;
} else {
local Count = (L_sq_RA(L_sq_RA(0x1A39C2C) + 0x6c));
if (Count > 8) Count = 8;
Yl = Count * 20;
}
local YAd = 0;
if (getroottable().rawin("YosinEventSystem")) {
local Count = (getroottable().YosinEventSystem.len() + (L_sq_RA(L_sq_RA(0x1A39C2C) + 0x6c))) / 9;
YAd = Count * 20;
} else {
local Count = (L_sq_RA(L_sq_RA(0x1A39C2C) + 0x6c)) / 9;
YAd = Count * 20;
}
L_sq_DrawWindow(595, 514 - YAd, Yl - 1, YAd, "interface2/hud/hudbox.img", 0, 22, 20, 7, 21);
}
}
function Lenheart_100UI(obj) {
//血球篮球
Lenheart_100UI_DrawHPMP(obj);
L_sq_DrawImg("interface2/hud/hud.img", 202, 176, 582);
//传送
TownMove(obj);
//等级和sp点
{
local ChrLevel = L_Sq_GetObjectLevel(obj);
local ChrSp = L_sq_GetSp();
L_sq_DrawCode("Lv." + ChrLevel.tostring(), 222 - (LenheartTextClass.GetStringLength("Lv." + ChrLevel.tostring()) / 2), 587, sq_RGBA(230, 200, 155, 255), 1, 1);
L_sq_DrawCode(ChrSp.tostring(), 574 - (LenheartTextClass.GetStringLength(ChrSp.tostring()) / 2), 587, sq_RGBA(230, 200, 155, 255), 1, 1);
}
//经验条
{
local NowExp = L_sq_GetExp(1);
local MaxExp = L_sq_GetExp(0);
local ExpRate = (NowExp.tofloat() / MaxExp.tofloat()).tofloat();
if (L_Sq_GetObjectLevel(obj) == 100) {
L_sq_DrawImg("interface2/hud/hud.img", 60, 250, 595);
} else {
setClip(250, 595, 248 + (300.0 * ExpRate).tointeger(), 596 + 4); //开始裁切
L_sq_DrawImg("interface2/hud/hud.img", 4, 250, 595);
releaseClip(); //裁切结束
}
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 250, 595, 300, 4)) {
local T = {
X = IMouse.GetXPos(),
Y = IMouse.GetYPos(),
}
getroottable().rawset("Lenheart100UIEXPSTR", T);
} else {
getroottable().rawdelete("Lenheart100UIEXPSTR");
}
}
//铃铛按钮
local RefreshButton = LenheartTabbars(596, 554, 27, 27);
RefreshButton.SetFrame("interface2/HUD/HUD.img", 204);
RefreshButton.Show();
if (RefreshButton.isLBActive()) {
if (getroottable().rawin("MouseObject")) {
if (!getroottable().rawin("LenheartEventOffset") || getroottable()["LenheartEventOffset"] == 900) {
getroottable()["LenheartEventOffset"] <- 519
getroottable()["YosinEventIconInfoYpos"] <- 519
} else {
getroottable()["LenheartEventOffset"] <- 900
getroottable()["YosinEventIconInfoYpos"] <- 900
}
L_sq_RefreshEventIcon();
}
}
BasicsDrawTool.T_DrawDynamicAni(obj, "ui/hud/animation2/informationnoti_alarm00.ani", 601, 558 + (RefreshButton.isLBDown() ? 1 : 0), "铃铛晃动动画");
L_sq_DrawImg("interface2/hud/hulun.img", 5, 611, 552 + (RefreshButton.isLBDown() ? 1 : 0));
// print(L_sq_GetPassLevel());
//冒险团
local PassPartyButton = LenheartTabbars(577, 555, 21, 23);
PassPartyButton.SetFrame("interface2/hud/advhud.img", 2);
PassPartyButton.Show();
L_sq_DrawCode(L_sq_GetPassLevel().tostring(), 588 - (LenheartTextClass.GetStringLength(L_sq_GetPassLevel().tostring())) / 2, 561 + (PassPartyButton.isLBDown() ? 1 : 0), 0xFFFFFFFF, 1, 1);
if (PassPartyButton.isLBActive()) {
L_NewWindows("Lenheart", 33, 0x65535);
}
//拍卖行
local AuctionButton = LenheartTabbars(780, 553, 21, 23);
AuctionButton.SetFrame("interface2/hud/hud.img", 17);
AuctionButton.Show();
if (AuctionButton.isLBActive()) {
getroottable().IsLenheart_100UI_AuctionState <- true;
}
if ("IsLenheart_100UI_AuctionState" in getroottable()) {
L_sq_DrawWindow(684, 490, 96, 40, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
local AButton = LenheartTabbars(690, 495, 108, 21);
AButton.SetFrame("interface2/global_navigation/extrafeature/extrafeature_cn.img", 0);
AButton.Show();
if (AButton.isLBActive()) {
L_sq_Open_ExWindow(0x1ADE090, 13, 0, 1);
}
local BButton = LenheartTabbars(690, 495 + 26, 108, 21);
BButton.SetFrame("interface2/global_navigation/extrafeature/extrafeature_cn.img", 4);
BButton.Show();
if (BButton.isLBActive()) {
L_sq_Open_ExWindow(0x1ADE090, 14, 0, 1);
}
if (getroottable().rawin("MouseObject")) {
local Mobj = getroottable()["MouseObject"];
if (Mobj.LbEvent && !AuctionButton.isInRect()) {
getroottable().rawdelete("IsLenheart_100UI_AuctionState");
}
}
}
}
function Lenheart_100UITop(obj) {
// Lenheart_100UI_DrawSkillAddSystem(obj);
//悬停层绘制
{
if (getroottable().rawin("Lenheart100UIEXPSTR")) {
if (L_Sq_GetObjectLevel(obj) == 100) {
L_sq_DrawWindow(IMouse.GetXPos() - 150, IMouse.GetYPos() - 36, 144, 12, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
L_sq_DrawCode("已满级!等待服务器开启转生!", IMouse.GetXPos() - 142, IMouse.GetYPos() - 24, 0xFFFFFFFF, 1, 1);
} else {
local Str = "当前经验值: " + L_sq_GetExp(1) + " 总经验值: " + L_sq_GetExp(0);
L_sq_DrawWindow(IMouse.GetXPos() - 150, IMouse.GetYPos() - 36, 144 + LenheartTextClass.GetStringLength(L_sq_GetExp(1).tostring() + L_sq_GetExp(0).tostring()), 12, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
L_sq_DrawCode(Str, IMouse.GetXPos() - 140, IMouse.GetYPos() - 24, 0xFFFFFFFF, 1, 1);
}
}
if (getroottable().rawin("Lenheart100UIHPSTR")) {
local Gobj = obj;
if (sq_IsRidingObject(obj) && getroottable().rawin("Lenheart100UIMyRidingObject")) Gobj = getroottable().Lenheart100UIMyRidingObject;
local Str = "生命值: " + Gobj.getHp() + "/" + Gobj.getHpMax();
L_sq_DrawWindow(IMouse.GetXPos() - 140 + LenheartTextClass.GetStringLength(Str) / 2, IMouse.GetYPos() - 36, 0 + LenheartTextClass.GetStringLength(Str), 12, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
L_sq_DrawCode(Str, IMouse.GetXPos() - 126 + LenheartTextClass.GetStringLength(Str) / 2, IMouse.GetYPos() - 24, 0xFFFFFFFF, 1, 1);
}
if (getroottable().rawin("Lenheart100UIMPSTR")) {
local Gobj = obj;
if (sq_IsRidingObject(obj) && getroottable().rawin("Lenheart100UIMyRidingObject")) Gobj = getroottable().Lenheart100UIMyRidingObject;
local Str = "魔法值: " + Gobj.getMp() + "/" + Gobj.getMpMax();
L_sq_DrawWindow(IMouse.GetXPos() - 140 + LenheartTextClass.GetStringLength(Str) / 2, IMouse.GetYPos() - 36, 0 + LenheartTextClass.GetStringLength(Str), 12, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
L_sq_DrawCode(Str, IMouse.GetXPos() - 126 + LenheartTextClass.GetStringLength(Str) / 2, IMouse.GetYPos() - 24, 0xFFFFFFFF, 1, 1);
}
}
}
function Sq_Get_Event_Pos(a) {
if (getroottable().rawin("LenheartEventOffset"))
return getroottable()["LenheartEventOffset"];
else {
getroottable()["LenheartEventOffset"] <- 519
getroottable()["YosinEventIconInfoYpos"] <- 519
return getroottable()["LenheartEventOffset"];
}
}
if (getroottable().rawin("LenheartBaseFuncTab")) {
getroottable()["LenheartBaseFuncTab"].rawset("100UI_LenheartFunc", Lenheart_100UITop);
} else {
local T = {};
T.rawset("100UI_LenheartFunc", Lenheart_100UITop);
getroottable().rawset("LenheartBaseFuncTab", T);
}
function Lenheart_UI_MiniMap_CallBack(Chunk) {
// print(Chunk);
local Jso = Json.Decode(Chunk);
getroottable().Lenheart_UI_MiniMap_Info <- Jso;
}
Pack_Control.rawset(30008008, Lenheart_UI_MiniMap_CallBack);
function Sq_DrawMiniMapUI(obj) {
local obj = sq_GetMyMasterCharacter();
if (!obj) return;
//没拿过信息拿一次
if (!("Lenheart_UI_MiniMap_OpenPack" in getroottable())) {
local T = {
op = 20231010,
realop = 30008008,
Type = 3,
}
BasicsDrawTool.SendPack(T);
getroottable().Lenheart_UI_MiniMap_OpenPack <- true;
}
L_sq_DrawImg("interface/minimap_minimap_town.img", 8, 131, 7);
if ("Lenheart_UI_MiniMap_Info" in getroottable()) {
local Id = 0;
if ("Lenheart_UI_MiniMap_Info_NowId" in getroottable()) Id = getroottable().Lenheart_UI_MiniMap_Info_NowId;
L_sq_DrawCode(getroottable().Lenheart_UI_MiniMap_Info.regionInfo[Id].Name, 135, 10, 0xFFFFFFFF, 1, 1);
}
//遮挡原生按钮
if ((getroottable().rawin("Lenheart_MiniMapWindow"))) {
getroottable().Lenheart_MiniMapWindow.Show(obj);
} else {
getroottable().Lenheart_MiniMapWindow <- LenheartWindow(230, 0, 30, 30, 0); //坐标 大小 标题栏高度
}
//绘制自己三角
local AButton = LenheartTabbars(237, 8, 108, 21);
AButton.SetFrame("interface/windowcommon.img", 59);
AButton.Show();
if (AButton.isLBActive()) {
getroottable().Lenheart_UI_MiniMap_Open <- true;
}
if (!("Lenheart_UI_MiniMap_Open" in getroottable())) {
//关闭遮挡
if ((getroottable().rawin("Lenheart_MiniMapSelectWindow"))) {
if (getroottable().Lenheart_MiniMapSelectWindow.YMouseSw == false) {
IMouse.ReleaseMouseClick();
getroottable().Lenheart_MiniMapSelectWindow.YMouseSw = true;
L_sq_WA(0x1b46898, 0);
getroottable().rawdelete("Lenheart_MiniMapSelectWindow");
}
}
}
//判断三角打开
else {
if ("Lenheart_UI_MiniMap_Info" in getroottable()) {
//遮挡下面地图不让点
if ((getroottable().rawin("Lenheart_MiniMapSelectWindow"))) {
getroottable().Lenheart_MiniMapSelectWindow.Show(obj);
} else {
getroottable().Lenheart_MiniMapSelectWindow <- LenheartWindow(0, 30, 800, 600, 0); //坐标 大小 标题栏高度
}
local Info = getroottable().Lenheart_UI_MiniMap_Info;
local SFxuanting = false;
foreach(Pos, Value in Info.regionInfo) {
L_sq_DrawImg("interface/minimap_minimap_town.img", 9, 131, 25 + (Pos * 18));
// L_sq_DrawWindow(128, 24 + (Pos * 18), 108, 10, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
L_sq_DrawCode(Value.Name, 135, 28 + (Pos * 18), 0xFFFFFFFF, 1, 1);
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 131, 25 + (Pos * 18), 108, 10)) {
SFxuanting = true;
L_sq_SetDrawImgModel(2, 0);
L_sq_DrawImg("interface/minimap_minimap_town.img", 16, 131, 25 + (Pos * 18));
L_sq_ReleaseDrawImgModel();
if (getroottable().rawin("MouseObject")) {
if (getroottable()["MouseObject"].LbEvent) {
getroottable().rawdelete("Lenheart_UI_MiniMap_Open");
L_sq_Select_MiniMap_Index(Value.Id);
getroottable().Lenheart_UI_MiniMap_Info_NowId <- Pos;
break;
// getroottable().Lenheart_UI_MiniMap_Open <- false;
}
}
}
}
}
}
}
class Lenheart_100UI_DrawSkillAddClassC extends BasicsDrawTool {
Mobj = null;
//技能信息
MySkillInfoTable = null;
//技能按键数组
//拓展技能格子
Add_Ex_Slot1 = null;
Add_Ex_Slot1_Key = null;
Add_Ex_Slot2 = null;
Add_Ex_Slot2_Key = null;
//格子大小
Rate = 0.75;
//悬停特效
TopEffectobj = null;
ExTopEffectobj = null;
//点击信息
ClickInfoobj = null;
//我的原生快捷栏技能Map
QuickSkillList = null;
//我的可设置快捷技能键技能Map
SettingSkillList = null;
//设置技能键位Buffer
SettingKeyCodeBuffer = null;
function GetSkillInfoCallBack(Chunk) {
local Jso = Json.Decode(Chunk);
// Sout("收到包内容: %L", Chunk);
local Index = 0;
foreach(Pos, Value in Jso.regionInfo) {
//Vlaue是每一个技能的对象
if (Value.type == "[active]\r") {
MySkillInfoTable[Value.Id] <- Jso.regionInfo[Index];
}
Index++;
}
}
function GetSkillInfo() {
local obj = sq_GetMyMasterCharacter();
for (local z = 0; z< 26; z++) {
local SkillIdList = [];
for (local i = 0; i< 10; i++) {
SkillIdList.append(i + (z * 10));
}
local T = {
op = 20231010,
realop = 80000002,
Type = 4,
SkillId = SkillIdList,
Job = sq_getJob(obj),
NeedLable = ["type", "Icon", "command", "name", "Id"],
}
// local pack = L_sq_EncondeJson(T);
// L_sq_SendPackType(130);
// L_sq_SendPackWChar(pack);
// L_sq_SendPack();
}
}
function HookInput(Code) {
if (ExTopEffectobj) {
if ("ClickFlag" in ExTopEffectobj) {
SettingKeyCodeBuffer = Code;
}
}
}
constructor() {
MySkillInfoTable = {};
if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
RegisterInputHook("Lenheart_100_UI_Key_Register", HookInput.bindenv(this));
Pack_Control.rawset(80000002, GetSkillInfoCallBack.bindenv(this));
GetSkillInfo();
}
function DrawOneSlot(x, y) {
L_sq_DrawImg("interface/Lenheartwindowcommon.img", 57, x, y, 0, sq_RGBA(255, 255, 255, 250), Rate, Rate);
}
function DrawOneSkill(obj, Idx, x, y) {
local ImgArr = split(MySkillInfoTable[Idx].Icon[0], "\r");
L_sq_DrawImg(ImgArr[0], ImgArr[1].tointeger(), x, y, 0, sq_RGBA(255, 255, 255, 250), Rate, Rate);
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, x, y, (28 * Rate).tointeger(), (28 * Rate).tointeger())) {
local T = {
X = x,
Y = y
}
TopEffectobj = T;
if (Mobj.Lb == 1) {
TopEffectobj = null;
if (!ClickInfoobj) ClickInfoobj = Idx;
}
}
}
function DrawTopEffect(obj) {
if (TopEffectobj) {
L_sq_SetDrawImgModel(2, 0);
L_sq_DrawImg("interface/Lenheartwindowcommon.img", 353, TopEffectobj.X - 1, TopEffectobj.Y - 1, 0, sq_RGBA(255, 255, 255, 250), Rate, Rate);
L_sq_ReleaseDrawImgModel();
}
}
function DrawExTopEffect(obj) {
if (ExTopEffectobj) {
L_sq_SetDrawImgModel(2, 0);
L_sq_DrawImg("interface/Lenheartwindowcommon.img", 353, ExTopEffectobj.X - 1, ExTopEffectobj.Y - 1, 0, sq_RGBA(255, 255, 255, 250), 1.0, 1.0);
L_sq_ReleaseDrawImgModel();
//绘制设置说明
if (!MainState) {
local width = 200;
local QuestTipsStr = "保持按住鼠标右键,以设置技能快捷键。";
local Color = 0xFFFFFFFF;
if ("ClickFlag" in ExTopEffectobj) {
QuestTipsStr = "请按下要设定的键盘快捷键,注意不要冲突。";
width = 220;
Color = sq_RGBA(255, 242, 0, 250);
}
L_sq_DrawWindow(ExTopEffectobj.X - 100, ExTopEffectobj.Y - 30, width, 10, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
L_sq_DrawCode(QuestTipsStr, ExTopEffectobj.X - 94, ExTopEffectobj.Y - 25, Color, 1, 1);
}
}
}
function DrawClickSkill(obj) {
if (ClickInfoobj != null) {
local ImgArr = split(MySkillInfoTable[ClickInfoobj].Icon[0], "\r");
L_sq_DrawImg(ImgArr[0], ImgArr[1].tointeger(), IMouse.GetXPos() - 14, IMouse.GetYPos() - 14, 0, sq_RGBA(255, 255, 255, 250), 1.0, 1.0);
}
}
function DrawSlot(obj) {
for (local i = 0; i< 40; i++) {
DrawOneSlot((X + (30 * Rate) * (i % 10)).tointeger(), Y + ((30 * Rate) * (i / 10)).tointeger());
}
}
function DrawSkill(obj) {
// for (local i = 0; i< 40; i++) {
// DrawOneSkill(obj, i * 2, (X + (30 * Rate) * (i % 10)).tointeger(), Y + ((30 * Rate) * (i / 10)).tointeger());
// }
local i = 0;
foreach(Key, Value in SettingSkillList) {
DrawOneSkill(obj, Key, (X + (30 * Rate) * (i % 10)).tointeger(), Y + ((30 * Rate) * (i / 10)).tointeger());
i++;
}
//如果松手 选中技能清空
if (Mobj.Lb == 0) {
ClickInfoobj = null;
}
}
//检查我有什么技能
function CheckMySkill(obj) {
if (QuickSkillList) return;
QuickSkillList = {};
SettingSkillList = {};
//我的技能管理器
local SkillMgr = obj.getSkillManager();
if (!SkillMgr) return;
//遍历技能
for (local i = 1; i< 255; i++) {
local SoltIndex = SkillMgr.getQuickSlotNumber(i);
//在快捷技能栏槽上
if ((SoltIndex >= 0 && SoltIndex <= 6) || (SoltIndex >= 198 && SoltIndex <= 203)) {
QuickSkillList[i] <- true;
}
}
for (local i = 0; i< 255; i++) {
local Skl = sq_GetSkill(obj, i);
if (Skl) {
if (sq_GetSkillLevel(obj, i) > 0 && MySkillInfoTable.rawin(i) && !(QuickSkillList.rawin(i))) {
SettingSkillList[i] <- true;
}
}
}
}
function DrawAddExSkill(obj) {
L_sq_DrawImg("interface/Lenheartwindowcommon.img", 57, 485, 532);
L_sq_DrawImg("interface/Lenheartwindowcommon.img", 57, 485, 564);
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 485, 532, 30, 30)) {
local T = {
X = 485,
Y = 534
}
ExTopEffectobj = T;
//如果松手 选中技能清空
if (Mobj.Lb == 0 && ClickInfoobj != null) {
Add_Ex_Slot1 = ClickInfoobj;
ClickInfoobj = null;
}
if (Mobj.Rb == 1) {
ExTopEffectobj.ClickFlag <- true;
if (SettingKeyCodeBuffer) {
Add_Ex_Slot1_Key = SettingKeyCodeBuffer;
}
} else {
SettingKeyCodeBuffer = null;
}
}
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 485, 564, 30, 30)) {
local T = {
X = 485,
Y = 566
}
ExTopEffectobj = T;
//如果松手 选中技能清空
if (Mobj.Lb == 0 && ClickInfoobj != null) {
Add_Ex_Slot2 = ClickInfoobj;
ClickInfoobj = null;
}
if (Mobj.Rb == 1) {
ExTopEffectobj.ClickFlag <- true;
if (SettingKeyCodeBuffer) {
Add_Ex_Slot2_Key = SettingKeyCodeBuffer;
}
} else {
SettingKeyCodeBuffer = null;
}
}
//绘制技能图标
if (Add_Ex_Slot1) {
local ImgArr = split(MySkillInfoTable[Add_Ex_Slot1].Icon[0], "\r");
L_sq_DrawImg(ImgArr[0], ImgArr[1].tointeger(), 485, 534, 0, sq_RGBA(255, 255, 255, 250), 1.0, 1.0);
local skl = sq_GetSkill(obj, Add_Ex_Slot1);
if (skl.isInCoolTime()) {
//这里是总冷却时间
local cooltime = skl.getCoolTime(obj, -1);
local Rate = sq_GetUniformVelocity(30, 0, (Clock() - Add_Ex_Slot1_Use_Time), cooltime);
setClip(485, 532, 485 + 30, 532 + Rate); //开始裁切
L_sq_DrawImg("interface/Lenheartwindowcommon.img", 57, 485, 532);
releaseClip(); //裁切结束
}
}
if (Add_Ex_Slot2) {
local ImgArr = split(MySkillInfoTable[Add_Ex_Slot2].Icon[0], "\r");
L_sq_DrawImg(ImgArr[0], ImgArr[1].tointeger(), 485, 566, 0, sq_RGBA(255, 255, 255, 250), 1.0, 1.0);
local skl = sq_GetSkill(obj, Add_Ex_Slot2);
if (skl.isInCoolTime()) {
//这里是总冷却时间
local cooltime = skl.getCoolTime(obj, -1);
local Rate = sq_GetUniformVelocity(30, 0, (Clock() - Add_Ex_Slot2_Use_Time), cooltime);
setClip(485, 566, 485 + 30, 566 + Rate); //开始裁切
L_sq_DrawImg("interface/Lenheartwindowcommon.img", 57, 485, 566);
releaseClip(); //裁切结束
}
}
//绘制按键角标
if (Add_Ex_Slot1_Key) {
local Code = GetDrawCode(Add_Ex_Slot1_Key);
L_sq_DrawImg("interface/keyshortcut.img", Code, 485, 534);
}
if (Add_Ex_Slot2_Key) {
local Code = GetDrawCode(Add_Ex_Slot2_Key);
L_sq_DrawImg("interface/keyshortcut.img", Code, 485, 566);
}
}
function GetDrawCode(Code) {
//小键盘按键
if (Code >= 96 && Code <= 105) {
Code -= 61;
return Code;
}
//英文字母
if (Code >= 65 && Code <= 90) {
Code -= 10;
return Code;
}
//F1 - 9
if (Code >= 112 && Code <= 123) {
Code -= 31;
return Code;
}
switch (Code) {
//左
case 37:
return 0;
//右
case 39:
return 1;
//上
case 38:
return 2;
//下
case 40:
return 3;
//Ctrl
case 17:
return 4;
//shift
case 16:
return 7;
//alt
case 18:
return 10;
//空格
case 32:
return 13;
//Tab
case 9:
return 31;
//大写键
case 20:
return 32;
}
return Code;
}
function DrawMain(obj) {
//绘制技能格子
DrawSlot(obj);
//绘制技能
DrawSkill(obj);
//绘制悬停特效
DrawTopEffect(obj);
//绘制点击技能
DrawClickSkill(obj);
}
X = 290;
Y = 440;
MainState = false;
WindowObj = null;
function WindowLogic(obj) {
if (MainState) {
if (WindowObj) {
DrawMain(obj);
WindowObj.Show(obj);
X = WindowObj.X;
Y = WindowObj.Y;
} else {
WindowObj = LenheartWindow(X, Y, 226, 90, 0); //坐标 大小 标题栏高度
// WindowObj.DeBugMode = true;
}
} else {
if (WindowObj && WindowObj.YMouseSw == false) {
IMouse.ReleaseMouseClick();
WindowObj.YMouseSw = true;
WindowObj = null;
}
}
}
Add_Ex_Slot1_Push_Flag = false;
Add_Ex_Slot1_Push_Array = null;
Add_Ex_Slot1_Use_Time = null;
Add_Ex_Slot2_Push_Flag = false;
Add_Ex_Slot2_Push_Array = null;
Add_Ex_Slot2_Use_Time = null;
//技能按键逻辑
function SkillKeyInput(obj) {
if (sq_GetCurrentModuleType() == 1) return;
local A_Flag = L_sq_IsKeyDown(Add_Ex_Slot1_Key);
if (!Add_Ex_Slot1_Push_Flag) {
if (A_Flag) {
Add_Ex_Slot1_Push_Flag = A_Flag;
Add_Ex_Slot1_Push_Array = [
[DIK_RIGHT, DIK_Z]
];
}
} else {
if (!A_Flag) Add_Ex_Slot1_Push_Flag = A_Flag;
}
local B_Flag = L_sq_IsKeyDown(Add_Ex_Slot2_Key);
if (!Add_Ex_Slot2_Push_Flag) {
if (B_Flag) {
Add_Ex_Slot2_Push_Flag = B_Flag;
Add_Ex_Slot2_Push_Array = [
[DIK_RIGHT, DIK_Z]
];
//TODO 这里判断面向给一次数组
}
} else {
if (!B_Flag) Add_Ex_Slot2_Push_Flag = B_Flag;
}
}
//技能释放逻辑
function SkillUse(obj) {
if (Add_Ex_Slot1_Push_Array) {
local Arr = Add_Ex_Slot1_Push_Array;
if (Arr.len() > 0) {
if (typeof(Arr[0]) == "array") {
foreach(Key in Arr[0]) {
L_sq_UseSkill(Key);
}
} else {
L_sq_UseSkill(Arr[0]);
}
//有队列就清队列 但最后一位不清
if (Arr.len() > 1) Add_Ex_Slot1_Push_Array.remove(0);
else {
//只剩技能键的时候判断是否松开在清
if (!Add_Ex_Slot1_Push_Flag) {
Add_Ex_Slot1_Push_Array.remove(0);
Add_Ex_Slot1_Use_Time = Clock();
}
}
} else {
Add_Ex_Slot1_Push_Array = null;
}
}
if (Add_Ex_Slot2_Push_Array) {
local Arr = Add_Ex_Slot2_Push_Array;
if (Arr.len() > 0) {
if (typeof(Arr[0]) == "array") {
foreach(Key in Arr[0]) {
L_sq_UseSkill(Key);
}
} else {
L_sq_UseSkill(Arr[0]);
}
//有队列就清队列 但最后一位不清
if (Arr.len() > 1) Add_Ex_Slot2_Push_Array.remove(0);
else {
//只剩技能键的时候判断是否松开在清
if (!Add_Ex_Slot2_Push_Flag) {
Add_Ex_Slot2_Push_Array.remove(0);
Add_Ex_Slot2_Use_Time = Clock();
}
}
} else {
Add_Ex_Slot2_Push_Array = null;
}
}
}
function Proc(obj) {
TopEffectobj = null;
ExTopEffectobj = null;
//绘制拓展技能
DrawAddExSkill(obj);
DrawExTopEffect(obj);
//窗口逻辑
WindowLogic(obj);
//技能按键逻辑
SkillKeyInput(obj);
//技能释放逻辑
SkillUse(obj);
// MainState = true;
// sq_DrawBox(X, Y + 66, 224, 26, 0xffffffff);
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y + 66, 224, 26)) {
CheckMySkill(obj);
MainState = true;
} else {
if (MainState) {
if (!sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, 226, 90 + 62)) {
MainState = false;
QuickSkillList = null;
}
} else {
MainState = false;
QuickSkillList = null;
}
}
}
}
//技能新增系统
function Lenheart_100UI_DrawSkillAddSystem(obj) {
local RootTab = getroottable();
if (!RootTab.rawin("Lenheart_100UI_DrawSkillAddClassCObj")) {
local Cobj = Lenheart_100UI_DrawSkillAddClassC();
RootTab.rawset("Lenheart_100UI_DrawSkillAddClassCObj", Cobj);
} else {
RootTab["Lenheart_100UI_DrawSkillAddClassCObj"].Proc(obj);
}
}