diff --git a/Base/_ENUM/_ENUM_.nut b/Base/_ENUM/_ENUM_.nut index 6a83b61..0aadf47 100644 --- a/Base/_ENUM/_ENUM_.nut +++ b/Base/_ENUM/_ENUM_.nut @@ -377,3 +377,50 @@ function Rindro_GetEquAddr(addr) { //本地模式 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; +} \ No newline at end of file diff --git a/FileConfig.json b/FileConfig.json index 1f16fdf..ec9cffc 100644 --- a/FileConfig.json +++ b/FileConfig.json @@ -49,6 +49,19 @@ "ImageMini": "http://49.234.27.222:8651/dps/download2/Image:chengjiu.png" } }, + "宿命魂石": { + "Private": true, + "Script": [ + "Project/FatalismStone/FatalismStone_Stone.nut", + "Project/FatalismStone/FatalismStone.nut" + ], + "info": { + "ProjectAuthor": "官方 (期限:月)", + "ProjectVersion": "1.0.0", + "ProjectDescribe": "自用宿命魂石", + "ImageMini": "http://49.234.27.222:8651/dps/download2/Image:chengjiu.png" + } + }, "世界BOSS": { "Private": true, "Script": [ diff --git a/Project/Achievement_New/Achievement_New.nut b/Project/Achievement_New/Achievement_New.nut index e022af9..466c0f4 100644 --- a/Project/Achievement_New/Achievement_New.nut +++ b/Project/Achievement_New/Achievement_New.nut @@ -381,7 +381,7 @@ class AchievementNC extends LenheartNewUI_Windows { TypeButtonScrollBar = null; //类型按钮滚轮值 TypeButtonScrollRate = 0; - TypeButtonScrollValue = 100; + TypeButtonScrollValue = 160; //项目按钮集合 ItemButtonList = null; @@ -415,7 +415,8 @@ class AchievementNC extends LenheartNewUI_Windows { Level = { lv = 1, exp = 0, - maxexp = 100 + maxexp = 100, + itemId = 3037 } //读取pvf数据 @@ -440,6 +441,7 @@ class AchievementNC extends LenheartNewUI_Windows { Level.lv = Jso.lv.lv + 1; Level.exp = Jso.lv.exp; Level.maxexp = Jso.lv.maxexp; + Level.itemId = Jso.lv.itemId; foreach(Pos, obj in Jso.achievement) { local PvfData = ScriptInfo[CurrentTypePage][obj.id]; local Item = AchievementNC_Item(this, Pos, { @@ -520,7 +522,7 @@ class AchievementNC extends LenheartNewUI_Windows { } function InitTypeButton() { - for (local i = 0; i< 6; i++) { + for (local i = 0; i< 8; i++) { local Button = Achievement_New_TypeButton(171, 50, "achievement/typebutton.img", i, i, Y + 108, Y + 424) Button.SetCallBackFunc(function(Button) { Button.X = X + 28; @@ -623,7 +625,7 @@ class AchievementNC extends LenheartNewUI_Windows { Img["widget"].DrawPng(4, X + 226, Y + 55); //奖励底槽 Img["widget"].DrawPng(5, X + 697, Y + 65); - DrawItemBase(X + 697 + 3, Y + 65 + 3, 3037, 1); + DrawItemBase(X + 697 + 3, Y + 65 + 3, Level.itemId, 1); //绘制等级 Img["lv"].DrawPng(10, X + 252, Y + 63); @@ -635,7 +637,6 @@ class AchievementNC extends LenheartNewUI_Windows { } - function TopShow(obj) { DrawAni(obj); } @@ -650,6 +651,7 @@ class AchievementNC extends LenheartNewUI_Windows { if (sq_IsEnd(Ani)) { DrawAniMark = null; DrawAniT = null; + sq_Rewind(Ani); } } @@ -785,11 +787,6 @@ class AchievementNC extends LenheartNewUI_Windows { } -L_Windows_List <- []; -getroottable().rawdelete("LenheartPluginsInitFlag"); -getroottable().rawdelete("EventList_Obj") -getroottable().rawdelete("AchievementN_Obj"); - function Lenheart_Achievement_Fun(obj) { local RootTab = getroottable(); if (!RootTab.rawin("AchievementN_Obj")) { diff --git a/Project/FatalismStone/FatalismStone.nut b/Project/FatalismStone/FatalismStone.nut new file mode 100644 index 0000000..6298546 --- /dev/null +++ b/Project/FatalismStone/FatalismStone.nut @@ -0,0 +1,416 @@ +/* +文件名:FatalismStone.nut +路径:Project/FatalismStone/FatalismStone.nut +创建日期:2025-06-18 11:00 +文件用途:FatalismStone +*/ +//魂石list +FatalismStoneLst <- null; +//魂石Img主体 +FatalismStone_StoneImg <- {}; +FatalismStone_StoneImg["icon_Frame"] <- Rindro_Image("interface2/rindro_reward.img"); +FatalismStone_StoneImg["fatalism_stone_progressbar"] <- Rindro_Image("hud/fatalism_stone_progressbar.img"); + +class FatalismStoneC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + Visible = false; + + //Img + Img = null; + + //属性数据位数 + AttrCount = 2; + //总格子数 + GridCount = 77; + //总穿戴数 + WearCount = 6; + + //功能标题 + FunctionTitle = null; + + //背包页面 + BackpackPage = 0; + //背包页面Tabbars + BackpackPageTabbars = null; + //魂石数据 + FatalismStoneData = null; + //页面魂石集合 + PageFatalismStoneLst = null; + + + //穿戴页面坐标数组 + WearPagePos = [131, 140, 32, 180, 234, 180, 32, 272, 234, 272, 131, 413]; + + + //查询魂石背包数据 + function QueryFatalismStoneBackpack() { + SendPackEx({ + op = 21000001, + }) + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + FunctionTitle = []; + BackpackPageTabbars = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + InitImg(); + + + //初始化魂石列表 + InitFatalismStoneLst(); + + //背包数据回包 + RegisterPack(21000002, function(Chunk) { + local Jso = Json.Decode(Chunk); + FatalismStoneData = []; + //三个背包页 + for (local j = 0; j< 3; j++) { + local Buf = []; + //每个背包页77格道具 + for (local i = 0; i< GridCount; i++) { + local Obj = Jso.BackPackData[i + (j * GridCount)]; + local _Id = Obj.id; + local _CultivationDegree = Obj.cultivationDegree; + Buf.append({ + Id = _Id, + CultivationDegree = _CultivationDegree / 100.0, + XPos = 310 + (i % 11 * 39), + YPos = 260 + (i / 11 * 35), + StoneType = j + }); + } + FatalismStoneData.append(Buf); + } + //穿戴页 + local WearBuf = []; + for (local i = 0; i< WearCount; i++) { + local Obj = Jso.WearData[i]; + + local _Id = Obj.id; + local _CultivationDegree = Obj.cultivationDegree; + + local _Xpos = WearPagePos[i * 2]; + local _Ypos = WearPagePos[i * 2 + 1]; + _Xpos += 5; + _Ypos += 5; + + local infoBuf = { + Id = _Id, + CultivationDegree = _CultivationDegree / 100.0, + XPos = _Xpos, + YPos = _Ypos, + }; + if (i == 0) infoBuf.StoneType <- 0; + else if (i >= 1 && i <= 4) infoBuf.StoneType <- 1; + else if (i == 5) infoBuf.StoneType <- 2; + WearBuf.append(infoBuf); + } + FatalismStoneData.append(WearBuf); + InitPageFatalismStone(); + }.bindenv(this)); + + + + QueryFatalismStoneBackpack(); + } + + 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); + + local FuncTabbar1 = LenheartNewUI_TabbarsText(302, 27, "洗练"); + FuncTabbar1.State = 1; + AddChild(FuncTabbar1); + FuncTabbar1.OnClick = function() { + + }.bindenv(this); + FunctionTitle.append(FuncTabbar1); + + local FuncTabbar2 = LenheartNewUI_TabbarsText(364, 27, "合成"); + AddChild(FuncTabbar2); + FuncTabbar2.OnClick = function() { + + }.bindenv(this); + FunctionTitle.append(FuncTabbar2); + + local FuncTabbar3 = LenheartNewUI_TabbarsText(426, 27, "分解"); + AddChild(FuncTabbar3); + FuncTabbar3.OnClick = function() { + + }.bindenv(this); + FunctionTitle.append(FuncTabbar3); + + local FuncTabbar4 = LenheartNewUI_TabbarsText(488, 27, "注魂"); + AddChild(FuncTabbar4); + FuncTabbar4.OnClick = function() { + + }.bindenv(this); + FunctionTitle.append(FuncTabbar4); + + + + + local Tabbars3 = LenheartNewUI_TabbarsText(302, 235, "天魂石"); + Tabbars3.SetTextOffset(13, 4); + Tabbars3.State = 1; + AddChild(Tabbars3); + Tabbars3.OnClickEx = function(Button) { + foreach(button in BackpackPageTabbars) { + button.State = 0; + } + Button.State = 1; + BackpackPage = 0; + InitPageFatalismStone(); + }.bindenv(this); + BackpackPageTabbars.append(Tabbars3); + + local Tabbars4 = LenheartNewUI_TabbarsText(364, 235, "人魂石"); + Tabbars4.SetTextOffset(13, 4); + AddChild(Tabbars4); + Tabbars4.OnClickEx = function(Button) { + foreach(button in BackpackPageTabbars) { + button.State = 0; + } + Button.State = 1; + BackpackPage = 1; + InitPageFatalismStone(); + }.bindenv(this); + BackpackPageTabbars.append(Tabbars4); + + local Tabbars5 = LenheartNewUI_TabbarsText(426, 235, "地魂石"); + Tabbars5.SetTextOffset(13, 4); + AddChild(Tabbars5); + Tabbars5.OnClickEx = function(Button) { + foreach(button in BackpackPageTabbars) { + button.State = 0; + } + Button.State = 1; + BackpackPage = 2; + InitPageFatalismStone(); + }.bindenv(this); + BackpackPageTabbars.append(Tabbars5); + } + + //初始化背包 + function InitPageFatalismStone() { + // if (!BackpackData || BackpackData.len() == 0) return; + if (!FatalismStoneData) return; + local SubBackPack = FatalismStoneData[BackpackPage]; + local ItArr = SubBackPack; + foreach(value in FatalismStoneData[3]) { + ItArr.append(value); + } + PageFatalismStoneLst = []; + foreach(info in ItArr) { + local StoneBuf; + if (!info.Id) StoneBuf = FatalismStone_Stone(null); + else StoneBuf = FatalismStone_Stone(info.Id); + StoneBuf.InitializeData(info); + PageFatalismStoneLst.append(StoneBuf); + } + + + + //计算全身的属性 + local AttributeTable = {}; + for (local i = GridCount; i< GridCount + WearCount; i++) { + local StoneObj = PageFatalismStoneLst[i]; + local Att = StoneObj.GetAttribute(); + if (Att) { + foreach(key, value in Att) { + if (!AttributeTable.rawin(key)) AttributeTable.rawset(key, value); + else AttributeTable.rawset(key, AttributeTable.rawget(key) + value); + } + } + } + + + //记录最新属性数据 + if ("LenheartAttributesTable" in getroottable()) { + local T = getroottable()["LenheartAttributesTable"]; + T.rawset("LenheartCollectFatalismStoneAb", AttributeTable); + } else { + local T = {}; + T.rawset("LenheartCollectFatalismStoneAb", AttributeTable); + getroottable().rawset("LenheartAttributesTable", T); + } + } + + //绘制主界面 + function DrawMain(obj) { + Img["main"].DrawPng(0, X, Y); + + //绘制自身人物 + local charAni = sq_GetCNRDObjectToSQRCharacter(obj).sq_GetRestAni(); + sq_AnimationProc(charAni); + sq_drawCurrentFrame(charAni, X + 153, Y + 370, false); + + //绘制右侧背景 + L_sq_DrawWindow(X + 300, Y + 44, 420, 160, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); //上背景框 + L_sq_DrawWindow(X + 300, Y + 253, 420, 220, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); //下背景框 + + Img["main"].DrawPng(1, X + 309, Y + 259); + } + + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + //绘制魂石 + if (PageFatalismStoneLst) { + foreach(Pos, Stone in PageFatalismStoneLst) { + Stone.Show(obj, X + Stone.XPos, Y + Stone.YPos); + } + } + } + + function TopShow(obj) { + LenheartNewUI_Windows.TopShow(obj); + //还没有初始化数据的时候直接返回 + if (!PageFatalismStoneLst) return; + local MousePos_X = IMouse.GetXPos(); + local MousePos_Y = IMouse.GetYPos(); + //魂石的悬停绘制 + foreach(Pos, Stone in PageFatalismStoneLst) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + Stone.XPos, Y + Stone.YPos, 31, 31)) { + Stone.HoverShow(X + Stone.XPos + 31, Y + Stone.YPos); + } + } + //绘制拖拽的魂石 + if (DragObj) { + DragObj.Show(obj, IMouse.GetXPos() - 15, IMouse.GetYPos() - 15); + } + } + + //鼠标右键按下回调 + function OnMouseRbDown(MousePos_X, MousePos_Y) { + LenheartNewUI_BaseWindow.OnMouseRbDown(MousePos_X, MousePos_Y); + if (PageFatalismStoneLst) { + foreach(Pos, Stone in PageFatalismStoneLst) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + Stone.XPos, Y + Stone.YPos, 31, 31)) { + // //发送穿戴装备包 + // SendPackEx({ + // op = 21000003, + // type = BackpackPage, + // pos = Pos + // }) + } + } + } + } + + + //当前拖拽的物品对象 + DragObj = null; + DragOldPos = null; + + //鼠标左键按下回调 + function OnMouseLbDown(MousePos_X, MousePos_Y) { + LenheartNewUI_BaseWindow.OnMouseLbDown(MousePos_X, MousePos_Y); + foreach(Pos, Stone in PageFatalismStoneLst) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + Stone.XPos, Y + Stone.YPos, 39, 35)) { + if (Stone.isSuccess) { + DragObj = Stone; + PageFatalismStoneLst[Pos] = FatalismStone_Stone(null); + PageFatalismStoneLst[Pos].InitializeData(DragObj.BackupInfo); + DragOldPos = Pos; + } + } + } + } + + + //鼠标左键抬起回调 + function OnMouseLbUp(MousePos_X, MousePos_Y) { + LenheartNewUI_BaseWindow.OnMouseLbUp(MousePos_X, MousePos_Y); + if (!PageFatalismStoneLst) return; + foreach(Pos, Stone in PageFatalismStoneLst) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + Stone.XPos, Y + Stone.YPos, 39, 35)) { + if (DragObj) { + //获取到旧的穿戴类型 + local OldEType = DragObj.Stone_Type; + //获取到新的穿戴类型 + local NewEType = Stone.Stone_Type; + + //如果两个类型相同则进行交换 相同位置也不发包 + if (OldEType == NewEType && DragOldPos != Pos) { + SendPackEx({ + op = 21000003, + oldtype = DragOldPos >= GridCount ? -1 : BackpackPage, + oldpos = DragOldPos >= GridCount ? (DragOldPos - GridCount) : DragOldPos, + newtype = Pos >= GridCount ? -1 : BackpackPage, + newpos = Pos >= GridCount ? (Pos - GridCount) : Pos + }) + } + + //播放移动声音 + R_Utils.PlaySound(DragObj.Info["move wav"]); + + //放回原位 + PageFatalismStoneLst[DragOldPos] = DragObj; + DragObj = null; + } + } + } + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } + + function InitFatalismStoneLst() { + FatalismStoneLst = {}; + Rindro_Script.GetFileData("fatalismstone/fatalismstone.lst", function(DataTable, Data) { + while (!Data.Eof()) { + local Id = Data.Get(); + local Path = Data.Get(); + FatalismStoneLst.rawset(Id, Path); + } + }); + } + + function InitImg() { + Img = {}; + Img["main"] <- Rindro_Image("hud/fatalism_stone.img"); + } + + function OpenCallBack() { + Visible = true; + QueryFatalismStoneBackpack(); + } +} + +L_Windows_List <- []; +getroottable().rawdelete("LenheartPluginsInitFlag"); +getroottable().rawdelete("EventList_Obj") +getroottable().rawdelete("FatalismStone_Obj"); + +function Lenheart_FatalismStone_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("FatalismStone_Obj")) { + RootTab.rawset("FatalismStone_Obj", true); + local Win = LenheartNewUI_CreateWindow(FatalismStoneC, "宿命魂石窗口", ((getroottable().Rindro_Scr_Width - 753) / 2).tointeger(), 35, 753, 518, 20); + + EventList_Obj.AddEvent("宿命魂石", 280, Win, "interface2/hud/information_button/information_button_cn.img"); + } +} + +getroottable()["LenheartFuncTab"].rawset("FatalismStoneFuncN", Lenheart_FatalismStone_Fun); + diff --git a/Project/FatalismStone/FatalismStone_Stone.nut b/Project/FatalismStone/FatalismStone_Stone.nut new file mode 100644 index 0000000..774fbf9 --- /dev/null +++ b/Project/FatalismStone/FatalismStone_Stone.nut @@ -0,0 +1,265 @@ +/* +文件名:FatalismStone_Stone.nut +路径:Project/FatalismStone/FatalismStone_Stone.nut +创建日期:2025-06-20 19:57 +文件用途: +*/ +//属性标签表 +FatalismStone_AttrTagLst <- {}; +FatalismStone_AttrTagLst["[physical attack]"] <- "力量"; +FatalismStone_AttrTagLst["[magical attack]"] <- "智力"; +FatalismStone_AttrTagLst["[physical defense]"] <- "体力"; +FatalismStone_AttrTagLst["[magical defense]"] <- "精神"; +FatalismStone_AttrTagLst["[equipment physical attack]"] <- "物理攻击"; +FatalismStone_AttrTagLst["[equipment magical attack]"] <- "魔法攻击"; +FatalismStone_AttrTagLst["[separate attack]"] <- "独立攻击"; +FatalismStone_AttrTagLst["[equipment physical defense]"] <- "物理防御"; +FatalismStone_AttrTagLst["[equipment magical defense]"] <- "魔法防御"; +FatalismStone_AttrTagLst["[physical critical hit]"] <- "物理暴击"; +FatalismStone_AttrTagLst["[magical critical hit]"] <- "魔法暴击"; +FatalismStone_AttrTagLst["[attack speed]"] <- "攻击速度"; +FatalismStone_AttrTagLst["[cast speed]"] <- "施法速度"; +FatalismStone_AttrTagLst["[move speed]"] <- "移动速度"; +FatalismStone_AttrTagLst["[fire attack]"] <- "火属性强化"; +FatalismStone_AttrTagLst["[water attack]"] <- "冰属性强化"; +FatalismStone_AttrTagLst["[light attack]"] <- "光属性强化"; +FatalismStone_AttrTagLst["[dark attack]"] <- "暗属性强化"; +FatalismStone_AttrTagLst["[fire resistance]"] <- "火属性抗性"; +FatalismStone_AttrTagLst["[water resistance]"] <- "冰属性抗性"; +FatalismStone_AttrTagLst["[light resistance]"] <- "光属性抗性"; +FatalismStone_AttrTagLst["[dark resistance]"] <- "暗属性抗性"; +FatalismStone_AttrTagDrawOrder <- ["[physical attack]", "[magical attack]", "[physical defense]", "[magical defense]", "[equipment physical attack]", "[equipment magical attack]", "[separate attack]", "[equipment physical defense]", "[equipment magical defense]", "[physical critical hit]", "[magical critical hit]", "[attack speed]", "[cast speed]", "[move speed]", "[fire attack]", "[water attack]", "[light attack]", "[dark attack]", "[fire resistance]", "[water resistance]", "[light resistance]", "[dark resistance]"] + + +class FatalismStone_Stone { + //数据 + Info = null; + //显示偏移位置 + XPos = 0; + YPos = 0; + //魂石类型 + Stone_Type = null; + + //完成Flag + isSuccess = false; + + constructor(Arg) { + if (Arg != null) { + //如果传入了Id + if (typeof Arg == "integer") { + if (FatalismStoneLst.rawin(Arg)) { + local Buf = FatalismStoneLst.rawget(Arg); + if (typeof Buf == "string") { + Buf = InitData(Buf); + FatalismStoneLst.rawset(Arg, Buf); + } + Initialize(Buf); + } else printf("FatalismStone_Stone:没有找到Id为" + Arg + "的魂石"); + } + isSuccess = true; + } + } + + //显示 + function Show(obj, X, Y) { + if (!isSuccess) return; + //绘制品级图框 + FatalismStone_StoneImg["icon_Frame"].DrawPng(Info["rarity"], X - 1, Y - 1); + //绘制图标 + FatalismStone_StoneImg[Info.icon.img].DrawPng(Info.icon.index, X + 2, Y + 2); + + //前景特效 + if (Info.rawin("front effect")) Rindro_BaseToolClass.T_DrawDynamicAni(obj, Info["front effect"], X, Y, "ItemEff" + Info["front effect"]); + } + + //悬停 + function HoverShow(X, Y) { + + //绘制悬停框 + L_sq_SetDrawImgModel(2, 0); + Rindro_Image_GlobalMap["lenheartui"].DrawPng(353, X - 31 + 1, Y + 1); + L_sq_ReleaseDrawImgModel(); + + if (!isSuccess) return; + //基础长度50 + local Height = 50; + Height += Info.Attribute.len() * 14; //计算属性带来的高度加成 + Height += Info["basic explain"] ? 10 + (L_sq_GetStringDrawArray(Info["basic explain"], 204).len() * 14) : 0; + + //防止超出屏幕右测和下方 + if ((X + 205) > getroottable().Rindro_Scr_Width) X = getroottable().Rindro_Scr_Width - 215; + if ((Y + 10 + Height) > 600) Y = 600 - Height - 10; + Rindro_BaseToolClass.DrawNineBox(X + 10, Y + 10, 204, Height, "interface/lenheartwindowcommon.img", 387); //背景框 + //绘制名字 + L_sq_DrawCode(Info["name"], X + 17, Y + 17, Info.rarityColor, 1, 0); + //绘制洗炼度 + DrawCultivationDegree(X, Y); + //绘制分割线 + Rindro_Image_GlobalMap["lenheartui"].DrawPng(230, X + 10, Y + 50); + local DrawPos = 0; + //绘制基础属性 + foreach(Pos, Key in FatalismStone_AttrTagDrawOrder) { + if (Info.Attribute.rawin(Key)) { + local Value = Info.Attribute.rawget(Key); + local Color = sq_RGBA(255, 255, 255, 255); + if (Key.find("speed") || Key.find("critical")) { + Color = sq_RGBA(104, 213, 237, 255); + Value += "%"; + } + if (Key == "[physical attack]" || Key == "[magical attack]" || Key == "[physical defense]" || Key == "[magical defense]") Color = sq_RGBA(104, 213, 237, 255); + if (Key == "[fire attack]" || Key == "[water attack]" || Key == "[light attack]" || Key == "[dark attack]") Color = sq_RGBA(179, 107, 255, 255); + if (Key == "[fire resistance]" || Key == "[water resistance]" || Key == "[light resistance]" || Key == "[dark resistance]") Color = sq_RGBA(179, 107, 255, 255); + if (Key == "[equipment physical attack]" || Key == "[equipment magical attack]" || Key == "[separate attack]") Color = sq_RGBA(255, 0, 240, 255); + L_sq_DrawCode(FatalismStone_AttrTagLst.rawget(Key) + ": " + Value, X + 16, Y + 56 + DrawPos * 14, Color, 1, 0); + DrawPos++; + } + } + //绘制描述 + Rindro_Image_GlobalMap["lenheartui"].DrawPng(230, X + 10, Y + 60 + Info.Attribute.len() * 14); + if (Info["basic explain"]) { + local Buf = L_sq_GetStringDrawArray(Info["basic explain"], 204); + foreach(i, v in Buf) { + L_sq_DrawCode(v, X + 16, Y + 65 + Info.Attribute.len() * 14 + i * 14, sq_RGBA(150, 150, 150, 255), 1, 0); + } + } + } + + + //绘制洗练度 + function DrawCultivationDegree(X, Y) { + //绘制洗练度 + L_sq_DrawCode("魂石洗练度: ", X + 16, Y + 34, sq_RGBA(104, 237, 161, 255), 1, 0); + FatalismStone_StoneImg["fatalism_stone_progressbar"].DrawExPng(0, X + 80, Y + 38, 0, sq_RGBA(255, 255, 255, 250), 1.36, 1.0); + L_sq_DrawCode(Info.cultivationDegree + "%", X + 194 - LenheartTextClass.GetStringLength(Info.cultivationDegree.tostring()) / 2, Y + 36, sq_RGBA(255, 255, 255, 255), 1, 0); + + setClip(X + 85, Y + 41, X + 85 + (68 * Info.cultivationDegree / 100.0 * 1.36).tointeger(), Y + 41 + 6); + FatalismStone_StoneImg["fatalism_stone_progressbar"].DrawExPng(1, X + 85, Y + 41, 0, sq_RGBA(255, 255, 255, 250), 1.36, 1.0); + releaseClip(); //裁切结束 + } + + //读取魂石数据 + function InitData(Path) { + return Rindro_Script.GetFileData("fatalismstone/" + Path, function(DataTable, Data) { + DataTable.Attribute <- {}; + while (!Data.Eof()) { + local Key = Data.Get(); + if (Key == "[rarity]" || Key == "[stone type]" || Key == "[move wav]" || Key == "[front effect]" || Key == "[back effect]") { + DataTable[Key.slice(1, -1)] <- Data.Get(); + } else if (Key == "[basic explain]" || Key == "[name]") { + DataTable[Key.slice(1, -1)] <- Sq_ConvertWideChar(Data.Get(), "big5"); + } else if (Key == "[icon]") { + DataTable.icon <- { + img = Data.Get(), + index = Data.Get() + } + } else if (FatalismStone_AttrTagLst.rawin(Key)) { + DataTable.Attribute.rawset(Key, [Data.Get(), Data.Get()]); + } + } + }); + } + + //初始化魂石 + function Initialize(Pr) { + //深拷贝数据 + Info = deepcopy(Pr); + if (!FatalismStone_StoneImg.rawin(Info.icon.img)) { + FatalismStone_StoneImg[Info.icon.img] <- Rindro_Image(Info.icon.img); + } + //提取品级颜色 + Info.rarityColor <- GetRarityColor(Info.rarity); + //洗练度 + Info.cultivationDegree <- 100.0; + //魂石类型 + Stone_Type = Info["stone type"]; + } + + BackupInfo = null; + + //初始化数据 + function InitializeData(info) { + BackupInfo = info; + //同步位置 + XPos = info.XPos; + YPos = info.YPos; + + //如果是没有ID的通过传入的数据确定魂石类型 + if (Stone_Type == null) Stone_Type = info.StoneType; + + + if (!isSuccess) return; + //得到洗练度 + local Rate = info.CultivationDegree; + Info.cultivationDegree = (Rate * 100.0); + //计算属性 + foreach(Key, value in Info.Attribute) { + Info.Attribute[Key] = (value[0] + (value[1] - value[0]) * Rate).tointeger(); + } + } + + //品级颜色 + function GetRarityColor(rarity) { + rarity = rarity; + switch (rarity) { + case 0: + return sq_RGBA(255, 255, 255, 255); + case 1: + return sq_RGBA(104, 213, 237, 255); + case 2: + return sq_RGBA(179, 107, 254, 255); + case 3: + return sq_RGBA(255, 0, 240, 255); + case 4: + return sq_RGBA(255, 177, 0, 255); + case 5: + return sq_RGBA(255, 102, 102, 255); + case 6: + return sq_RGBA(255, 50, 50, 255); + } + } + + function SetAttTableFunc(AttTable, Key, CheckKey, SetKey, Value) { + { + if (Key == CheckKey) { + AttTable.rawset(SetKey, Value); + return true; + } + } + } + + //获取属性 + function GetAttribute() { + if (!Info || !Info.rawin("Attribute") || !Info.Attribute) return null; + local T = {}; + foreach(Key, value in Info.Attribute) { + if(SetAttTableFunc(T,Key,"[physical attack]","strength",value))continue; + if(SetAttTableFunc(T,Key,"[magical attack]","intelligence",value))continue; + if(SetAttTableFunc(T,Key,"[physical defense]","vitality",value))continue; + if(SetAttTableFunc(T,Key,"[magical defense]","spirit",value))continue; + if(SetAttTableFunc(T,Key,"[equipment physical attack]","physicalAttack",value))continue; + if(SetAttTableFunc(T,Key,"[equipment magical attack]","magicAttack",value))continue; + if(SetAttTableFunc(T,Key,"[separate attack]","independentAttack",value))continue; + if(SetAttTableFunc(T,Key,"[equipment physical defense]","physicalDefense",value))continue; + if(SetAttTableFunc(T,Key,"[equipment magical defense]","magicDefense",value))continue; + if(SetAttTableFunc(T,Key,"[physical critical hit]","physicalCritical",value))continue; + if(SetAttTableFunc(T,Key,"[magical critical hit]","magicCritical",value))continue; + if(SetAttTableFunc(T,Key,"[attack speed]","attackSpeed",value))continue; + if(SetAttTableFunc(T,Key,"[cast speed]","releaseSpeed",value))continue; + if(SetAttTableFunc(T,Key,"[move speed]","moveSpeed",value))continue; + if(SetAttTableFunc(T,Key,"[fire attack]","fire",value))continue; + if(SetAttTableFunc(T,Key,"[water attack]","water",value))continue; + if(SetAttTableFunc(T,Key,"[light attack]","light",value))continue; + if(SetAttTableFunc(T,Key,"[dark attack]","dark",value))continue; + if(SetAttTableFunc(T,Key,"[fire resistance]","fireResistance",value))continue; + if(SetAttTableFunc(T,Key,"[water resistance]","waterResistance",value))continue; + if(SetAttTableFunc(T,Key,"[light resistance]","lightResistance",value))continue; + if(SetAttTableFunc(T,Key,"[dark resistance]","darkResistance",value))continue; + } + return T; + } +} + +L_Windows_List <- []; +getroottable().rawdelete("LenheartPluginsInitFlag"); +getroottable().rawdelete("EventList_Obj") +getroottable().rawdelete("FatalismStone_Obj"); \ No newline at end of file diff --git a/Project/FatalismStone/img/0.png b/Project/FatalismStone/img/0.png new file mode 100644 index 0000000..685d220 Binary files /dev/null and b/Project/FatalismStone/img/0.png differ diff --git a/folder-alias.json b/folder-alias.json index 634a429..6d83e89 100644 --- a/folder-alias.json +++ b/folder-alias.json @@ -142,5 +142,11 @@ }, "Project/DamageControl": { "description": "伤害控制" + }, + "Project/FatalismStone": { + "description": "宿命魂石" + }, + "Project/FatalismStone/FatalismStone_Stone.nut": { + "description": "魂石类" } } \ No newline at end of file