| 
									
										
										
										
											2025-06-30 00:25:43 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 文件名: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 { | 
					
						
							| 
									
										
										
										
											2025-10-14 09:17:56 +08:00
										 |  |  |     //唯一ID | 
					
						
							|  |  |  |     Uuid = null; | 
					
						
							|  |  |  |     //魂石ID | 
					
						
							|  |  |  |     Id = null; | 
					
						
							| 
									
										
										
										
											2025-06-30 00:25:43 +08:00
										 |  |  |     //数据 | 
					
						
							|  |  |  |     Info = null; | 
					
						
							|  |  |  |     //显示偏移位置 | 
					
						
							|  |  |  |     XPos = 0; | 
					
						
							|  |  |  |     YPos = 0; | 
					
						
							|  |  |  |     //魂石类型 | 
					
						
							|  |  |  |     Stone_Type = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //完成Flag | 
					
						
							|  |  |  |     isSuccess = false; | 
					
						
							| 
									
										
										
										
											2025-10-14 09:17:56 +08:00
										 |  |  |     //唯一属性加载Flag | 
					
						
							|  |  |  |     isInitializeData = false; | 
					
						
							|  |  |  |     //唯一属性请求Flag | 
					
						
							|  |  |  |     isInitializeRequestData = false; | 
					
						
							| 
									
										
										
										
											2025-06-30 00:25:43 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     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); | 
					
						
							| 
									
										
										
										
											2025-10-14 09:17:56 +08:00
										 |  |  |                     Id = Arg; | 
					
						
							| 
									
										
										
										
											2025-06-30 00:25:43 +08:00
										 |  |  |                 } 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) { | 
					
						
							|  |  |  |         if (!isSuccess) return; | 
					
						
							| 
									
										
										
										
											2025-10-14 09:17:56 +08:00
										 |  |  |         if (!isInitializeRequestData) { | 
					
						
							|  |  |  |             isInitializeRequestData = true; | 
					
						
							|  |  |  |             Rindro_BaseToolClass.SendPackEx({ | 
					
						
							|  |  |  |                 op = 21000011, | 
					
						
							|  |  |  |                 uuid = Uuid | 
					
						
							|  |  |  |             }) | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2025-06-30 00:25:43 +08:00
										 |  |  |         //基础长度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) { | 
					
						
							|  |  |  |         //得到洗练度 | 
					
						
							| 
									
										
										
										
											2025-10-14 09:17:56 +08:00
										 |  |  |         local Rate = info.Cultivation; | 
					
						
							| 
									
										
										
										
											2025-06-30 00:25:43 +08:00
										 |  |  |         Info.cultivationDegree = (Rate * 100.0); | 
					
						
							|  |  |  |         //计算属性 | 
					
						
							|  |  |  |         foreach(Key, value in Info.Attribute) { | 
					
						
							| 
									
										
										
										
											2025-10-14 09:17:56 +08:00
										 |  |  |             local BaseValueArr = FatalismStoneLst[Id].Attribute[Key]; | 
					
						
							|  |  |  |             Info.Attribute[Key] = (BaseValueArr[0] + (BaseValueArr[1] - BaseValueArr[0]) * Rate).tointeger(); | 
					
						
							| 
									
										
										
										
											2025-06-30 00:25:43 +08:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2025-10-14 09:17:56 +08:00
										 |  |  |         isInitializeData = true; | 
					
						
							| 
									
										
										
										
											2025-06-30 00:25:43 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //品级颜色 | 
					
						
							|  |  |  |     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) { | 
					
						
							| 
									
										
										
										
											2025-07-16 15:21:32 +08:00
										 |  |  |             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 * 10.0)) continue; | 
					
						
							|  |  |  |             if (SetAttTableFunc(T, Key, "[magical critical hit]", "magicCritical", value * 10.0)) continue; | 
					
						
							|  |  |  |             if (SetAttTableFunc(T, Key, "[attack speed]", "attackSpeed", value * 10.0)) continue; | 
					
						
							|  |  |  |             if (SetAttTableFunc(T, Key, "[cast speed]", "releaseSpeed", value * 10.0)) continue; | 
					
						
							|  |  |  |             if (SetAttTableFunc(T, Key, "[move speed]", "moveSpeed", value * 10.0)) 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; | 
					
						
							| 
									
										
										
										
											2025-06-30 00:25:43 +08:00
										 |  |  |         } | 
					
						
							|  |  |  |         return T; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | L_Windows_List <- []; | 
					
						
							|  |  |  | getroottable().rawdelete("LenheartPluginsInitFlag"); | 
					
						
							|  |  |  | getroottable().rawdelete("EventList_Obj") | 
					
						
							|  |  |  | getroottable().rawdelete("FatalismStone_Obj"); |