1615 lines
		
	
	
		
			53 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			1615 lines
		
	
	
		
			53 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| // function sq_GetIntData(obj, SkillId, Idx) {
 | |
| //     local ret = L_sq_GetIntData(obj, SkillId, Idx);
 | |
| //     return ret + HookIntData(obj, SkillId, Idx);
 | |
| // }
 | |
| 
 | |
| // function sq_getIntData(obj, SkillId, Idx) {
 | |
| //     local ret = L_sq_GetIntData(obj, SkillId, Idx);
 | |
| //     return ret + HookIntData(obj, SkillId, Idx);
 | |
| // }
 | |
| 
 | |
| // function sq_GetLevelData(obj, SkillId, Idx, SkillLevel) {
 | |
| //     local ret = L_sq_GetLevelData(obj, SkillId, Idx, SkillLevel);
 | |
| //     return ret + HookLevelData(obj, SkillId, Idx);
 | |
| // }
 | |
| 
 | |
| // function sq_getLevelData(obj, SkillId, Idx, SkillLevel) {
 | |
| //     local ret = L_sq_GetLevelData(obj, SkillId, Idx, SkillLevel);
 | |
| //     return ret + HookLevelData(obj, SkillId, Idx);
 | |
| // }
 | |
| 
 | |
| 
 | |
| function getReversalASCII(string)
 | |
| {
 | |
| 	local ASCII;
 | |
| 	switch(string){
 | |
| 		case	10	:ASCII =	"\n"	;break;
 | |
| 		case	32	:ASCII =	" " 	;break;
 | |
| 		case	33	:ASCII =	"!" 	;break;
 | |
| 		case	35	:ASCII =	"#" 	;break;
 | |
| 		case	36	:ASCII =	"$" 	;break;
 | |
| 		case	37	:ASCII =	"%" 	;break;
 | |
| 		case	38	:ASCII =	"&" 	;break;
 | |
| 		case	39	:ASCII =	"'" 	;break;
 | |
| 		case	40	:ASCII =	"(" 	;break;
 | |
| 		case	41	:ASCII =	")" 	;break;
 | |
| 		case	42	:ASCII =	"*" 	;break;
 | |
| 		case	43	:ASCII =	"+" 	;break;
 | |
| 		case	44	:ASCII =	"," 	;break;
 | |
| 		case	45	:ASCII =	"-" 	;break;
 | |
| 		case	46	:ASCII =	"." 	;break;
 | |
| 		case	47	:ASCII =	"/" 	;break;
 | |
| 		case	58	:ASCII =	":" 	;break;
 | |
| 		case	59	:ASCII =	";" 	;break;
 | |
| 		case	60	:ASCII =	"<" 	;break;
 | |
| 		case	61	:ASCII =	"=" 	;break;
 | |
| 		case	62	:ASCII =	">" 	;break;
 | |
| 		case	63	:ASCII =	"?" 	;break;
 | |
| 		case	64	:ASCII =	"@" 	;break;
 | |
| 		case	91	:ASCII =	"[" 	;break;
 | |
| 		case	93	:ASCII =	"]" 	;break;
 | |
| 		case	94	:ASCII =	"^" 	;break;
 | |
| 		case	95	:ASCII =	"_" 	;break;
 | |
| 		case	96	:ASCII =	"`" 	;break;
 | |
| 		case	123	:ASCII =	"{" 	;break;
 | |
| 		case	124	:ASCII =	"|" 	;break;
 | |
| 		case	125	:ASCII =	"}" 	;break;
 | |
| 		case	126	:ASCII =	"~" 	;break;
 | |
| 		case	48	:ASCII =	"0" 	;break;
 | |
| 		case	49	:ASCII =	"1" 	;break;
 | |
| 		case	50	:ASCII =	"2" 	;break;
 | |
| 		case	51	:ASCII =	"3" 	;break;
 | |
| 		case	52	:ASCII =	"4" 	;break;
 | |
| 		case	53	:ASCII =	"5" 	;break;
 | |
| 		case	54	:ASCII =	"6" 	;break;
 | |
| 		case	55	:ASCII =	"7" 	;break;
 | |
| 		case	56	:ASCII =	"8" 	;break;
 | |
| 		case	57	:ASCII =	"9" 	;break;
 | |
| 		case	65	:ASCII =	"A" 	;break;
 | |
| 		case	66	:ASCII =	"B" 	;break;
 | |
| 		case	67	:ASCII =	"C" 	;break;
 | |
| 		case	68	:ASCII =	"D" 	;break;
 | |
| 		case	69	:ASCII =	"E" 	;break;
 | |
| 		case	70	:ASCII =	"F" 	;break;
 | |
| 		case	71	:ASCII =	"G" 	;break;
 | |
| 		case	72	:ASCII =	"H" 	;break;
 | |
| 		case	73	:ASCII =	"I" 	;break;
 | |
| 		case	74	:ASCII =	"J" 	;break;
 | |
| 		case	75	:ASCII =	"K" 	;break;
 | |
| 		case	76	:ASCII =	"L" 	;break;
 | |
| 		case	77	:ASCII =	"M" 	;break;
 | |
| 		case	78	:ASCII =	"N" 	;break;
 | |
| 		case	79	:ASCII =	"O" 	;break;
 | |
| 		case	80	:ASCII =	"P" 	;break;
 | |
| 		case	81	:ASCII =	"Q" 	;break;
 | |
| 		case	82	:ASCII =	"R" 	;break;
 | |
| 		case	83	:ASCII =	"S" 	;break;
 | |
| 		case	84	:ASCII =	"T" 	;break;
 | |
| 		case	85	:ASCII =	"U" 	;break;
 | |
| 		case	86	:ASCII =	"V" 	;break;
 | |
| 		case	87	:ASCII =	"W" 	;break;
 | |
| 		case	88	:ASCII =	"X" 	;break;
 | |
| 		case	89	:ASCII =	"Y" 	;break;
 | |
| 		case	90	:ASCII =	"Z" 	;break;
 | |
| 		case	97	:ASCII =	"a" 	;break;
 | |
| 		case	98	:ASCII =	"b" 	;break;
 | |
| 		case	99	:ASCII =	"c" 	;break;
 | |
| 		case	100	:ASCII =	"d" 	;break;
 | |
| 		case	101	:ASCII =	"e" 	;break;
 | |
| 		case	102	:ASCII =	"f" 	;break;
 | |
| 		case	103	:ASCII =	"g" 	;break;
 | |
| 		case	104	:ASCII =	"h" 	;break;
 | |
| 		case	105	:ASCII =	"i" 	;break;
 | |
| 		case	106	:ASCII =	"j" 	;break;
 | |
| 		case	107	:ASCII =	"k" 	;break;
 | |
| 		case	108	:ASCII =	"l" 	;break;
 | |
| 		case	109	:ASCII =	"m" 	;break;
 | |
| 		case	110	:ASCII =	"n" 	;break;
 | |
| 		case	111	:ASCII =	"o" 	;break;
 | |
| 		case	112	:ASCII =	"p" 	;break;
 | |
| 		case	113	:ASCII =	"q" 	;break;
 | |
| 		case	114	:ASCII =	"r" 	;break;
 | |
| 		case	115	:ASCII =	"s" 	;break;
 | |
| 		case	116	:ASCII =	"t" 	;break;
 | |
| 		case	117	:ASCII =	"u" 	;break;
 | |
| 		case	118	:ASCII =	"v" 	;break;
 | |
| 		case	119	:ASCII =	"w" 	;break;
 | |
| 		case	120	:ASCII =	"x" 	;break;
 | |
| 		case	121	:ASCII =	"y" 	;break;
 | |
| 		case	122	:ASCII =	"z" 	;break;
 | |
| 		default 	:ASCII = "";break;
 | |
| 	}
 | |
| 	return ASCII;
 | |
| }
 | |
| function KeyInputCallBack(code)
 | |
| {
 | |
|     if("GlobaNtInput" in getroottable()){
 | |
|         local NT = getroottable().GlobaNtInput;
 | |
|         foreach(Key, Value in NT) {
 | |
|             Value(code);
 | |
|         }
 | |
|     }
 | |
| }
 | |
| function RegisterInputHook(FuncName,Func) 
 | |
| {
 | |
|     if("GlobaNtInput" in getroottable()){
 | |
|         local NT = getroottable().GlobaNtInput;
 | |
|         NT.rawset(FuncName,Func);
 | |
|     }else{
 | |
|         local NT = {};
 | |
|         NT.rawset(FuncName,Func);
 | |
|         getroottable().GlobaNtInput <- NT;
 | |
|     }
 | |
| }
 | |
| function ErasesInputHook(FuncName) 
 | |
| {
 | |
|     if("GlobaNtInput" in getroottable()){
 | |
|         local NT = getroottable().GlobaNtInput;
 | |
|         if(NT.rawin(FuncName)){
 | |
|             NT.rawdelete(FuncName);
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| //基础工具类
 | |
| class BasicsDrawTool {
 | |
| 
 | |
|     function SendPack(T) {
 | |
|         local str = Json.Encode(T);
 | |
|         L_sq_SendPackType(130);
 | |
|         L_sq_SendPackWChar(str);
 | |
|         L_sq_SendPack();
 | |
|     }
 | |
| 
 | |
|     function SendPackEx(T) { 
 | |
|         local str = L_sq_EncondeJson(T);
 | |
|         L_sq_SendPackType(130);
 | |
|         L_sq_SendPackWChar(str);
 | |
|         L_sq_SendPack();
 | |
|     }
 | |
| 
 | |
|     //绘制简易静态Ani					// obj --  ani路径  --  X   --  Y  --  第几帧  --  ani名字
 | |
|     function T_DrawStayAni(obj, aniFileName, x, y, index, aniname) {
 | |
|         local SelectAni = obj.getVar().GetAnimationMap(aniname, aniFileName);
 | |
|         //sq_AnimationProc(SelectAni);
 | |
|         sq_DrawSpecificFrame(SelectAni, x, y, false, index, false, 1.0);
 | |
|         return SelectAni;
 | |
|     }
 | |
| 
 | |
|     //绘制简易静态Ani					// obj --  ani路径  --  X   --  Y  --  第几帧  --  ani名字
 | |
|     function T_DrawStayAniRate(obj, aniFileName, x, y, index, aniname, rate) {
 | |
|         local SelectAni = obj.getVar().GetAnimationMap(aniname, aniFileName);
 | |
|         SelectAni.setImageRateFromOriginal(rate, rate);
 | |
|         //sq_AnimationProc(SelectAni);
 | |
|         sq_DrawSpecificFrame(SelectAni, x, y, false, index, false, 1.0);
 | |
|         return SelectAni;
 | |
|     }
 | |
| 
 | |
|     //绘制简易动态Ani					// obj --  ani路径  --  X   --  Y  --  ani名字
 | |
|     function T_DrawDynamicAni(obj, aniFileName, x, y, aniname) {
 | |
|         local ani = obj.getVar().GetAnimationMap(aniname, aniFileName);
 | |
|         sq_AnimationProc(ani);
 | |
|         sq_drawCurrentFrame(ani, x, y, true);
 | |
|         return ani;
 | |
|     }
 | |
| 
 | |
|     //绘制数字							// obj  --  X   --  Y  --  数值   --  ani路径前缀  --  间隔  --  数字1偏移坐标
 | |
|     function T_DrawCustomNum(obj, xPos, yPos, num, str, Interval) {
 | |
|         local NumStr = num.tostring();
 | |
|         for (local i = 0; i < NumStr.len(); ++i) {
 | |
|             local DrawNum = NumStr.slice(i, i + 1);
 | |
|             local ani = obj.getVar().GetAnimationMap(DrawNum + str, str + DrawNum + ".ani");
 | |
|             sq_DrawSpecificFrame(ani, xPos + (i * Interval), yPos, false, 0, false, 1.0);
 | |
|         }
 | |
|     }
 | |
|     //绘制时间数字							// obj  --  X   --  Y  --  数值   --  ani路径前缀  --  间隔  --  数字1偏移坐标
 | |
|     function T_DrawCustomTimeNum(obj, xPos, yPos, num, str, Interval, OneDeviation) {
 | |
|         local len = (num.tostring()).len();
 | |
|         for (local i = len; i > 0; i--) {
 | |
|             local fg = 0;
 | |
|             local DrawNum = (num.tostring()).slice(i - 1, i);
 | |
|             //one += OneDeviation * abs(i - (len - 1));
 | |
|             if (i < (len - 1)) fg = -10;
 | |
|             local ani = obj.getVar().GetAnimationMap(DrawNum + str, str + DrawNum + ".ani");
 | |
|             sq_AnimationProc(ani);
 | |
|             sq_drawCurrentFrame(ani, xPos + ((i - len) * Interval) + fg, yPos, true);
 | |
|         }
 | |
|     }
 | |
|     //绘制汉字  obj  --  X坐标 --  Y坐标 --  汉字  --  RGBA
 | |
|     function T_DrawCode(posX, posY, char, rgba) {
 | |
|         L_Code_STL(char, posX, posY, rgba, 0);
 | |
|     }
 | |
|     //初始化根表成员
 | |
|     function InitClass(Name) {
 | |
|         local RootTab = getroottable();
 | |
|         if (RootTab.rawin(Name) == true) {
 | |
|             RootTab.rawdelete(Name);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     function T_LogError(msg) {
 | |
|         local f = file("Yosin.Error", "a+");
 | |
|         foreach(char in msg) {
 | |
|             f.writen(char, 'b');
 | |
|         }
 | |
|         f.writen('\n', 'b');
 | |
|     }
 | |
|     //错误抛出
 | |
|     function T_ErrorPrint(exception, Type) {
 | |
|         local allStr = "";
 | |
|         allStr += "AN ERROR HAS OCCURED [" + exception + "]\n";
 | |
|         allStr += "CALLSTACK\n";
 | |
|         for (local i = -10; i < 20; i++) {
 | |
|             local tab1 = getstackinfos(i);
 | |
|             if (typeof tab1 != "null") {
 | |
|                 local Write = true;
 | |
|                 local StrBuffer = "";
 | |
|                 foreach(name, value in tab1) {
 | |
| 
 | |
|                     if (value == "unknown" || value == "getstackinfos" || value == "errorhandler" || value == -1) {
 | |
|                         Write = false;
 | |
|                         break;
 | |
|                     }
 | |
| 
 | |
|                     switch (name) {
 | |
|                         case "func":
 | |
|                             StrBuffer += "*Function:   [ " + value + " ]  \n\n";
 | |
|                             break;
 | |
|                         case "src":
 | |
|                             StrBuffer += "*Src:        [ " + value + " ]  \n";
 | |
|                             break;
 | |
|                         case "line":
 | |
|                             StrBuffer += "*Line:       [ " + value + " ]  \n";
 | |
|                             break;
 | |
|                         case "locals":
 | |
|                             StrBuffer += "*Address:    [ " + value + " ]  \n";
 | |
|                             break;
 | |
|                         default:
 | |
|                             break;
 | |
|                     }
 | |
| 
 | |
|                 }
 | |
|                 if (Write == true) allStr += StrBuffer;
 | |
|             }
 | |
|         }
 | |
|         if (Type == false) print(allStr);
 | |
|         else if (Type == true) BasicsDrawTool.T_LogError(allStr);
 | |
|     }
 | |
|     //获取汉字偏移
 | |
|     function GetOffserFromLen(char, offset) {
 | |
|         return (char.len() * offset)
 | |
|     }
 | |
| }
 | |
| 
 | |
| //Hud按钮类
 | |
| class HudButton extends BasicsDrawTool //  obj  --  按钮名称  --  X坐标  --  Y坐标  --  Ani调用路径  --  宽度  --  高度
 | |
| {
 | |
|     obj = null; //Obj对象
 | |
|     buttonName = null; //按钮名称
 | |
|     x = null; //X坐标
 | |
|     y = null; //Y坐标
 | |
|     BaseAnifile = null; //调用Ani路径
 | |
|     width = null; //可点击宽度
 | |
|     length = null; //可点击高度
 | |
|     //构造函数
 | |
|     constructor(gObj, gButtonName, gX, gY, gAnifile, gWidth, gLength) {
 | |
|         obj = gObj;
 | |
|         buttonName = gButtonName;
 | |
|         x = gX;
 | |
|         y = gY;
 | |
|         BaseAnifile = gAnifile;
 | |
|         width = gWidth;
 | |
|         length = gLength;
 | |
|     }
 | |
|     //绘制按钮
 | |
|     function DrawButton() {
 | |
|         if (isDown()) y++;
 | |
| 
 | |
|         T_DrawDynamicAni(obj, BaseAnifile, x, y, buttonName);
 | |
|         if (isInRect()) {
 | |
| 
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     function isInRect() {
 | |
|         local mouseX = IMouse.GetXPos();
 | |
|         local mouseY = IMouse.GetYPos();
 | |
|         if (sq_IsIntersectRect(mouseX, mouseY, 5, 5, x, y, width, length))
 | |
|             return true;
 | |
|         return false;
 | |
|     }
 | |
| 
 | |
|     function isDown() {
 | |
|         if (isInRect() && IMouse.IsLBDown()) {
 | |
|             obj.getVar(buttonName).setBool(0, true);
 | |
|             return true;
 | |
|         }
 | |
|         return false;
 | |
|     }
 | |
| 
 | |
|     function isActive() {
 | |
|         if (isInRect() && IMouse.IsLBUp() && obj.getVar(buttonName).getBool(0)) {
 | |
|             obj.getVar(buttonName).setBool(0, false);
 | |
|             return true;
 | |
|         }
 | |
|         return false;
 | |
|     }
 | |
| }
 | |
| //HudPro按钮类
 | |
| class ButtonPro extends BasicsDrawTool //  obj  --  按钮名称  --  X坐标  --  Y坐标  --  Ani调用路径  --  宽度  --  高度
 | |
| {
 | |
|     obj = null; //Obj对象
 | |
|     State = 0; //按钮状态
 | |
|     ClickEnble = false; //点击效果
 | |
|     ButtonDynamic = false; //动态按钮效果
 | |
| 
 | |
|     CustomClickEnble = false; //自定义点击效果
 | |
|     CustomClickAnifile = null; //自定义点击效果Ani路径
 | |
|     CustomButtonName = null; //自定义点击效果名称
 | |
|     CustomClickFrame = null; //自定义点击效果Ani编号
 | |
|     CustomClickx = null; //自定义点击效果X坐标
 | |
|     CustomClicky = null; //自定义点击效果Y坐标
 | |
| 
 | |
| 
 | |
|     RectEnble = false; //悬停效果
 | |
|     RectButtonName = null; //悬停名称
 | |
|     RectBaseAnifile = null; //悬停Ani路径
 | |
|     RectFrame = null; //非动态按钮的悬停调用Ani编号
 | |
|     Rectx = null; //悬停X坐标
 | |
|     Recty = null; //悬停Y坐标
 | |
| 
 | |
| 
 | |
|     ButtonName = null; //按钮名称
 | |
|     x = null; //X坐标
 | |
|     y = null; //Y坐标
 | |
|     BaseAnifile = null; //调用Ani路径
 | |
|     width = null; //可点击宽度
 | |
|     length = null; //可点击高度
 | |
|     //构造函数
 | |
|     constructor(gObj, gButtonName, gX, gY, gAnifile, gWidth, gLength) {
 | |
|         obj = gObj;
 | |
|         ButtonName = gButtonName;
 | |
|         x = gX;
 | |
|         y = gY;
 | |
|         BaseAnifile = gAnifile;
 | |
|         width = gWidth;
 | |
|         length = gLength;
 | |
|     }
 | |
|     //绘制按钮
 | |
|     function Show() {
 | |
|         if (ClickEnble) //是否开启点击效果
 | |
|         {
 | |
|             if (isLBDown() && State == 0) //按下左键并且按钮处于弹起状态
 | |
|             {
 | |
|                 State = 1; //按键进入按下状态
 | |
|                 ++y;
 | |
|             }
 | |
|             if (!isLBDown() && State == 1) //按下左键并且按钮处于弹起状态
 | |
|             {
 | |
|                 State = 0; //按键进入弹起状态
 | |
|                 --y;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         if (CustomClickEnble) //是否开启自定义点击效果
 | |
|         {
 | |
|             if (isLBDown()) //按下左键并且按钮处于弹起状态
 | |
|             {
 | |
|                 if (!ButtonDynamic) T_DrawStayAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomClickFrame, CustomButtonName);
 | |
|                 else T_DrawDynamicAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomButtonName);
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         if (RectEnble) //开启悬停效果时
 | |
|         {
 | |
|             if ((isInRect() && !isLBDown()) || (isInRect() && !CustomClickEnble)) //如果鼠标悬停的时候  并且没有点击的时候
 | |
|             {
 | |
|                 //IMouse.SetMouseTask(44);
 | |
|                 if (!ButtonDynamic) T_DrawStayAni(obj, RectBaseAnifile, Rectx, Recty, RectFrame, RectButtonName);
 | |
|                 else T_DrawDynamicAni(obj, RectBaseAnifile, Rectx, Recty, RectButtonName);
 | |
|             }
 | |
|         }
 | |
|         if (!isInRect()) //如果鼠标没有悬停的时候
 | |
|         {
 | |
|             //IMouse.SetMouseTask(0);
 | |
|             if (!ButtonDynamic) T_DrawStayAni(obj, BaseAnifile, x, y, 0, ButtonName);
 | |
|             else T_DrawDynamicAni(obj, BaseAnifile, x, y, ButtonName);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     //设置自定义点击效果
 | |
|     function SetCustomClickEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) {
 | |
|         CustomClickEnble = bool; //自定义点击效果
 | |
|         CustomClickAnifile = gAnifile; //自定义点击效果Ani路径
 | |
|         CustomButtonName = gButtonName; //自定义点击效果名称
 | |
|         CustomClickFrame = gFrame; //自定义点击效果Ani编号
 | |
|         CustomClickx = gX; //自定义点击效果X坐标
 | |
|         CustomClicky = gY; //自定义点击效果Y坐标
 | |
|     }
 | |
| 
 | |
|     //设置悬停效果
 | |
|     function SetRectEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) {
 | |
|         RectEnble = bool; //悬停效果
 | |
|         RectButtonName = gButtonName; //悬停名称
 | |
|         RectBaseAnifile = gAnifile; //悬停Ani路径
 | |
|         RectFrame = gFrame; //非动态按钮的悬停调用Ani编号
 | |
|         Rectx = gX; //悬停X坐标
 | |
|         Recty = gY; //悬停Y坐标
 | |
|     }
 | |
| 
 | |
|     //设置动态按钮
 | |
|     function SetClickEnble(bool) {
 | |
|         ButtonDynamic = bool;
 | |
|     }
 | |
| 
 | |
|     //设置点击效果
 | |
|     function SetClickEnble(bool) {
 | |
|         ClickEnble = bool;
 | |
|     }
 | |
| 
 | |
|     //悬停状态
 | |
|     function isInRect() {
 | |
|         if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 5, 5, x, y, width, length)) return true;
 | |
|         else return false;
 | |
|     }
 | |
|     //左键按下状态
 | |
|     function isLBDown() {
 | |
|         if (isInRect() && IMouse.GetLButton() == 1) return true;
 | |
|         else return false;
 | |
|     }
 | |
|     //左键弹起状态
 | |
|     function isLBUp() {
 | |
|         if (isInRect() && IMouse.GetLButton() == 0) return true;
 | |
|         else return false;
 | |
|     }
 | |
|     //左键双击状态
 | |
|     function IsLBDoubleClick() {
 | |
|         if (isInRect() && IMouse.GetLButton() == 64) return true;
 | |
|         else return false;
 | |
|     }
 | |
|     //左键单击状态
 | |
|     function isLBActive() {
 | |
|         if (isInRect() && IMouse.isButtonUpEvent()) return true;
 | |
|         else return false;
 | |
|     }
 | |
| }
 | |
| //SwitchButtonPro按钮类
 | |
| class SwitchButtonPro extends BasicsDrawTool //  obj  --  按钮名称  --  X坐标  --  Y坐标  --  Ani调用路径  --  宽度  --  高度
 | |
| {
 | |
|     obj = null; //Obj对象
 | |
|     State = 0; //按钮状态
 | |
|     ClickEnble = false; //点击效果
 | |
|     ButtonDynamic = false; //动态按钮效果
 | |
|     SwitchState = false; //复选框是否选中
 | |
| 
 | |
|     CustomClickEnble = false; //自定义点击效果
 | |
|     CustomClickAnifile = null; //自定义点击效果Ani路径
 | |
|     CustomButtonName = null; //自定义点击效果名称
 | |
|     CustomClickFrame = null; //自定义点击效果Ani编号
 | |
|     CustomClickx = null; //自定义点击效果X坐标
 | |
|     CustomClicky = null; //自定义点击效果Y坐标
 | |
| 
 | |
| 
 | |
|     RectEnble = false; //悬停效果
 | |
|     RectButtonName = null; //悬停名称
 | |
|     RectBaseAnifile = null; //悬停Ani路径
 | |
|     RectFrame = null; //非动态按钮的悬停调用Ani编号
 | |
|     Rectx = null; //悬停X坐标
 | |
|     Recty = null; //悬停Y坐标
 | |
| 
 | |
| 
 | |
|     ButtonName = null; //按钮名称
 | |
|     x = null; //X坐标
 | |
|     y = null; //Y坐标
 | |
|     BaseAnifile = null; //调用Ani路径
 | |
|     BaseAnifileFrame = null; //调用的Ani帧数
 | |
|     width = null; //可点击宽度
 | |
|     length = null; //可点击高度
 | |
|     //构造函数
 | |
|     constructor(gObj, gButtonName, gX, gY, gAnifile, gBaseAnifileFrame, gWidth, gLength) {
 | |
|         obj = gObj;
 | |
|         ButtonName = gButtonName;
 | |
|         x = gX;
 | |
|         y = gY;
 | |
|         BaseAnifile = gAnifile;
 | |
|         BaseAnifileFrame = gBaseAnifileFrame;
 | |
|         width = gWidth;
 | |
|         length = gLength;
 | |
|     }
 | |
|     //绘制按钮
 | |
|     function Show() {
 | |
|         if (ClickEnble) //是否开启点击效果
 | |
|         {
 | |
|             if (isLBDown() && State == 0) //按下左键并且按钮处于弹起状态
 | |
|             {
 | |
|                 State = 1; //按键进入按下状态
 | |
|                 ++y;
 | |
|             }
 | |
|             if (!isLBDown() && State == 1) //按下左键并且按钮处于弹起状态
 | |
|             {
 | |
|                 State = 0; //按键进入弹起状态
 | |
|                 --y;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         if (CustomClickEnble) //是否开启自定义点击效果
 | |
|         {
 | |
|             if (isLBDown()) //按下左键并且按钮处于弹起状态
 | |
|             {
 | |
|                 if (!ButtonDynamic) T_DrawStayAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomClickFrame, CustomButtonName);
 | |
|                 else T_DrawDynamicAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomButtonName);
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         if (RectEnble) //开启悬停效果时
 | |
|         {
 | |
|             if ((isInRect() && !isLBDown()) || (isInRect() && !CustomClickEnble)) //如果鼠标悬停的时候  并且没有点击的时候
 | |
|             {
 | |
|                 //IMouse.SetMouseTask(44);
 | |
|                 if (!ButtonDynamic) T_DrawStayAni(obj, RectBaseAnifile, Rectx, Recty, RectFrame, RectButtonName);
 | |
|                 else T_DrawDynamicAni(obj, RectBaseAnifile, Rectx, Recty, RectButtonName);
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         if (!isInRect() && !SwitchState) //如果鼠标没有悬停的时候
 | |
|         {
 | |
|             //IMouse.SetMouseTask(0);
 | |
|             if (!ButtonDynamic) T_DrawStayAni(obj, BaseAnifile, x, y, BaseAnifileFrame, ButtonName);
 | |
|             else T_DrawDynamicAni(obj, BaseAnifile, x, y, ButtonName);
 | |
|         }
 | |
| 
 | |
|         if (!isInRect() && SwitchState) {
 | |
|             if (!ButtonDynamic) T_DrawStayAni(obj, RectBaseAnifile, Rectx, Recty, RectFrame, RectButtonName);
 | |
|             else T_DrawDynamicAni(obj, RectBaseAnifile, Rectx, Recty, RectButtonName);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     //设置自定义点击效果
 | |
|     function SetCustomClickEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) {
 | |
|         CustomClickEnble = bool; //自定义点击效果
 | |
|         CustomClickAnifile = gAnifile; //自定义点击效果Ani路径
 | |
|         CustomButtonName = gButtonName; //自定义点击效果名称
 | |
|         CustomClickFrame = gFrame; //自定义点击效果Ani编号
 | |
|         CustomClickx = gX; //自定义点击效果X坐标
 | |
|         CustomClicky = gY; //自定义点击效果Y坐标
 | |
|     }
 | |
| 
 | |
|     //设置悬停效果
 | |
|     function SetRectEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) {
 | |
|         RectEnble = bool; //悬停效果
 | |
|         RectButtonName = gButtonName; //悬停名称
 | |
|         RectBaseAnifile = gAnifile; //悬停Ani路径
 | |
|         RectFrame = gFrame; //非动态按钮的悬停调用Ani编号
 | |
|         Rectx = gX; //悬停X坐标
 | |
|         Recty = gY; //悬停Y坐标
 | |
|     }
 | |
| 
 | |
|     //设置动态按钮
 | |
|     function SetClickEnble(bool) {
 | |
|         ButtonDynamic = bool;
 | |
|     }
 | |
| 
 | |
|     //设置点击效果
 | |
|     function SetClickEnble(bool) {
 | |
|         ClickEnble = bool;
 | |
|     }
 | |
| 
 | |
|     //悬停状态
 | |
|     function isInRect() {
 | |
|         if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 5, 5, x, y, width, length)) return true;
 | |
|         else return false;
 | |
|     }
 | |
|     //左键按下状态
 | |
|     function isLBDown() {
 | |
|         if (isInRect() && IMouse.GetLButton() == 1) return true;
 | |
|         else return false;
 | |
|     }
 | |
|     //左键弹起状态
 | |
|     function isLBUp() {
 | |
|         if (isInRect() && IMouse.GetLButton() == 0) return true;
 | |
|         else return false;
 | |
|     }
 | |
|     //左键双击状态
 | |
|     function IsLBDoubleClick() {
 | |
|         if (isInRect() && IMouse.GetLButton() == 64) return true;
 | |
|         else return false;
 | |
|     }
 | |
|     //左键单击状态
 | |
|     function isLBActive() {
 | |
|         if (isInRect() && IMouse.isButtonUpEvent()) return true;
 | |
|         else return false;
 | |
|     }
 | |
| }
 | |
| //设置窗口SwitchButtonPro按钮继承类
 | |
| class SettingWindowSwitchButtonPro extends SwitchButtonPro {
 | |
| 
 | |
|     SwitchStateAniName = null;
 | |
|     SwitchStateAniFile = null;
 | |
|     SwitchStateAniFrame = null;
 | |
| 
 | |
|     //绘制按钮
 | |
|     function Show() {
 | |
|         if (ClickEnble) //是否开启点击效果
 | |
|         {
 | |
|             if (isLBDown() && State == 0) //按下左键并且按钮处于弹起状态
 | |
|             {
 | |
|                 State = 1; //按键进入按下状态
 | |
|                 ++y;
 | |
|             }
 | |
|             if (!isLBDown() && State == 1) //按下左键并且按钮处于弹起状态
 | |
|             {
 | |
|                 State = 0; //按键进入弹起状态
 | |
|                 --y;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         if (CustomClickEnble) //是否开启自定义点击效果
 | |
|         {
 | |
|             if (isLBDown()) //按下左键并且按钮处于弹起状态
 | |
|             {
 | |
|                 if (!ButtonDynamic) T_DrawStayAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomClickFrame, CustomButtonName);
 | |
|                 else T_DrawDynamicAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomButtonName);
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         if (RectEnble) //开启悬停效果时
 | |
|         {
 | |
|             if ((isInRect() && !isLBDown()) || (isInRect() && !CustomClickEnble) && !SwitchState) //如果鼠标悬停的时候  并且没有点击的时候
 | |
|             {
 | |
|                 //IMouse.SetMouseTask(44);
 | |
|                 if (!ButtonDynamic) T_DrawStayAni(obj, RectBaseAnifile, Rectx, Recty, RectFrame, RectButtonName);
 | |
|                 else T_DrawDynamicAni(obj, RectBaseAnifile, Rectx, Recty, RectButtonName);
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         if (!isInRect() && !SwitchState) //如果鼠标没有悬停的时候
 | |
|         {
 | |
|             //IMouse.SetMouseTask(0);
 | |
|             if (!ButtonDynamic) T_DrawStayAni(obj, BaseAnifile, x, y, BaseAnifileFrame, ButtonName);
 | |
|             else T_DrawDynamicAni(obj, BaseAnifile, x, y, ButtonName);
 | |
|         }
 | |
| 
 | |
|         if (SwitchState) {
 | |
|             if (!ButtonDynamic) T_DrawStayAni(obj, SwitchStateAniFile, Rectx, Recty, SwitchStateAniFrame, SwitchStateAniName);
 | |
|             else T_DrawDynamicAni(obj, RectBaseAnifile, Rectx, Recty, RectButtonName);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     function SetSwitchStateAni(gButtonName, gAnifile, gFrame) {
 | |
|         SwitchStateAniName = gButtonName;
 | |
|         SwitchStateAniFile = gAnifile;
 | |
|         SwitchStateAniFrame = gFrame;
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 | |
| //STL容器类
 | |
| class STL {
 | |
|     thisname = null;
 | |
|     Type = null;
 | |
|     constructor(G_thisname, G_Type) {
 | |
|         thisname = G_thisname;
 | |
|         local NameType = typeof(thisname);
 | |
|         if (NameType != "string") return;
 | |
|         Type = G_Type;
 | |
| 
 | |
|         L_New_STL(thisname, Type);
 | |
|     }
 | |
|     //设置容器值
 | |
|     function Set_STL(Idx, Value) {
 | |
|         return L_Set_STL(thisname, Type, Idx, Value);
 | |
|     }
 | |
|     //获取容器值
 | |
|     function Get_STL(Idx) {
 | |
|         return L_Get_STL(thisname, Type, Idx);
 | |
|     }
 | |
| }
 | |
| //STL 时间容器类
 | |
| class TimeSTL {
 | |
|     thisname = null; //时间容器名称
 | |
|     MaxTime = null; //时间容器最大时间
 | |
|     //构造时间容器
 | |
|     constructor(G_thisname, G_MaxTime) {
 | |
|         thisname = G_thisname;
 | |
|         local NameType = typeof(thisname);
 | |
|         if (NameType != "string") return;
 | |
|         MaxTime = G_MaxTime;
 | |
| 
 | |
|         L_Timer_STL(thisname, MaxTime, 0); //创建时间容器
 | |
|     }
 | |
|     //开启时间容器  非Proc环境
 | |
|     function Start() {
 | |
|         return L_Timer_STL(thisname, MaxTime, 1);
 | |
|     }
 | |
|     //获取时间容器值
 | |
|     function Get() {
 | |
|         return L_Timer_STL(thisname, MaxTime, 2);
 | |
|     }
 | |
|     //重置时间容器  非Proc环境
 | |
|     function Reset() {
 | |
|         return L_Timer_STL(thisname, MaxTime, 3);
 | |
|     }
 | |
|     //暂停时间容器  非Proc环境
 | |
|     function Stop() {
 | |
|         return L_Timer_STL(thisname, MaxTime, 4);
 | |
|     }
 | |
|     //继续时间容器  非Proc环境
 | |
|     function Run() {
 | |
|         return L_Timer_STL(thisname, MaxTime, 5);
 | |
|     }
 | |
|     //销毁时间容器  非Proc环境
 | |
|     function Delete() {
 | |
|         return L_Timer_STL(thisname, MaxTime, 6);
 | |
|     }
 | |
| }
 | |
| //STL Json容器类
 | |
| class Json_STL {
 | |
|     thisname = null; //Json容器名称
 | |
|     state = null;
 | |
|     //构造Json容器
 | |
|     constructor(G_thisname) {
 | |
|         thisname = G_thisname;
 | |
|         local NameType = typeof(thisname);
 | |
|         if (NameType != "string") return;
 | |
|         state = L_Json_STL(thisname, 0); //创建Json容器
 | |
|     }
 | |
|     //从str构造Json包
 | |
|     function Parse(Str, Type, Retain) {
 | |
|         return L_Json_STL(thisname, Str, Type, Retain);
 | |
|     }
 | |
|     //构造Json包
 | |
|     function Put(key, value) {
 | |
|         return L_Json_STL(thisname, key, value);
 | |
|     }
 | |
|     //查询Json包
 | |
|     function GetString() {
 | |
|         return L_Json_STL(thisname, 1);
 | |
|     }
 | |
|     //查询Json包
 | |
|     function Get(key) {
 | |
|         return L_Json_STL(thisname, key);
 | |
|     }
 | |
|     //销毁Json包
 | |
|     function Delete() {
 | |
|         return L_Json_STL(thisname, 2);
 | |
|     }
 | |
|     //通过Table构造Json字符串
 | |
|     function Encode(Table) {
 | |
|         local Size = Table.len();
 | |
|         local Pos = 0;
 | |
|         local Str = "{";
 | |
|         foreach(Key, Value in Table) {
 | |
|             ++Pos;
 | |
|             Str += "\"";
 | |
|             Str += Key.tostring();
 | |
|             Str += "\"";
 | |
|             Str += ":";
 | |
|             if (typeof(Value) == "string") {
 | |
|                 Str += "\"";
 | |
|                 Str += Value;
 | |
|                 Str += "\"";
 | |
|             } else Str += Value;
 | |
|             if (Pos != Size) Str += ",";
 | |
|         }
 | |
|         Str += "}";
 | |
|         return Str;
 | |
|     }
 | |
| 
 | |
| }
 | |
| //Key 键盘按键类
 | |
| class KeyPress {
 | |
|     function KeyDown(obj, KeyValue) {
 | |
|         local KeyEvent = obj.getVar(KeyValue.tostring()); //声明储存器
 | |
|         KeyEvent.clear_vector(); //清空储存器的向量位
 | |
|         if (sq_IsKeyDown(KeyValue, ENUM_SUBKEY_TYPE_ALL) && KeyEvent.getInt(0) == 0) {
 | |
|             KeyEvent.setInt(0, 1);
 | |
|             return true;
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     function KeyUp(obj, KeyValue) {
 | |
|         local KeyEvent = obj.getVar(KeyValue.tostring()); //声明储存器
 | |
|         if (sq_IsKeyUp(KeyValue, ENUM_SUBKEY_TYPE_ALL)) {
 | |
|             KeyEvent.setInt(0, 0);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     function isKeyPress(KeyValue) {
 | |
|         local obj = sq_GetMyMasterCharacter();
 | |
|         if (KeyPress.KeyDown(obj, KeyValue)) {
 | |
|             return true;
 | |
|         }
 | |
|         KeyPress.KeyUp(obj, KeyValue);
 | |
|     }
 | |
| }
 | |
| 
 | |
| //Key 键盘按键类
 | |
| class KeyPressNB {
 | |
|     function KeyDown(obj, KeyValue, VarKey) {
 | |
|         local KeyEvent = obj.getVar(VarKey); //声明储存器
 | |
|         KeyEvent.clear_vector(); //清空储存器的向量位
 | |
|         if (sq_IsKeyDown(KeyValue, ENUM_SUBKEY_TYPE_ALL) && KeyEvent.getInt(0) == 0) {
 | |
|             KeyEvent.setInt(0, 1);
 | |
|             return true;
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     function KeyUp(obj, KeyValue, VarKey) {
 | |
|         local KeyEvent = obj.getVar(VarKey); //声明储存器
 | |
|         if (sq_IsKeyUp(KeyValue, ENUM_SUBKEY_TYPE_ALL)) {
 | |
|             KeyEvent.setInt(0, 0);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     function isKeyPress(KeyValue, VarKey) {
 | |
|         local obj = sq_GetMyMasterCharacter();
 | |
|         if (KeyPressNB.KeyDown(obj, KeyValue, VarKey)) {
 | |
|             return true;
 | |
|         }
 | |
|         KeyPressNB.KeyUp(obj, KeyValue, VarKey);
 | |
|     }
 | |
| }
 | |
| 
 | |
| class System {
 | |
| 
 | |
|     //将值以数组形式插入Table
 | |
|     function InsertArrayInTable(TableObj, Key, FlagKey, Value) {
 | |
|         local Tab;
 | |
|         if (TableObj.rawin(Key)) {
 | |
|             Tab = TableObj[Key];
 | |
|         } else {
 | |
|             Tab = {};
 | |
|         }
 | |
|         Tab.rawset(FlagKey, Value);
 | |
|         TableObj.rawset(Key, Tab);
 | |
|     }
 | |
| 
 | |
| }
 | |
| //游戏计算类
 | |
| class GameC {
 | |
|     //抛物线函数计算
 | |
|     function getQuadraticFunction(obj, x, b, c) {
 | |
|         local a = (-b.tofloat() * 4) / (c.tofloat() * c.tofloat());
 | |
|         return a.tofloat() * (x.tofloat() - c.tofloat() / 2) * (x.tofloat() - c.tofloat() / 2) + b.tofloat();
 | |
|     }
 | |
| 
 | |
|     function RemoveObjectAppend(obj, str) {
 | |
|         local objectManager = obj.getObjectManager();
 | |
|         for (local i = 0; i < objectManager.getCollisionObjectNumber(); i += 1) {
 | |
|             local object = objectManager.getCollisionObject(i);
 | |
|             local appendage = CNSquirrelAppendage.sq_GetAppendage(object, str);
 | |
|             if (appendage) {
 | |
|                 appendage.sq_DeleteAppendages();
 | |
|                 CNSquirrelAppendage.sq_RemoveAppendage(obj, str);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     //找到矩形范围敌人
 | |
|     function findRoundNearAllEnemyRect(obj, Xvar, Yvar, Dct) {
 | |
|         local ObjTab = [];
 | |
|         local objectManager = obj.getObjectManager();
 | |
|         for (local i = 0; i < objectManager.getCollisionObjectNumber(); i += 1) {
 | |
|             local object = objectManager.getCollisionObject(i);
 | |
|             if (object && obj.isEnemy(object) && object.isObjectType(OBJECTTYPE_ACTIVE)) {
 | |
|                 switch (Dct) {
 | |
|                     case 0:
 | |
|                         local Distance = sq_GetDistance(obj.getXPos(), obj.getYPos(), object.getXPos(), object.getYPos(), true);
 | |
|                         local Xoffset = obj.getXPos() - object.getXPos();
 | |
|                         if (Xoffset >= 0 && Xoffset <= Xvar && sqrt((Distance * Distance) - (Xoffset * Xoffset)) <= Yvar) {
 | |
|                             ObjTab.append(object);
 | |
|                         }
 | |
|                         break;
 | |
|                     case 1:
 | |
|                         local Distance = sq_GetDistance(obj.getXPos(), obj.getYPos(), object.getXPos(), object.getYPos(), true);
 | |
|                         local Xoffset = object.getXPos() - obj.getXPos();
 | |
|                         if (Xoffset >= 0 && Xoffset <= Xvar && sqrt((Distance * Distance) - (Xoffset * Xoffset)) <= Yvar) {
 | |
|                             ObjTab.append(object);
 | |
|                         }
 | |
|                         break;
 | |
|                     case 2:
 | |
|                         local Distance = sq_GetDistance(obj.getXPos(), obj.getYPos(), object.getXPos(), object.getYPos(), true);
 | |
|                         local Yoffset = obj.getYPos() - object.getYPos();
 | |
|                         if (Yoffset >= 0 && Yoffset <= Yvar && sqrt((Distance * Distance) - (Yoffset * Yoffset)) <= Xvar) {
 | |
|                             ObjTab.append(object);
 | |
|                         }
 | |
|                         break;
 | |
|                     case 3:
 | |
|                         local Distance = sq_GetDistance(obj.getXPos(), obj.getYPos(), object.getXPos(), object.getYPos(), true);
 | |
|                         local Yoffset = object.getYPos() - obj.getYPos();
 | |
|                         if (Yoffset >= 0 && Yoffset <= Yvar && sqrt((Distance * Distance) - (Yoffset * Yoffset)) <= Xvar) {
 | |
|                             ObjTab.append(object);
 | |
|                         }
 | |
|                         break;
 | |
|                     default:
 | |
|                         break;
 | |
|                 }
 | |
| 
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         return ObjTab;
 | |
|     }
 | |
| 
 | |
|     //召唤怪物   --  obj  --  怪物ID  --  怪物等级  --  怪物存在时间  --  出现X坐标  --  出现Y坐标  --  出现Z坐标
 | |
|     function sendSummonMonsterPacketWithFriend(obj, monsterID, level, summonTime, posx, posy, posz, camp) {
 | |
|         sq_BinaryStartWrite();
 | |
|         sq_BinaryWriteByte(0); //出现方式
 | |
|         sq_BinaryWriteDword(monsterID); //怪物编号
 | |
|         sq_BinaryWriteWord(camp); //阵营
 | |
|         sq_BinaryWriteByte(level); //等级
 | |
|         sq_BinaryWriteWord(-1); //未知
 | |
|         sq_BinaryWriteWord(0); //未知
 | |
|         sq_BinaryWriteByte(1); //未知
 | |
|         sq_BinaryWriteByte(2); //未知
 | |
|         sq_BinaryWriteByte(0); //未知
 | |
|         sq_BinaryWriteDword(summonTime); //存在时间
 | |
|         sq_BinaryWriteDword(-1); //未知
 | |
|         sq_BinaryWriteByte(2); //未知
 | |
|         sq_SendCreatePassiveObjectPacketPos(obj, 30562, 0, posx, posy, posz);
 | |
|         sq_SendCreatePassiveObjectPacketPos(obj, 48024, 0, posx, posy, posz);
 | |
|     }
 | |
| 
 | |
|     //销毁特效
 | |
|     function DestroyPassiveObject(obj, Index) {
 | |
|         local ballCount = obj.getMyPassiveObjectCount(Index);
 | |
|         for (local i = 0; i < ballCount; ++i) {
 | |
|             local magicBall = obj.getMyPassiveObject(Index, i)
 | |
|             if (!magicBall)
 | |
|                 continue;
 | |
|             if (obj.sq_IsMyControlObject()) {
 | |
|                 sq_SendDestroyPacketPassiveObject(magicBall);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     //获取通用Ap
 | |
|     function getCurrencyAppendage(obj) {
 | |
|         if (!CNSquirrelAppendage.sq_IsAppendAppendage(obj, "appendage/currency.nut")) {
 | |
|             local appendage = CNSquirrelAppendage.sq_AppendAppendage(obj, obj, 174, false, "appendage/currency.nut", true);
 | |
|             return appendage;
 | |
|         } else {
 | |
|             return obj.GetSquirrelAppendage("appendage/currency.nut");
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 | |
| //活动图标类
 | |
| class EventIcon extends BasicsDrawTool {
 | |
|     //Key
 | |
|     Key = null;
 | |
|     //活动图标文字
 | |
|     EventStr = null;
 | |
|     //活动图标Ani编号
 | |
|     EventFrame = null;
 | |
|     //鼠标对象
 | |
|     Mobj = null;
 | |
|     //绑定对象
 | |
|     BandObject = null;
 | |
| 
 | |
|     x = null;
 | |
|     y = null;
 | |
| 
 | |
|     constructor(gEventStr, gEventFrame, gKey, gBandObject) {
 | |
|         this.EventStr = gEventStr;
 | |
|         this.EventFrame = gEventFrame;
 | |
|         this.Key = gKey;
 | |
|         this.BandObject = gBandObject;
 | |
|         if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
 | |
| 
 | |
|         local RootTab = getroottable();
 | |
|         if (RootTab.rawin("YosinEventSystem")) {
 | |
|             local Arr = RootTab["YosinEventSystem"];
 | |
|             local TryAppend = true;
 | |
|             local wpos;
 | |
|             foreach(pos , value in Arr) {
 | |
|                 if (value.Key == this.Key) {
 | |
|                     TryAppend = false;
 | |
|                     wpos = pos;
 | |
|                 }
 | |
|             }
 | |
|             if (TryAppend) {
 | |
|                 Arr.append(this);
 | |
|                 RootTab.rawset("YosinEventSystem", Arr);
 | |
|             }
 | |
|             else{
 | |
|                 Arr[wpos] = this;
 | |
|                 RootTab.rawset("YosinEventSystem", Arr);
 | |
|             }
 | |
|         } else {
 | |
|             local Arr = [];
 | |
|             Arr.append(this);
 | |
|             RootTab.rawset("YosinEventSystem", Arr);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     function Show(obj, X, Y) {
 | |
|         x = X;
 | |
|         y = Y;
 | |
| 
 | |
|         //绘制框
 | |
|         T_DrawDynamicAni(obj, "common/yosinevent/eventsystemeff.ani", X, Y, "YosinEventIconEffA");
 | |
| 
 | |
|         try {
 | |
|             if (isLBDown()) {
 | |
|                 //绘制活动图标
 | |
|                 L_sq_DrawImg("interface2/yosin/eventsystemlist.img", EventFrame, X, Y + 1);
 | |
|                 //T_DrawStayAni(obj, "common/yosinevent/eventsystemlist.ani", X, Y + 1, EventFrame, "YosinEventIconKey" + Key);
 | |
|             } else {
 | |
|                 //绘制活动图标
 | |
|                 L_sq_DrawImg("interface2/yosin/eventsystemlist.img", EventFrame, X, Y);
 | |
|             }
 | |
|         } catch (exception) {
 | |
|             if (isLBDown()) {
 | |
|                 //绘制活动图标
 | |
|                 T_DrawStayAni(obj, "common/yosinevent/eventsystemlist.ani", X, Y + 1, EventFrame, "YosinEventIconKey" + Key);
 | |
|             } else {
 | |
|                 //绘制活动图标
 | |
|                 T_DrawStayAni(obj, "common/yosinevent/eventsystemlist.ani", X, Y, EventFrame, "YosinEventIconKey" + Key);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     function StrShow(obj, X, Y) {
 | |
|         //悬停
 | |
|         if (isInRect() && EventStr) {
 | |
|             local count = EventStr.len() / 3;
 | |
|             T_DrawStayAni(obj, "common/yosinevent/eventsystem.ani", X - (count * 7), Y - 24, 0, "YosinEventIconStrEffL");
 | |
|             for (local i = 0; i < count; i++) {
 | |
|                 T_DrawStayAni(obj, "common/yosinevent/eventsystem.ani", X - (count * 7) + 5 + (i * 15), Y - 24, 1, "YosinEventIconStrEffZ");
 | |
|             }
 | |
|             T_DrawStayAni(obj, "common/yosinevent/eventsystem.ani", X - (count * 7) + 5 + (count * 15), Y - 24, 2, "YosinEventIconStrEffR");
 | |
|             L_sq_DrawCode(EventStr, X - (count * 4), Y - 17, sq_RGBA(255, 255, 255, 250), 0, 1);
 | |
|         }
 | |
|         if (isLBActive()) {
 | |
|             BandObject.MainState = true;
 | |
|             BandObject.OpenClassCallBack();
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     //悬停状态
 | |
|     function isInRect() {
 | |
|         if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, x, y, 20, 20)) return true;
 | |
|         else return false;
 | |
|     }
 | |
|     //左键按下状态
 | |
|     function isLBDown() {
 | |
|         if (isInRect() && Mobj.Lb == 1) return true;
 | |
|         else return false;
 | |
|     }
 | |
|     //左键弹起状态
 | |
|     function isLBUp() {
 | |
|         if (isInRect() && Mobj.Lb == 0) return true;
 | |
|         else return false;
 | |
|     }
 | |
| 
 | |
|     //左键单击状态
 | |
|     function isLBActive() {
 | |
|         if (isInRect() && Mobj.LbEvent) return true;
 | |
|         else return false;
 | |
|     }
 | |
| }
 | |
| 
 | |
| function YosinEventIconInfoCallBack(Chunk) {
 | |
|     local Buffer = Json_STL("YosinEventIconInfoCallBack_Json");
 | |
|     Buffer.Parse(Chunk, 0, false);
 | |
| 
 | |
|     local RootTab = getroottable();
 | |
|     local X = Buffer.Get("YosinEventIconInfoXpos");
 | |
|     local Y = Buffer.Get("YosinEventIconInfoYpos");
 | |
|     RootTab.rawset("YosinEventIconInfoXpos", X);
 | |
|     RootTab.rawset("YosinEventIconInfoYpos", Y);
 | |
| }
 | |
| 
 | |
| Pack_Control.rawset(30002, YosinEventIconInfoCallBack);
 | |
| //绘制娱心活动图标
 | |
| function DrawYosinEventIconSystem(obj) {
 | |
| 
 | |
|     local X = 600;
 | |
|     local Y = 527;
 | |
|     local RootTab = getroottable();
 | |
|     if (!RootTab.rawin("YosinGetUserInfo") && L_sq_RA(0x1A5FB4C, "0x14+0x28+") >= 1) {
 | |
|         local T = {
 | |
|             op = 30000
 | |
|         }
 | |
|         local str = Json.Encode(T);
 | |
|         L_sq_SendPackType(130);
 | |
|         L_sq_SendPackWChar(str);
 | |
|         L_sq_SendPack();
 | |
|         RootTab.rawset("YosinGetUserInfo", true);
 | |
|     }
 | |
|     if (RootTab.rawin("YosinEventIconInfoXpos")) X = RootTab["YosinEventIconInfoXpos"];
 | |
|     if (RootTab.rawin("YosinEventIconInfoYpos")) Y = RootTab["YosinEventIconInfoYpos"];
 | |
| 
 | |
|     local BaseEventCount = L_sq_RA(L_sq_RA(0x1A39C2C) + 0x6c);
 | |
|     local DrawCount = BaseEventCount;
 | |
|     local StrDrawCount = BaseEventCount;
 | |
|     if (RootTab.rawin("YosinEventSystem")) {
 | |
|         local EventArr = RootTab["YosinEventSystem"];
 | |
|         local OneLineOffset = BaseEventCount * 20;
 | |
|         local Draw = true;
 | |
|         //先遍历一遍看看有没有窗口被打开
 | |
|         foreach(E in EventArr) {
 | |
|             if (E.BandObject.MainState == true) {
 | |
|                 Draw = false;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         foreach(V in EventArr) {
 | |
|             V.Show(obj, X + ((DrawCount % 8) * 20), Y - ((DrawCount / 8) * 20));
 | |
|             DrawCount++;
 | |
|         }
 | |
|         //如果窗口被打开就不再显示悬停文字
 | |
|         if (Draw) {
 | |
|             foreach(SV in EventArr) {
 | |
|                 SV.StrShow(obj, X + ((StrDrawCount % 8) * 20), Y - ((StrDrawCount / 8) * 20));
 | |
|                 StrDrawCount++;
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
| }
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| class PlayerEachIcon extends BasicsDrawTool {
 | |
|     Name = null;
 | |
|     X = null;
 | |
|     Y = null;
 | |
|     //鼠标对象
 | |
|     Mobj = null;
 | |
| 
 | |
|     PlayerName = null;
 | |
|     DrawSwitch = false;
 | |
|     Func = null;
 | |
| 
 | |
|     constructor(gName, gFunc) {
 | |
|         Name = gName;
 | |
|         Func = gFunc;
 | |
|         if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
 | |
| 
 | |
|         local RootTab = getroottable();
 | |
|         if (RootTab.rawin("YosinPlayerEachSystem")) {
 | |
|             local Arr = RootTab["YosinPlayerEachSystem"];
 | |
|             local TryAppend = true;
 | |
|             foreach(value in Arr) {
 | |
|                 if (value.Name == this.Name) {
 | |
|                     TryAppend = false;
 | |
|                 }
 | |
|             }
 | |
|             if (TryAppend) {
 | |
|                 Arr.append(this);
 | |
|                 RootTab.rawset("YosinPlayerEachSystem", Arr);
 | |
|             }
 | |
|         } else {
 | |
|             local Arr = [];
 | |
|             Arr.append(this);
 | |
|             RootTab.rawset("YosinPlayerEachSystem", Arr);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     function Show(x, y) {
 | |
|         X = x;
 | |
|         Y = y;
 | |
|         DrawSwitch = true;
 | |
| 
 | |
|         PlayerName = L_Sq_GetPlayerEachName();
 | |
|     }
 | |
| 
 | |
|     function DrawShow(obj) {
 | |
|         if (DrawSwitch) {
 | |
|             //如果悬停
 | |
|             if (isInRect()) {
 | |
| 
 | |
|                 if (isLBDown()) {
 | |
|                     T_DrawStayAni(obj, "common/yosinevent/playersystemeff.ani", X, Y, 1, "PlayerEachIconKey2a");
 | |
|                     L_sq_DrawCode(Name, X + 24, Y + 5, sq_RGBA(255, 161, 31, 250), 0, 1);
 | |
|                 } else {
 | |
|                     T_DrawStayAni(obj, "common/yosinevent/playersystemeff.ani", X, Y, 1, "PlayerEachIconKey1a");
 | |
|                     L_sq_DrawCode(Name, X + 24, Y + 4, sq_RGBA(255, 161, 31, 250), 0, 1);
 | |
|                 }
 | |
|             } else {
 | |
|                 T_DrawStayAni(obj, "common/yosinevent/playersystemeff.ani", X, Y, 0, "PlayerEachIconKey0a");
 | |
|                 L_sq_DrawCode(Name, X + 24, Y + 4, sq_RGBA(255, 161, 31, 250), 0, 1);
 | |
|             }
 | |
|             if (isLBActive()) {
 | |
|                 Func(PlayerName);
 | |
|                 local RootTab = getroottable();
 | |
|                 if (RootTab.rawin("YosinPlayerEachSystem")) {
 | |
|                     local PlayerEachArr = RootTab["YosinPlayerEachSystem"];
 | |
|                     foreach(pos, V in PlayerEachArr) {
 | |
|                         V.DrawSwitch = false;
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|     }
 | |
|     function DrawShowMouse(obj){
 | |
|         if (DrawSwitch) {
 | |
|         if (!isInRect()){
 | |
|                 if (Mobj.LbEvent || Mobj.RbEvent) {
 | |
|                     local RootTab = getroottable();
 | |
|                     if (RootTab.rawin("YosinPlayerEachSystem")) {
 | |
|                         local PlayerEachArr = RootTab["YosinPlayerEachSystem"];
 | |
|                         foreach(pos, V in PlayerEachArr) {
 | |
|                             V.DrawSwitch = false;
 | |
|                         }
 | |
|                     }
 | |
|                 }
 | |
|         }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     //悬停状态
 | |
|     function isInRect() {
 | |
|         if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, 100, 21)) return true;
 | |
|         else return false;
 | |
|     }
 | |
|     //左键按下状态
 | |
|     function isLBDown() {
 | |
|         if (isInRect() && Mobj.Lb == 1) return true;
 | |
|         else return false;
 | |
|     }
 | |
|     //左键弹起状态
 | |
|     function isLBUp() {
 | |
|         if (isInRect() && Mobj.Lb == 0) return true;
 | |
|         else return false;
 | |
|     }
 | |
| 
 | |
|     //左键单击状态
 | |
|     function isLBActive() {
 | |
|         if (isInRect() && Mobj.LbEvent) return true;
 | |
|         else return false;
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 | |
| function Sq_PlayerEachPos(x, y) {
 | |
|     local RootTab = getroottable();
 | |
|     if (RootTab.rawin("YosinPlayerEachSystem")) {
 | |
|         local PlayerEachArr = RootTab["YosinPlayerEachSystem"];
 | |
|         local obj = sq_GetMyMasterCharacter();
 | |
| 
 | |
|         foreach(pos, V in PlayerEachArr) {
 | |
|             if (x < 600) V.Show(x + 100, y + (pos * 21));
 | |
|             else V.Show(x - 100, y + (pos * 21));
 | |
| 
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| //绘制娱心玩家交互功能
 | |
| function DrawYosinPlayerEachSystem(obj) {
 | |
|     local RootTab = getroottable();
 | |
|     if (RootTab.rawin("YosinPlayerEachSystem")) {
 | |
|         local PlayerEachArr = RootTab["YosinPlayerEachSystem"];
 | |
|         local obj = sq_GetMyMasterCharacter();
 | |
|         foreach(pos, V in PlayerEachArr) {
 | |
|             V.DrawShow(obj);
 | |
|         }
 | |
|         foreach(npos, nV in PlayerEachArr) {
 | |
|             nV.DrawShowMouse(obj);
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| class ControllerC {
 | |
|     Value = null;
 | |
|     MaxValue = null;
 | |
| 
 | |
|     constructor(gMaxValue) {
 | |
|         this.MaxValue = gMaxValue;
 | |
|         Value = 0;
 | |
|     }
 | |
| 
 | |
|     //+
 | |
|     function A() {
 | |
|         if (Value < MaxValue) Value++;
 | |
|     }
 | |
| 
 | |
|     //-
 | |
|     function M() {
 | |
|         if (Value > 0) Value--;
 | |
|     }
 | |
| }
 | |
| 
 | |
| class ScrollControl extends BasicsDrawTool {
 | |
|     Controller = null;
 | |
|     List = null;
 | |
|     SliceCount = null;
 | |
|     FocusCount = null;
 | |
|     FocusList = null;
 | |
| 
 | |
|     //重置FocusList
 | |
|     function SliceList() {
 | |
|         FocusList = null;
 | |
|         FocusList = [];
 | |
|         for (local i = 0; i < (this.List.len() / SliceCount) + 1; i++) {
 | |
|             if (i >= Controller.Value && i < (Controller.Value + FocusCount)) {
 | |
|                 local slen = (i + 1) * SliceCount;
 | |
|                 local buflist;
 | |
|                 if (slen > this.List.len()) buflist = this.List.slice(i * SliceCount);
 | |
|                 else buflist = this.List.slice(i * SliceCount, slen);
 | |
|                 FocusList.append(buflist);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     constructor(gList, gSliceCount, gFocusCount) {
 | |
|         //克隆List
 | |
|         this.List = gList;
 | |
|         this.SliceCount = gSliceCount;
 | |
|         this.FocusCount = gFocusCount;
 | |
| 
 | |
| 
 | |
|         //初始化控制器
 | |
|         local CMax = this.List.len() / this.SliceCount;
 | |
|         //取模一下判断是否整除
 | |
|         if ((this.List.len() % this.SliceCount) > 0) CMax++;
 | |
|         Controller = ControllerC(CMax - FocusCount);
 | |
| 
 | |
|         SliceList();
 | |
|     }
 | |
| 
 | |
|     //+
 | |
|     function A() {
 | |
|         Controller.A();
 | |
|         SliceList();
 | |
|     }
 | |
| 
 | |
|     //-
 | |
|     function M() {
 | |
|         Controller.M();
 | |
|         SliceList();
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 | |
| 
 | |
| //技能类
 | |
| {
 | |
|     function Sq_Get_Ex_IntData(SkillAddress, Idx, objAddress) {
 | |
|         local RetData = 0;
 | |
|         local Root = getroottable();
 | |
|         local RootTab;
 | |
|         if (!Root.rawin("LenheartSkillManager")) {
 | |
|             local T = {};
 | |
|             Root.rawset("LenheartSkillManager", T);
 | |
|         }
 | |
|         RootTab = Root["LenheartSkillManager"];
 | |
|         local Key = "LJ" + objAddress + "SkillAddress" + SkillAddress + "Idx" + Idx;
 | |
|         if (RootTab.rawin(Key)) {
 | |
|             RetData += RootTab[Key];
 | |
|         }
 | |
|         if (!Root.rawin("LenheartTalismanSkillManager")) {
 | |
|             local T = {};
 | |
|             Root.rawset("LenheartTalismanSkillManager", T);
 | |
|         }
 | |
|         RootTab = Root["LenheartTalismanSkillManager"];
 | |
|         if (RootTab.rawin(Key)) {
 | |
|             RetData += RootTab[Key];
 | |
|         }
 | |
|         return RetData;
 | |
|     }
 | |
| 
 | |
|     function Sq_Get_Ex_LevelData(SkillAddress, Idx, objAddress) {
 | |
|         local RetData = 0;
 | |
|         local Root = getroottable();
 | |
|         local RootTab;
 | |
|         if (!Root.rawin("LenheartSkillManager")) {
 | |
|             local T = {};
 | |
|             Root.rawset("LenheartSkillManager", T);
 | |
|         }
 | |
|         RootTab = Root["LenheartSkillManager"];
 | |
|         local Key = "EX_LJ" + "SkillAddress" + SkillAddress + "Idx" + Idx;
 | |
| 
 | |
|         if (RootTab.rawin(Key)) {
 | |
|             RetData += RootTab[Key];
 | |
|         }
 | |
|         if (!Root.rawin("LenheartTalismanSkillManager")) {
 | |
|             local T = {};
 | |
|             Root.rawset("LenheartTalismanSkillManager", T);
 | |
|         }
 | |
|         RootTab = Root["LenheartTalismanSkillManager"];
 | |
|         if (RootTab.rawin(Key)) {
 | |
|             RetData += RootTab[Key];
 | |
|         }
 | |
|         return RetData;
 | |
|     }
 | |
| 
 | |
|     function Sq_Get_Ex_SkillCoolTime(SkillAddress, Idx, objAddress) {
 | |
|         local RetData = 0;
 | |
|         local Root = getroottable();
 | |
|         local RootTab;
 | |
|         if (!Root.rawin("LenheartSkillManager")) {
 | |
|             local T = {};
 | |
|             Root.rawset("LenheartSkillManager", T);
 | |
|         }
 | |
|         RootTab = Root["LenheartSkillManager"];
 | |
|         local Key = "CT_LJ" + "SkillAddress" + SkillAddress;
 | |
|         if (RootTab.rawin(Key)) {
 | |
|             RetData += RootTab[Key];
 | |
|         }
 | |
|         if (!Root.rawin("LenheartTalismanSkillManager")) {
 | |
|             local T = {};
 | |
|             Root.rawset("LenheartTalismanSkillManager", T);
 | |
|         }
 | |
|         RootTab = Root["LenheartTalismanSkillManager"];
 | |
|         if (RootTab.rawin(Key)) {
 | |
|             RetData += RootTab[Key];
 | |
|         }
 | |
|         return RetData;
 | |
|     }
 | |
| 
 | |
|     function AddSkillCoolTime(obj, SkillId, Value) {
 | |
|         local Root = getroottable();
 | |
|         local RootTab;
 | |
|         if (!Root.rawin("LenheartSkillManager")) {
 | |
|             local T = {};
 | |
|             Root.rawset("LenheartSkillManager", T);
 | |
|         }
 | |
|         RootTab = Root["LenheartSkillManager"];
 | |
|         local objAddress = L_Sq_GetObjectAddress(obj);
 | |
|         local SkillAddress = L_Sq_GetSkillAddress(SkillId);
 | |
|         local Key = "CT_LJ" + "SkillAddress" + SkillAddress;
 | |
|         if (RootTab.rawin(Key)) {
 | |
|             local basedata = RootTab[Key];
 | |
|             basedata += Value;
 | |
|             RootTab.rawset(Key, basedata);
 | |
|         } else RootTab.rawset(Key, Value);
 | |
|     }
 | |
| 
 | |
|     function ClearSkillCoolTime(obj, SkillId) {
 | |
|         local Root = getroottable();
 | |
|         local RootTab;
 | |
|         if (!Root.rawin("LenheartSkillManager")) {
 | |
|             local T = {};
 | |
|             Root.rawset("LenheartSkillManager", T);
 | |
|         }
 | |
|         RootTab = Root["LenheartSkillManager"];
 | |
|         local objAddress = L_Sq_GetObjectAddress(obj);
 | |
|         local SkillAddress = L_Sq_GetSkillAddress(SkillId);
 | |
|         local Key = "CT_LJ" + "SkillAddress" + SkillAddress;
 | |
|         if (RootTab.rawin(Key)) {
 | |
|             RootTab.rawset(Key, 0);
 | |
|         } else RootTab.rawset(Key, 0);
 | |
|     }
 | |
| 
 | |
|     function AddIntData(obj, SkillId, Idx, Value) {
 | |
|         local Root = getroottable();
 | |
|         local RootTab;
 | |
|         if (!Root.rawin("LenheartSkillManager")) {
 | |
|             local T = {};
 | |
|             Root.rawset("LenheartSkillManager", T);
 | |
|         }
 | |
|         RootTab = Root["LenheartSkillManager"];
 | |
|         local objAddress = L_Sq_GetObjectAddress(obj);
 | |
|         local SkillAddress = L_Sq_GetSkillAddress(SkillId);
 | |
|         local Key = "LJ" + objAddress + "SkillAddress" + SkillAddress + "Idx" + Idx;
 | |
|         if (RootTab.rawin(Key)) {
 | |
|             local basedata = RootTab[Key];
 | |
|             basedata += Value;
 | |
|             RootTab.rawset(Key, basedata);
 | |
|         } else RootTab.rawset(Key, Value);
 | |
|     }
 | |
| 
 | |
|     function ClearIntData(obj, SkillId, Idx) {
 | |
|         local Root = getroottable();
 | |
|         local RootTab;
 | |
|         if (!Root.rawin("LenheartSkillManager")) {
 | |
|             local T = {};
 | |
|             Root.rawset("LenheartSkillManager", T);
 | |
|         }
 | |
|         RootTab = Root["LenheartSkillManager"];
 | |
|         local objAddress = L_Sq_GetObjectAddress(obj);
 | |
|         local SkillAddress = L_Sq_GetSkillAddress(SkillId);
 | |
|         local Key = "LJ" + objAddress + "SkillAddress" + SkillAddress + "Idx" + Idx;
 | |
|         if (RootTab.rawin(Key)) {
 | |
|             RootTab.rawset(Key, 0);
 | |
|         } else RootTab.rawset(Key, 0);
 | |
|     }
 | |
| 
 | |
|     function HookIntData(obj, SkillId, Idx) {
 | |
|         local RetData = 0;
 | |
|         local Root = getroottable();
 | |
|         local RootTab;
 | |
|         if (!Root.rawin("LenheartSkillManager")) {
 | |
|             local T = {};
 | |
|             Root.rawset("LenheartSkillManager", T);
 | |
|         }
 | |
|         RootTab = Root["LenheartSkillManager"];
 | |
|         local objAddress = L_Sq_GetObjectAddress(obj);
 | |
|         local SkillAddress = L_Sq_GetSkillAddress(SkillId);
 | |
|         local Key = "LJ" + objAddress + "SkillAddress" + SkillAddress + "Idx" + Idx;
 | |
|         if (RootTab.rawin(Key)) {
 | |
|             RetData += RootTab[Key];
 | |
|         }
 | |
|         if (!Root.rawin("LenheartTalismanSkillManager")) {
 | |
|             local T = {};
 | |
|             Root.rawset("LenheartTalismanSkillManager", T);
 | |
|         }
 | |
|         RootTab = Root["LenheartTalismanSkillManager"];
 | |
|         if (RootTab.rawin(Key)) {
 | |
|             RetData += RootTab[Key];
 | |
|         }
 | |
|         return RetData;
 | |
|     }
 | |
| 
 | |
|     function AddLevelData(obj, SkillId, Idx, Value) {
 | |
|         local Root = getroottable();
 | |
|         local RootTab;
 | |
|         if (!Root.rawin("LenheartSkillManager")) {
 | |
|             local T = {};
 | |
|             Root.rawset("LenheartSkillManager", T);
 | |
|         }
 | |
|         RootTab = Root["LenheartSkillManager"];
 | |
|         local objAddress = L_Sq_GetObjectAddress(obj);
 | |
|         local SkillAddress = L_Sq_GetSkillAddress(SkillId);
 | |
|         local Key = "EX_LJ" + "SkillAddress" + SkillAddress + "Idx" + Idx;
 | |
|         if (RootTab.rawin(Key)) {
 | |
|             local basedata = RootTab[Key];
 | |
|             basedata += Value;
 | |
|             RootTab.rawset(Key, basedata);
 | |
|         } else RootTab.rawset(Key, Value);
 | |
|     }
 | |
| 
 | |
|     function ClearLevelData(obj, SkillId, Idx) {
 | |
|         local Root = getroottable();
 | |
|         local RootTab;
 | |
|         if (!Root.rawin("LenheartSkillManager")) {
 | |
|             local T = {};
 | |
|             Root.rawset("LenheartSkillManager", T);
 | |
|         }
 | |
|         RootTab = Root["LenheartSkillManager"];
 | |
|         local objAddress = L_Sq_GetObjectAddress(obj);
 | |
|         local SkillAddress = L_Sq_GetSkillAddress(SkillId);
 | |
|         local Key = "EX_LJ" + "SkillAddress" + SkillAddress + "Idx" + Idx;
 | |
|         if (RootTab.rawin(Key)) {
 | |
|             RootTab.rawset(Key, 0);
 | |
|         } else RootTab.rawset(Key, 0);
 | |
|     }
 | |
| 
 | |
|     function HookLevelData(obj, SkillId, Idx) {
 | |
|         local RetData = 0;
 | |
|         local Root = getroottable();
 | |
|         local RootTab;
 | |
|         if (!Root.rawin("LenheartSkillManager")) {
 | |
|             local T = {};
 | |
|             Root.rawset("LenheartSkillManager", T);
 | |
|         }
 | |
|         RootTab = Root["LenheartSkillManager"];
 | |
|         local objAddress = L_Sq_GetObjectAddress(obj);
 | |
|         local SkillAddress = L_Sq_GetSkillAddress(SkillId);
 | |
|         local Key = "EX_LJ" + "SkillAddress" + SkillAddress + "Idx" + Idx;
 | |
|         if (RootTab.rawin(Key)) {
 | |
|             RetData += RootTab[Key];
 | |
|         }
 | |
|         if (!Root.rawin("LenheartTalismanSkillManager")) {
 | |
|             local T = {};
 | |
|             Root.rawset("LenheartTalismanSkillManager", T);
 | |
|         }
 | |
|         RootTab = Root["LenheartTalismanSkillManager"];
 | |
|         if (RootTab.rawin(Key)) {
 | |
|             RetData += RootTab[Key];
 | |
|         }
 | |
| 
 | |
|         return RetData;
 | |
|     }
 | |
| } |