diff --git a/Base/CallBack/DrawMain.nut b/Base/CallBack/DrawMain.nut index 2f56a6d..e4a05e6 100644 --- a/Base/CallBack/DrawMain.nut +++ b/Base/CallBack/DrawMain.nut @@ -27,6 +27,12 @@ function L_drawMainCustomUI_All() { L_Cmd("cmd.exe /c del Yosin_Game_Reloading.Sign"); //清空窗口 L_Windows_List = []; + //清空所有注册包 + Pack_Control = {}; + + PushDamageFontDataFuncTab <- {}; + PushDamageFontFuncTab <- {}; + //清空活动图标窗口 getroottable().rawdelete("EventList_Obj"); //清空插件初始化状态 @@ -50,6 +56,10 @@ function L_drawMainCustomUI_All() { getroottable().rawdelete("OnilneSign_Obj"); //全服竞拍 getroottable().rawdelete("ServerAuction_Obj"); + //秒伤统计 + getroottable().rawdelete("DamagePerSecond_Obj"); + //皮肤仓库 + getroottable().rawdelete("SkinHub_Obj"); } catch (exception) { if (exception != "cannot open the file") @@ -108,6 +118,7 @@ function L_drawMainCustomUI_All() { }); } + // if (Clock() - getroottable().Lsnzz >= 50) { // getroottable().Lsnzz = Clock(); // local T = { diff --git a/Base/CallBack/GetDamageRate.nut b/Base/CallBack/GetDamageRate.nut index 0889b71..0792b9a 100644 --- a/Base/CallBack/GetDamageRate.nut +++ b/Base/CallBack/GetDamageRate.nut @@ -7,21 +7,8 @@ function L_getCurrentModuleDamageRate(obj) { if (!obj) return 1.0; - local rate; - if (getroottable().rawin("LenheartCurrentModuleDamageRate")) { - rate = 1.0 + getroottable()["LenheartCurrentModuleDamageRate"]; - } else { - rate = 1.0; - } + local rate = 1.0; - //超时空伤害 - if (getroottable().rawin("LenheartFiendModuleDamageRate")) { - rate *= getroottable()["LenheartFiendModuleDamageRate"]; - } else { - rate *= 1.0; - } - - //pvf伤害 local ClientRat = 1.0; try { ClientRat = getCurrentModuleDamageRate(obj).tofloat(); @@ -29,44 +16,5 @@ function L_getCurrentModuleDamageRate(obj) { ClientRat = 1.0; } - //副本伤害控制 - try { - local stage = sq_GetGlobaludpModuleStage(); - local dungeon = sq_GetDungeonByStage(stage); - local dungeonIndex = sq_GetDuegonIndex(dungeon); - local fbsh = 100; - - foreach(id in DungeonIndex) { - if (dungeonIndex == id[0]) { - fbsh = id[1]; - } - } - local nrate = fbsh.tofloat() / 100.0; - rate = rate.tofloat() * nrate; - } catch (exception) { - - } - - //职业伤害控制 - try { - local LLJob = sq_getJob(obj); - local LLGrowT = sq_getGrowType(obj); - - local LLLen = GrowType.len(); - for (local i = 0; i< 11; ++i) { - if (i == LLLen) break; - if (LLJob == i) { - foreach(GR in GrowType[i]) { - if (LLGrowT == GR[0]) - rate = rate.tofloat() * GR[1].tofloat(); - } - } - - } - } catch (exception) { - - } - - return (rate * ClientRat); } \ No newline at end of file diff --git a/Base/CallBack/PushDamage.nut b/Base/CallBack/PushDamage.nut index 451f848..b65c7c6 100644 --- a/Base/CallBack/PushDamage.nut +++ b/Base/CallBack/PushDamage.nut @@ -19,14 +19,7 @@ function Sq_PushDamageData(ObjAddress, MySelfAddress, Value) { } function Sq_PushDamageFontData(ObjAddress, X, Y, Z, Value, Type, A1, A2) { - // print("MyCharacter: " + format("%02x", L_sq_RA(0x1AB7CDC))); - // print("ObjAddress: " + format("%02x", ObjAddress)); - // print("A1: " + format("%02x", A1)); - // print("A2: " + format("%02x", A2)); - // print(" "); - // if (A2) - // print(format("%02x", L_Sq_GetObjectIsCharacter(A2))); local Flag = true; foreach(Func in PushDamageFontDataFuncTab) { local Ret = Func(ObjAddress, X, Y, Z, Value, Type, A1, A2); diff --git a/Base/PackControl/PackControl.nut b/Base/PackControl/PackControl.nut index 5e1ee87..2370ece 100644 --- a/Base/PackControl/PackControl.nut +++ b/Base/PackControl/PackControl.nut @@ -24,7 +24,9 @@ function Sq_Pack_Control(Chunk) { function Sq_Pack_ControlLocal(Chunk) { local Pack_Json = Json.Decode(Chunk); - if (Pack_Control.rawin(Pack_Json.op)) Pack_Control[Pack_Json.op](Chunk); + if (Pack_Control.rawin(Pack_Json.op)) { + Pack_Control[Pack_Json.op](Chunk); + } } diff --git a/Base/UI/Lenheart_UI_Class.nut b/Base/UI/Lenheart_UI_Class.nut index 628ee1e..d603d49 100644 --- a/Base/UI/Lenheart_UI_Class.nut +++ b/Base/UI/Lenheart_UI_Class.nut @@ -290,6 +290,8 @@ class LenheartNewUI_Windows extends LenheartNewUI_BaseWindow { ItemInfoDrawS = L_Sq_CallFunc(0xE6E070, "int", FFI_THISCALL, ["int", "int", "int", "int"], L_sq_RA(0x1A5FB20), 275, Rindro_ItemInfoObject[Id], 41); //校准道具信息窗口位置 L_Sq_CallFunc(0xF3B3B0, "int", FFI_THISCALL, ["int", "int", "int", "int", "int"], ItemInfoDrawS, IMouse.GetXPos(), IMouse.GetYPos(), 28, 28); + //我自己UI打开的道具信息窗口需要把渲染队列改为下层 以显示我打开的道具 + getroottable().WindowsShowABFlag <- false; } } else { if (ItemInfoDrawS) { @@ -454,13 +456,19 @@ function CheackMouseInOldWindows() { local WindowAddress = L_sq_RA(0x1B474D4); if (WindowAddress) { local Flag = L_sq_RA(WindowAddress); - // print(format("%02X", Flag)); foreach(value in OldBaseWindowArr) { if (Flag == value) { // if ((L_sq_RA(WindowAddress + 0x14) == 0 && L_sq_RA(WindowAddress + 0x18) == 0) || Flag == 0x184D0C4) { // print(false); - return false; + // } + + //空地 + if (Flag == 0x184D0C4 || Flag == 0x0184CF6C) { + if ((L_sq_RA(WindowAddress + 0x14) == 0 && L_sq_RA(WindowAddress + 0x18) == 0)) { + return false; + } + } else return false; } } } @@ -476,7 +484,7 @@ function RunMouseLogic(MousePos_X, MousePos_Y) { //还原鼠标 R_Mouse.Restore(); } - //在任何老窗口上 并且渲染层未A层 也就是下层渲染 + //在任何老窗口上 并且渲染层为A层 也就是下层渲染 else if (CheackMouseInOldWindows() && !getroottable().WindowsShowABFlag) { //还原鼠标 R_Mouse.Restore(); @@ -528,11 +536,15 @@ function L_MouseCallBack(MouseState, MouseFlag, MousePos_X, MousePos_Y) { //判断是否悬停活动图标 if (getroottable().rawin("EventList_Obj")) EventList_Obj.CheckInEvent(MousePos_X, MousePos_Y); + + //如果渲染层级在下级 即A层 或者是 鼠标没有悬停在任何新窗口上时 执行判断 如果悬停在原生窗口 就解除鼠标锁定 如果点击 就改变渲染层级 if (!getroottable().WindowsShowABFlag || !CheackMouseInNewWindows(MousePos_X, MousePos_Y)) { if (CheackMouseInOldWindows()) { //如果点击了原生窗口 或者使用了滚轮 就把渲染队列改成下 - if (MouseState == 0x201 || MouseState == 0x20a) getroottable().WindowsShowABFlag <- false; + if (MouseState == 0x201 || MouseState == 0x20a) { + getroottable().WindowsShowABFlag <- false; + } if (MouseState != 0x20a) return; } } @@ -554,8 +566,6 @@ function L_MouseCallBack(MouseState, MouseFlag, MousePos_X, MousePos_Y) { case 0x201: { //如果点击了新窗口就把渲染队列改成上 getroottable().WindowsShowABFlag <- true; - //点击动画 - if (getroottable().WindowsShowABFlag) L_sq_WA(0x1B46874, 1); Window.OnMouseLbDown(MousePos_X, MousePos_Y); break; @@ -589,7 +599,7 @@ function L_MouseCallBack(MouseState, MouseFlag, MousePos_X, MousePos_Y) { //打开原生窗口回调 function L_OpenOldWindowCallBack(WindowIndex) { //将新窗口渲染队列改为下层 抵消窗口 Esc窗口 登录可能显示的任务窗口 - if (WindowIndex != 170 && WindowIndex != 176) { + if (WindowIndex != 170 && WindowIndex != 176 && WindowIndex != 276 && WindowIndex != 275 && WindowIndex != 278 && WindowIndex != 283) { getroottable().WindowsShowABFlag <- false; } } @@ -636,9 +646,11 @@ function L_WindowsLogic(obj) { } } if (Flag) { + getroottable().WindowsShowABFlag <- false; //还原鼠标 R_Mouse.Restore(); - L_sq_MouseClick(); + L_Sq_CallFunc(0x11A8B60, "void", FFI_MS_CDECL, []); + // L_sq_MouseClick(); Rindro_MouseClickFlag = 5; } } @@ -682,6 +694,7 @@ class LenheartNewUI_CommonUi extends LenheartNewUI_BaseWindow { isInRect = false; OnClick = null; + OnClickEx = null; OnClickSound = null; ObjectId = null; @@ -689,6 +702,8 @@ class LenheartNewUI_CommonUi extends LenheartNewUI_BaseWindow { TopCallBackFunc = null; + Data = null; + constructor(x, y, width, height) { this.Localtion_X = x; this.Localtion_Y = y; @@ -722,8 +737,9 @@ class LenheartNewUI_CommonUi extends LenheartNewUI_BaseWindow { } //鼠标左键弹起回调 function OnMouseLbUp(MousePos_X, MousePos_Y) { - if (isLBDown && OnClick) { - OnClick(); + if (isLBDown) { + if (OnClick) OnClick(); + if (OnClickEx) OnClickEx(this); } isLBDown = false; } diff --git a/Base/_Tool/BaseTool_Class.nut b/Base/_Tool/BaseTool_Class.nut index 42f85a8..45c9d61 100644 --- a/Base/_Tool/BaseTool_Class.nut +++ b/Base/_Tool/BaseTool_Class.nut @@ -41,10 +41,13 @@ class Json { } function Decode(Str) { - Str = L_sq_DecondeJson(Str); - local Str = "local _M = " + Str + ";\n return _M;\n"; - local Func = compilestring(Str); - return Func(); + // Str = L_sq_DecondeJson(Str); + // local Str = "local _M = " + Str + ";\n return _M;\n"; + // local Func = compilestring(Str); + // return Func(); + + local JsonObj = JSONParser(); + return JsonObj.parse(Str); } } //Key 键盘按键类 diff --git a/Base/_Tool/Json_Class.nut b/Base/_Tool/Json_Class.nut new file mode 100644 index 0000000..e51d7ef --- /dev/null +++ b/Base/_Tool/Json_Class.nut @@ -0,0 +1,661 @@ +/* +文件名:Json_Class.nut +路径:Base/_Tool/Json_Class.nut +创建日期:2024-09-27 23:54 +文件用途:Json类 +*/ + +class JSONParser { + + + static version = "1.0.1"; + + + state = ""; + stack = null; + container = null; + key = ""; + value = ""; + converter = null; + + constructor() { + stack = []; + container = {}; + } + + function parse(str, ...) { + if (vargc > 0) converter = vargc[0]; + + + // actions for string tokens + local string = { + go = function() { + state = "ok"; + }.bindenv(this), + firstokey = function() { + key = value; + state = "colon"; + }.bindenv(this), + okey = function() { + key = value; + state = "colon"; + }.bindenv(this), + ovalue = function() { + value = this._convert(value, "string", converter); + state = "ocomma"; + }.bindenv(this), + firstavalue = function() { + value = this._convert(value, "string", converter); + state = "acomma"; + }.bindenv(this), + avalue = function() { + value = value; + this._convert(value, "string", converter); + state = "acomma"; + }.bindenv(this) + }; + + // the actions for number tokens + local number = { + go = function() { + state = "ok"; + }.bindenv(this), + ovalue = function() { + value = this._convert(value, "number", converter); + state = "ocomma"; + }.bindenv(this), + firstavalue = function() { + value = this._convert(value, "number", converter); + state = "acomma"; + }.bindenv(this), + avalue = function() { + value = this._convert(value, "number", converter); + state = "acomma"; + }.bindenv(this) + }; + + + // action table + // describes where the state machine will go from each given state + local action = {}; + + + action["{"] <- { + go = function() { + stack.push({ + state = "ok" + }); + container = {}; + state = "firstokey"; + }.bindenv(this), + ovalue = function() { + stack.push({ + container = container, + state = "ocomma", + key = key + }); + container = {}; + state = "firstokey"; + }.bindenv(this), + firstavalue = function() { + stack.push({ + container = container, + state = "acomma" + }); + container = {}; + state = "firstokey"; + }.bindenv(this), + avalue = function() { + stack.push({ + container = container, + state = "acomma" + }); + container = {}; + state = "firstokey"; + }.bindenv(this) + }, + + action["}"] <- { + firstokey = function() { + local pop = stack.pop(); + value = container; + container = ("container" in pop) ? pop.container : null; + key = ("key" in pop) ? pop.key : null; + state = pop.state; + }.bindenv(this), + ocomma = function() { + local pop = stack.pop(); + container[key] <- value; + value = container; + container = ("container" in pop) ? pop.container : null; + key = ("key" in pop) ? pop.key : null; + state = pop.state; + }.bindenv(this) + }, + + action["["] <- { + go = function() { + stack.push({ + state = "ok" + }); + container = []; + state = "firstavalue"; + }.bindenv(this), + ovalue = function() { + stack.push({ + container = container, + state = "ocomma", + key = key + }); + container = []; + state = "firstavalue"; + }.bindenv(this), + firstavalue = function() { + stack.push({ + container = container, + state = "acomma" + }); + container = []; + state = "firstavalue"; + }.bindenv(this), + avalue = function() { + stack.push({ + container = container, + state = "acomma" + }); + container = []; + state = "firstavalue"; + }.bindenv(this) + }, + + action["]"] <- { + firstavalue = function() { + local pop = stack.pop(); + value = container; + container = ("container" in pop) ? pop.container : null; + key = ("key" in pop) ? pop.key : null; + state = pop.state; + }.bindenv(this), + acomma = function() { + local pop = stack.pop(); + container.push(value); + value = container; + container = ("container" in pop) ? pop.container : null; + key = ("key" in pop) ? pop.key : null; + state = pop.state; + }.bindenv(this) + }, + + action[":"] <- { + colon = function() { + // Check if the key already exists + // NOTE previous code used 'if (key in container)...' + // but this finds table ('container') member methods too + local err = false; + foreach(akey, avalue in container) { + if (akey == key) err = true; + break + } + if (err) throw "Duplicate key \"" + key + "\""; + state = "ovalue"; + }.bindenv(this) + }, + + action[","] <- { + ocomma = function() { + container[key] <- value; + state = "okey"; + }.bindenv(this), + acomma = function() { + container.push(value); + state = "avalue"; + }.bindenv(this) + }, + + action["true"] <- { + go = function() { + value = true; + state = "ok"; + }.bindenv(this), + ovalue = function() { + value = true; + state = "ocomma"; + }.bindenv(this), + firstavalue = function() { + value = true; + state = "acomma"; + }.bindenv(this), + avalue = function() { + value = true; + state = "acomma"; + }.bindenv(this) + }, + + action["false"] <- { + go = function() { + value = false; + state = "ok"; + }.bindenv(this), + ovalue = function() { + value = false; + state = "ocomma"; + }.bindenv(this), + firstavalue = function() { + value = false; + state = "acomma"; + }.bindenv(this), + avalue = function() { + value = false; + state = "acomma"; + }.bindenv(this) + }, + + action["null"] <- { + go = function() { + value = null; + state = "ok"; + }.bindenv(this), + ovalue = function() { + value = null; + state = "ocomma"; + }.bindenv(this), + firstavalue = function() { + value = null; + state = "acomma"; + }.bindenv(this), + avalue = function() { + value = null; + state = "acomma"; + }.bindenv(this) + } + + + + // + state = "go"; + stack = []; + + // current tokenizeing position + local start = 0; + + try { + + local result, token, tokenizer = _JSONTokenizer(); + + while (token = tokenizer.nextToken(str, start)) { + + if ("ptfn" == token.type) { + // punctuation/true/false/null + action[token.value][state](); + } else if ("number" == token.type) { + // number + value = token.value; + number[state](); + } else if ("string" == token.type) { + // string + value = tokenizer.unescape(token.value); + string[state](); + } + + start += token.length; + } + + } catch (e) { + state = e; + } + + + if (state != "ok" || regexp("[^\\s]").capture(str, start)) { + local near = str.slice(start, GetMin(str.len(), start + 10)); + throw "JSON Syntax Error near `" + near + "`"; + } + + + return value; + } + + function GetMin(a, b) { + return a< b ? a : b; + } + + + function _convert(value, type, converter) { + if ("function" == typeof converter) { + + // # of params for converter function + + local parametercCount = 2; + + // .getinfos() is missing on ei platform + if ("getinfos" in converter) { + parametercCount = converter.getinfos().parameters.len() - + 1; + } + + if (parametercCount == 1) { + return converter(value); + } else if (parametercCount == 2) { + return converter(value, type); + } else { + throw "Error: converter function must take 1 or 2 parameters" + } + + } else if ("number" == type) { + local Ret = (value.find(".") == null && value.find("e") == null && value.find("E") == null) ? value.tointeger() : value.tofloat(); + return Ret; + } else { + return value; + } + + } +} + + + +class _JSONTokenizer { + + _ptfnRegex = null; + _numberRegex = null; + _stringRegex = null; + _ltrimRegex = null; + _unescapeRegex = null; + + constructor() { + // punctuation/true/false/null + this._ptfnRegex = regexp("^(?:\\,|\\:|\\[|\\]|\\{|\\}|true|false|null)"); + + // numbers + this._numberRegex = regexp("^(?:\\-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)"); + + // strings + this._stringRegex = regexp("^(?:\\\"((?:[^\\r\\n\\t\\\\\\\"]|\\\\(?:[\"\\\\\\/trnfb]|u[0-9a-fA-F]{4}))*)\\\")"); + + // ltrim pattern + this._ltrimRegex = regexp("^[\\s\\t\\n\\r]*"); + + // string unescaper tokenizer pattern + this._unescapeRegex = regexp("\\\\(?:(?:u\\d{4})|[\\\"\\\\/bfnrt])"); + } + + + function nextToken(str, ...) { + local start = 0; + if (vargc > 0) start = vargv[0]; + local + m, + type, + token, + value, + length, + whitespaces; + + // count # of left-side whitespace chars + whitespaces = this._leadingWhitespaces(str, start); + start += whitespaces; + + if (m = this._ptfnRegex.capture(str, start)) { + // punctuation/true/false/null + value = str.slice(m[0].begin, m[0].end); + type = "ptfn"; + } else if (m = this._numberRegex.capture(str, start)) { + // number + value = str.slice(m[0].begin, m[0].end); + type = "number"; + } else if (m = this._stringRegex.capture(str, start)) { + // string + value = str.slice(m[1].begin, m[1].end); + type = "string"; + } else { + return null; + } + + token = { + type = type, + value = value, + length = m[0].end - m[0].begin + whitespaces + }; + + return token; + } + + + function _leadingWhitespaces(str, start) { + local r = this._ltrimRegex.capture(str, start); + + if (r) { + return r[0].end - r[0].begin; + } else { + return 0; + } + } + + // unesacape() replacements table + _unescapeReplacements = { + b = "\b", + f = "\f", + n = "\n", + r = "\r", + t = "\t" + }; + + function unescape(str) { + + local start = 0; + local res = ""; + + while (start< str.len()) { + local m = this._unescapeRegex.capture(str, start); + + if (m) { + local token = str.slice(m[0].begin, m[0].end); + + // append chars before match + local pre = str.slice(start, m[0].begin); + res += pre; + + if (token.len() == 6) { + res += token; + } else { + local char = token.slice(1); + + if (char in this._unescapeReplacements) { + res += this._unescapeReplacements[char]; + } else { + res += char; + } + } + + } else { + res += str.slice(start); + break; + } + + start = m[0].end; + } + + return res; + } +} + + +class JSONEncoder { + + static VERSION = "2.0.0"; + + // max structure depth + // anything above probably has a cyclic ref + static _maxDepth = 32; + + + function encode(value) { + return this._encode(value); + } + + + function _encode(val, ...) { + local depth = 0; + if (vargc > 0) depth = vargv[0]; + // detect cyclic reference + if (depth > this._maxDepth) { + throw "Possible cyclic reference"; + } + + local + r = "", + s = "", + i = 0; + + switch (typeof val) { + + case "table": + case "class": + s = ""; + + // serialize properties, but not functions + foreach(k, v in val) { + if (typeof v != "function") { + s += ",\"" + k + "\":" + this._encode(v, depth + 1); + } + } + + s = s.len() > 0 ? s.slice(1) : s; + r += "{" + s + "}"; + break; + + case "array": + s = ""; + + for (i = 0; i< val.len(); i++) { + s += "," + this._encode(val[i], depth + 1); + } + + s = (i > 0) ? s.slice(1) : s; + r += "[" + s + "]"; + break; + + case "integer": + case "float": + case "bool": + r += val; + break; + + case "null": + r += "null"; + break; + + case "instance": + + if ("_serializeRaw" in val && typeof val._serializeRaw == "function") { + + // include value produced by _serializeRaw() + r += val._serializeRaw().tostring(); + + } else if ("_serialize" in val && typeof val._serialize == "function") { + + // serialize instances by calling _serialize method + r += this._encode(val._serialize(), depth + 1); + + } else { + + s = ""; + + try { + + // iterate through instances which implement _nexti meta-method + foreach(k, v in val) { + s += ",\"" + k + "\":" + this._encode(v, depth + 1); + } + + } catch (e) { + + // iterate through instances w/o _nexti + // serialize properties, but not functions + foreach(k, v in val.getclass()) { + if (typeof v != "function") { + s += ",\"" + k + "\":" + this._encode(val[k], depth + 1); + } + } + + } + + s = s.len() > 0 ? s.slice(1) : s; + r += "{" + s + "}"; + } + + break; + + case "blob": + // This is a workaround for a known bug: + // on device side Blob.tostring() returns null + // (instaead of an empty string) + r += "\"" + (val.len() ? this._escape(val.tostring()) : "") + "\""; + break; + + // strings and all other + default: + r += "\"" + this._escape(val.tostring()) + "\""; + break; + } + + return r; + } + + function _escape(str) { + local res = ""; + + for (local i = 0; i< str.len(); i++) { + + local ch1 = (str[i] & 0xFF); + + if ((ch1 & 0x80) == 0x00) { + // 7-bit Ascii + + ch1 = format("%c", ch1); + + if (ch1 == "\"") { + res += "\\\""; + } else if (ch1 == "\\") { + res += "\\\\"; + } else if (ch1 == "/") { + res += "\\/"; + } else if (ch1 == "\b") { + res += "\\b"; + } else if (ch1 == "\f") { + res += "\\f"; + } else if (ch1 == "\n") { + res += "\\n"; + } else if (ch1 == "\r") { + res += "\\r"; + } else if (ch1 == "\t") { + res += "\\t"; + } else if (ch1 == "\0") { + res += "\\u0000"; + } else { + res += ch1; + } + + } else { + + if ((ch1 & 0xE0) == 0xC0) { + // 110xxxxx = 2-byte unicode + local ch2 = (str[++i] & 0xFF); + res += format("%c%c", ch1, ch2); + } else if ((ch1 & 0xF0) == 0xE0) { + // 1110xxxx = 3-byte unicode + local ch2 = (str[++i] & 0xFF); + local ch3 = (str[++i] & 0xFF); + res += format("%c%c%c", ch1, ch2, ch3); + } else if ((ch1 & 0xF8) == 0xF0) { + // 11110xxx = 4 byte unicode + local ch2 = (str[++i] & 0xFF); + local ch3 = (str[++i] & 0xFF); + local ch4 = (str[++i] & 0xFF); + res += format("%c%c%c%c", ch1, ch2, ch3, ch4); + } + + } + } + + return res; + } +} \ No newline at end of file diff --git a/Base/_Tool/MemoryClass.nut b/Base/_Tool/MemoryClass.nut index 43ccbb0..54b7ac8 100644 --- a/Base/_Tool/MemoryClass.nut +++ b/Base/_Tool/MemoryClass.nut @@ -114,7 +114,10 @@ class NativePointer { function read(type) { - local Buf = Sq_Point2Blob(this.C_Object, 4); + local Buf = Sq_Point2Blob(L_sq_P2I(this.C_Object), 4); + foreach(value in Buf) { + print(value); + } return Buf.readn(type); } diff --git a/Base/_Z_Data/ItemData.nut b/Base/_Z_Data/ItemData.nut index be01325..c9fa6fd 100644 --- a/Base/_Z_Data/ItemData.nut +++ b/Base/_Z_Data/ItemData.nut @@ -299,8 +299,13 @@ class ItemInfoClass { } } - - +// print(L_sq_P2I(Memory.allocUtf8String("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img").C_Object)); +// local Npk = L_Sq_CallFunc(0x11C0410, "int", FFI_THISCALL, ["int", "int", "int"], L_sq_RA(0x1B4684C), 0, L_sq_P2I(Memory.allocUtf8String("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img").C_Object)); +// print(Npk); +// local Img = L_Sq_CallFunc(0x11AA190, "int", FFI_THISCALL, ["int", "int"], Npk, 0); +// print(format("%02x", Img)); +// print("width: " + NativePointer(Img).add(0x1C).readShort()); +// print("height: " + NativePointer(Img).add(0x20).readShort()); // local ReadPath = L_sq_P2I(Memory.allocUtf8String("etc/rindro/horseguessing/horseguessing.dat").C_Object); // print(format("%02x", ReadPath)); @@ -403,4 +408,18 @@ class ItemInfoClass { // // print(args.pop()); // // print(">>>>>>"); // return null; -// }); \ No newline at end of file +// }); + +// local Str = "{\"stringValue\":\"thisiszifuchuan\",\"numberValue\":123.45,\"integerValue\":42,\"booleanValue\":true,\"arrayValue\":[1,\"two\",true,{\"key\":\"value\"}],\"objectValue\":{\"name\":\"John Doe\",\"age\":30,\"address\":{\"street\":\"123 Main St\",\"city\":\"Anytown\",\"state\":\"CA\",\"zip\":\"12345\"}}}"; +// print("***********************"); +// print(Str); +// print(Str.len()); +// local JsonObj = JSONParser(); +// local T = JsonObj.parse(Str); +// print(">>>>>>>>>>>>>>"); +// print(T); +// print(">>>>>>>>>>>>>>"); +// local Str2 = Json.Encode(T); +// print("***********************"); +// print(Str2); +// print(Str2.len()); \ No newline at end of file diff --git a/DofileList.nut b/DofileList.nut index 8a66351..6b40bb0 100644 --- a/DofileList.nut +++ b/DofileList.nut @@ -3,6 +3,7 @@ dofile("sqr/Base/_ENUM/_ENUM_KEY.nut"); //按键枚举类 //枚举类 //基础工具类 +dofile("sqr/Base/_Tool/Json_Class.nut"); //Json类 dofile("sqr/Base/_Tool/BaseTool_Class.nut"); //基础工具类 dofile("sqr/Base/_Tool/MemoryClass.nut"); //内存类 dofile("sqr/Base/_Tool/Hacker_Class.nut"); //黑客工具类 @@ -15,6 +16,7 @@ dofile("sqr/Base/CallBack/DrawMain.nut"); //绘制入口 dofile("sqr/Base/CallBack/DrawHudMain.nut"); //hud绘制入口 dofile("sqr/Base/CallBack/Window_Get.nut"); //原始窗口HOOK dofile("sqr/Base/CallBack/PushDamage.nut"); //Push伤害 +dofile("sqr/Base/CallBack/GetDamageRate.nut"); //获取伤害 // dofile("sqr/Base/CallBack/Window_Get.nut"); //原始窗口HOOK //数据类 @@ -51,4 +53,5 @@ dofile("sqr/Project/Shapeshifting/Shapeshifting.nut"); //时装变身 dofile("sqr/Project/HudUi/HudUi.nut"); //百级UI dofile("sqr/Project/DamagePerSecond/DamagePerSecond.nut"); //秒伤统计 dofile("sqr/Project/CollectionBox/CollectionBox.nut"); //收集箱 -dofile("sqr/Project/HorseGuessing/HorseGuessing.nut"); //骑士马战 \ No newline at end of file +dofile("sqr/Project/HorseGuessing/HorseGuessing.nut"); //骑士马战 +dofile("sqr/Project/SkinHub/SkinHub.nut"); //皮肤仓库 \ No newline at end of file diff --git a/Project/Anton/Rindro_Anton_Reward.nut b/Project/Anton/Rindro_Anton_Reward.nut index d1fe64a..3210456 100644 --- a/Project/Anton/Rindro_Anton_Reward.nut +++ b/Project/Anton/Rindro_Anton_Reward.nut @@ -363,8 +363,10 @@ class Rindro_Anton_RewardC extends LenheartNewUI_Windows { } //绘制物品边框 if (OpenRealXrate >= 0.6) { - local Rarity = Rindro_ItemInfoObject[CardInfo.item].Rarity; - local Name = Rindro_ItemInfoObject[CardInfo.item].Name; + GetItemInfo(CardInfo.item); + local Rarity = L_sq_RA(Rindro_ItemInfoObject[CardInfo.item] + 0xF4); + local NamePointer = L_sq_RA(Rindro_ItemInfoObject[CardInfo.item] + 0x20); + local Name = NativePointer(L_sq_I2P(NamePointer)).readUnicodeString(); L_sq_DrawImg("interface2/raid/anton/reward/anton_reward.img", 5 + Rarity, X + 156 + (160 * i), Y + 378, 1, sq_RGBA(255, 255, 255, CradAlphaOffset), OpenRealXrate, 1.0); //绘制物品 @@ -459,7 +461,8 @@ class Rindro_Anton_RewardC extends LenheartNewUI_Windows { //奖励对象 local CardInfo = TeamReward[i]; if (CardInfo.Flag && CardInfo.item != -1) { - local Rarity = Rindro_ItemInfoObject[CardInfo.item].Rarity; + GetItemInfo(CardInfo.item); + local Rarity = L_sq_RA(Rindro_ItemInfoObject[CardInfo.item] + 0xF4); //物品出现光 if (!CardInfo.grade) { if (Rarity <= 2) { //低于紫色闪紫光 diff --git a/Project/DamagePerSecond/DamagePerSecond.nut b/Project/DamagePerSecond/DamagePerSecond.nut index 4355c34..ccc51d5 100644 --- a/Project/DamagePerSecond/DamagePerSecond.nut +++ b/Project/DamagePerSecond/DamagePerSecond.nut @@ -118,7 +118,6 @@ class DamagePerSecondC extends LenheartNewUI_Windows { LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); PushDamageFontFuncTab.rawset("DamagePerSecondCFunc", Sq_PushDamageData.bindenv(this)); - } function RegisterWidget() { diff --git a/Project/HorseGuessing/HorseGuessing.nut b/Project/HorseGuessing/HorseGuessing.nut index 08ea3b8..de49d66 100644 --- a/Project/HorseGuessing/HorseGuessing.nut +++ b/Project/HorseGuessing/HorseGuessing.nut @@ -6,6 +6,74 @@ */ dofile("sqr/Project/HorseGuessing/HorseGuessing_Guide.nut"); //骑士马战指引 dofile("sqr/Project/HorseGuessing/HorseGuessing_KnightInfo.nut"); //骑士马战资料 +dofile("sqr/Project/HorseGuessing/HorseGuessing_PastRecord.nut"); //骑士马战过往战绩 + +class HorseGuessingBaseButton extends LenheartNewUI_BaseButton { + //是否翻转 + IsFlip = false; + + //ovverride + //鼠标事件回调 + function OnMouseProc(Flag, MousePos_X, MousePos_Y) { + if (!IsFlip) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) isInRect = true; + else isInRect = false; + } else { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X - Width, Y, Width, Height)) isInRect = true; + else isInRect = false; + } + } + //ovverride + //鼠标左键按下回调 + function OnMouseLbDown(MousePos_X, MousePos_Y) { + if (!IsFlip) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) { + isLBDown = true; + if (!OnClickSound) { + R_Utils.PlaySound("CLICK_BUTTON1"); + } else { + R_Utils.PlaySound(OnClickSound); + } + } + } else { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X - Width, Y, Width, Height)) { + isLBDown = true; + if (!OnClickSound) { + R_Utils.PlaySound("CLICK_BUTTON1"); + } else { + R_Utils.PlaySound(OnClickSound); + } + } + } + } + + + //ovverride + function Show(obj) { + + local XRate = 1.0; + if (IsFlip) XRate = -1.0; + //不可用 + if (State == 8) { + L_sq_DrawImg(Path, Idx + 3, X, Y + 1, 1, sq_RGBA(255, 255, 255, 250), XRate, 1.0); + } else { + //按下 + if (isLBDown) { + L_sq_DrawImg(Path, Idx + 2, X, Y + 1, 1, sq_RGBA(255, 255, 255, 250), XRate, 1.0); + } + //悬停 + else if (isInRect) { + L_sq_DrawImg(Path, Idx + 1, X, Y, 1, sq_RGBA(255, 255, 255, 250), XRate, 1.0); + } + //普通 + else { + L_sq_DrawImg(Path, Idx, X, Y, 1, sq_RGBA(255, 255, 255, 250), XRate, 1.0); + } + } + + } +} + class HorseGuessingC extends LenheartNewUI_Windows { //调试模式 //DeBugMode = true; @@ -14,7 +82,7 @@ class HorseGuessingC extends LenheartNewUI_Windows { // NoWindow = true; //是否可见 - // Visible = false; + Visible = false; //标题栏 Title = null; @@ -32,16 +100,7 @@ class HorseGuessingC extends LenheartNewUI_Windows { //骑手名称 - RiderName = [ - "伊撒尔", - "理查德", - "席恩", - "吉尔特", - "爱德华", - "罗兰", - "莱奥", - "贝奥武夫", - ]; + RiderName = null; //当前选择骑手 NowSelectRider = 0; @@ -52,53 +111,185 @@ class HorseGuessingC extends LenheartNewUI_Windows { //剩余可下注数量 ResidueCoin = 10000; - //骑手信息 RiderInfo = null; + //往期战绩 + InfoContestLog = null; + + //状态 + MyState = 0; + + //初始化名字包 + function InitRiderNameCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + RiderName = Jso.name; + ResidueCoin = Jso.Max; + BetItem = Jso.itemId; + } + + //获取基础配置信息 + function GetBaseConfig() { + local T = { + op = 20055001, + } + SendPackEx(T); + } + //获取基础配置信息回调 + function GetBaseConfigCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + if (!("Top8" in Jso.Rank)) return; + + //同步状态 + MyState = Jso.state; + + //初始化骑手信息 + RiderInfo = []; + RiderInfo = Jso.Rank.Top8; + + //写入骑手下注信息 + for (local i = 0; i< RiderInfo.len(); i++) { + RiderInfo[i].codeItem <- Jso.codeItem[i]; + } + + //重置骑手按钮 + + //构造骑手按钮 + InitKnightButton(); + + //刷新剩余可下注数量 + ResidueCoin = Jso.ResidueCoin; + + + //请求骑士个人信息 + this.GetRiderInfo(); + } + + //获取过往战绩 + function GetPastRecord() { + local T = { + op = 20055009, + } + SendPackEx(T); + } + //获取过往战绩回调 + function GetPastRecordCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + InfoContestLog = Jso.knights; + } + + //获取选手具体信息 function GetRiderInfo() { local T = { op = 20055003, code = NowSelectRider, } - SendPack(T); + SendPackEx(T); } //获取选手具体信息回调包 function GetRiderInfoCallBack(Chunk) { local Jso = Json.Decode(Chunk); - RiderInfo = []; - for (local i = 0; i< Jso.outcome.len(); i++) { - RiderInfo.append(Jso.outcome[i]); + RiderInfo[NowSelectRider].outcome <- Jso.outcome; + } + + //通知刷新信息包 + function NotifyRefreshInfoCallBack(Chunk) { + GetBaseConfig(); + } + + //动画脚本状态 + AnimationAct = 0; + //绘制动画包 + function DrawAniInfoCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + AnimationAct = Jso.state; + + if (AnimationAct == 2) { + if (CompetitionStartAnimotion) sq_Rewind(CompetitionStartAnimotion); } } + //战斗信息 + FightInfo = null; + WinnerEffectTimer = null; + //战斗信息包 + function FightInfoCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + MyState = Jso.state; + + FightInfo = Jso; + if (MyState >= 30) { + WinnerEffectTimer = Clock(); + } + } + + //获胜者动画 + NotiState = false; //公告状态 + NotiStr = null; //公告内容 + NotiTime = null; //公告时间 + + function WinnerAniCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + NotiState = true; //公告状态 + NotiStr = Jso.Str; //公告内容 + NotiTime = Clock(); + } + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { Childrens = []; Title = []; RiderInfo = []; - //读取配置文件 - local Config = R_Utils.ReadScriptConfig("etc/rindro/horseguessing/horseguessing.dat", 1024, "utf8"); + RiderName = [ + "伊撒尔", + "理查德", + "席恩", + "吉尔特", + "爱德华", + "罗兰", + "莱奥", + "贝奥武夫", + ]; - RiderName = Config.RiderInfo; - BetItem = Config.ItemId; - //把big的名字 转成 utf8 - for (local i = 0; i< RiderName.len(); i++) { - RiderName[i] = Sq_ConvertWideChar(RiderName[i], "big5"); - } + // //读取配置文件 + // local Config = R_Utils.ReadScriptConfig("etc/rindro/horseguessing/horseguessing.dat", 1024, "utf8"); + + // RiderName = Config.RiderInfo; + // BetItem = Config.ItemId; + // //把big的名字 转成 utf8 + // for (local i = 0; i< RiderName.len(); i++) { + // RiderName[i] = Sq_ConvertWideChar(RiderName[i], "big5"); + // } //注册控件 RegisterWidget(); + Pack_Control.rawset(20055058, InitRiderNameCallBack.bindenv(this)); + Pack_Control.rawset(20055002, GetBaseConfigCallBack.bindenv(this)); + Pack_Control.rawset(20055010, GetPastRecordCallBack.bindenv(this)); + Pack_Control.rawset(20055004, GetRiderInfoCallBack.bindenv(this)); + Pack_Control.rawset(20055018, NotifyRefreshInfoCallBack.bindenv(this)); + Pack_Control.rawset(20055020, DrawAniInfoCallBack.bindenv(this)); + Pack_Control.rawset(20055012, FightInfoCallBack.bindenv(this)); + Pack_Control.rawset(20055078, WinnerAniCallBack.bindenv(this)); + + //获取基础配置 + GetBaseConfig(); + //获取历史战绩 + GetPastRecord(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + GuidePage = HorseGuessing_GuideC("骑士马战_指引窗口", X + 7, Y + 50, 214, 480, 0); KnightInfoPage = HorseGuessing_KnightInfoC("骑士马战_资料窗口", X + 7, Y + 50, 214, 480, 0); + PastRecordPage = HorseGuessing_PastRecordC("骑士马战_战绩窗口", X + 7, Y + 50, 214, 480, 0); //默认构造时切换到0页 - ChangePage(1); + ChangePage(0); } function ChangePage(ToPage) { @@ -129,6 +320,46 @@ class HorseGuessingC extends LenheartNewUI_Windows { } } + //初始化骑士按钮 + function InitKnightButton() { + foreach(pos, v in RiderInfo) { + local KnightButton = HorseGuessingBaseButton(269 + ((pos / 2) * 121) + ((pos % 2) * 59), 398, 36, 42, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_cha_btn.img", pos * 4); + //如果是偶数需要翻转骑士 + if (pos % 2 == 1) { + KnightButton.IsFlip = true; + KnightButton.Localtion_X += 36; + } + KnightButton.Data = v; + KnightButton.OnClickEx = function(Button) { + this.NowSelectRider = Button.Data.code; + ChangePage(1); + //请求骑士个人信息 + this.GetRiderInfo(); + }.bindenv(this); + + KnightButton.SetCallBackFunc(function(Button) { + //是否翻转的偏移 + local FlipXOffset = ((Button.IsFlip == true) ? -35 : 0); + local horseKey = ((Button.IsFlip == true) ? "right" : "left"); + //绘制旗帜 + L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 11 + Button.Data.code, Button.X - 6 + FlipXOffset, Button.Y + 46); + //绘制赔率信息 + local OddsStr = format("%.2f", Button.Data.Odds.tofloat()); + L_sq_DrawCode(OddsStr, Button.X + 18 + FlipXOffset - LenheartTextClass.GetStringLength(OddsStr) / 2, Button.Y + 53); + //绘制已投币数量 + local codeItem = Button.Data.codeItem.tostring(); + L_sq_DrawCode(codeItem, Button.X + 18 + FlipXOffset - LenheartTextClass.GetStringLength(codeItem) / 2, Button.Y + 68); + + //绘制框 + if (FlipXOffset == -35) FlipXOffset = -37; //傻逼国服美工这个偏移和那个翻转的偏移不一样 + L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_horse_" + horseKey + "_effect.img", Button.Data.code * 2, Button.X + FlipXOffset - 11, Button.Y - 54); + + + }.bindenv(this)); + Childrens.append(KnightButton); + } + } + function RegisterWidget() { //关闭按钮 local CloseButton = LenheartNewUI_BaseButton(750, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); @@ -161,6 +392,9 @@ class HorseGuessingC extends LenheartNewUI_Windows { Tabbars3.SetTextOffset(7, 3); Title.append(Tabbars3); + + + } function DrawInfo(obj) { @@ -185,10 +419,167 @@ class HorseGuessingC extends LenheartNewUI_Windows { // L_sq_DrawCode(L_sq_StringBinById(271069), X + 400, Y + 386, sq_RGBA(255, 255, 255, 250), 0, 1); } + //开始动画 + CompetitionStartAnimotion = null; + //绘制动画 + function DrawAnimation(obj) { + //绘制321开始 + if (AnimationAct == 1) { + CompetitionStartAnimotion = T_DrawDynamicAni(obj, "common/horseguessing/countdown.ani", X + 9 + 287 - 14 + 202, Y + 45 + 237 + 64 - 144, "HorseGuessingCompetitionState8"); + } + //绘制战斗 + else if (AnimationAct == 2) { + local T = { + count = 4, + x = 282, + y = 346, + x2 = 282, + y2 = 346, + x3 = 282, + y3 = 346, + offset = 122, + } + // if(MyState < 10) + if (MyState >= 10 && MyState< 20) { + T.count = 2; + T.x = 344; + T.y = 222; + T.x2 = 310; + T.y2 = 232; + T.x3 = 380; + T.y3 = 232; + T.offset = 244; + } else if (MyState >= 20) { + T.count = 1; + T.x = 465; + T.y = 54; + T.x2 = 370; + T.y2 = 120; + T.x3 = 560; + T.y3 = 120; + T.offset = 244; + } + + for (local i = 0; i< T.count; i++) { + T_DrawDynamicAni(obj, "common/horseguessing/battle.ani", X + T.x + (i * T.offset), Y + T.y, "骑士马战战斗动画文字"); + + T_DrawDynamicAni(obj, "common/horseguessing/battleleffect.ani", X + T.x2 + (i * T.offset), Y + T.y2, "骑士马战战斗动画左"); + T_DrawDynamicAni(obj, "common/horseguessing/battlereffect.ani", X + T.x3 + (i * T.offset), Y + T.y3, "骑士马战战斗动画右"); + } + } + //结束绘制 + else if (AnimationAct == 3) { + + } + } + + //绘制骑士和生命值 + function DrawKnightAndHpDrawFunction(T, Key) { + foreach(i, value in FightInfo[Key]) { + local DrawX = X + T.x + ((i / 2) * T.offset1) + ((i % 2) * T.offset2); + local DrawY = Y + T.y; + + local XRate = (i % 2 == 0 ? 1.0 : -1.0); + local Xoffset = (i % 2 == 0 ? 0 : 36); + L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_cha_btn.img", value.code * 4, DrawX + Xoffset, DrawY, 1, sq_RGBA(255, 255, 255, 250), XRate, 1.0); + + //绘制血条 + setClip(DrawX + 2, DrawY - 4, DrawX + 2 + (34.0 * (value.hp.tofloat() / 100.0)).tointeger(), DrawY - 4 + 2); + L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 2, DrawX + 2, DrawY - 4); + releaseClip(); + + //绘制胜利线 + if (value.win > 0) { + local XXoffset = (i % 2 == 0 ? 0 : -2); + L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 20 + T.imgoffset, DrawX + XXoffset + T.Xx, DrawY - 65 + T.Xy, 1, sq_RGBA(255, 255, 255, 250), XRate, 1.0); + } + } + } + + function DrawKnightAndHp(obj) { + if (!FightInfo) return; + + if (MyState > 0) { + local T = { + x = 268, + y = 398, + offset1 = 121, + offset2 = 59, + imgoffset = 0, + Xx = 20, + Xy = 0 + } + DrawKnightAndHpDrawFunction(T, "top8"); + } + if (MyState >= 10) { + local T = { + x = 298, + y = 287, + offset1 = 242, + offset2 = 122, + imgoffset = 1, + Xx = 19, + Xy = 0 + }; + DrawKnightAndHpDrawFunction(T, "top4"); + } + if (MyState >= 20) { + local T = { + x = 358, + y = 176, + offset1 = 400, + offset2 = 244, + imgoffset = 2, + Xx = 19, + Xy = 7 + }; + DrawKnightAndHpDrawFunction(T, "top2"); + } + if (MyState >= 30) { + local T = { + x = 482, + y = 88, + offset1 = 121, + offset2 = 59, + imgoffset = 1, + Xx = 19, + Xy = 0 + }; + T_DrawDynamicAni(obj, "common/horseguessing/winnereffect_back.ani", X + T.x, Y + T.y, "骑士马战冠军背景"); + DrawKnightAndHpDrawFunction(T, "top1"); + T_DrawDynamicAni(obj, "common/horseguessing/winnereffect_front.ani", X + T.x - 15, Y + T.y - 10, "骑士马战冠军特效" + WinnerEffectTimer); + } + + } + + //绘制公告 + function DrawNoti(obj) { + //NotiStr + if (NotiState) { + // print(Clock() - NotiTime); + local A = 0; + if (Clock() - NotiTime< 2000) { + A = sq_GetUniformVelocity(0, 250, Clock() - NotiTime, 2000); + } + if (Clock() - NotiTime >= 2000 && Clock() - NotiTime< 3000) A = 250; + if (Clock() - NotiTime >= 3000) { + A = sq_GetUniformVelocity(250, 0, Clock() - NotiTime, 6000); + } + local Xpos = ((getroottable().Rindro_Scr_Width - 647) / 2).tointeger(); + L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 26, Xpos, 160, 0, sq_RGBA(255, 255, 255, A), 1.0, 1.0); + L_sq_DrawCode(NotiStr, Xpos + 366 - LenheartTextClass.GetStringLength(NotiStr), 160 + 44, sq_RGBA(255, 255, 255, A), 2, 1); + if (Clock() - NotiTime >= 6000) { + NotiState = false; + } + // NotiTime + } + } + function Show(obj) { DrawMain(obj); LenheartNewUI_Windows.Show(obj); - + DrawAnimation(obj); + DrawKnightAndHp(obj); } //逻辑入口 @@ -202,10 +593,18 @@ class HorseGuessingC extends LenheartNewUI_Windows { } } + function TopShow(obj) { + DrawNoti(obj); + } + function OpenCallBack() { this.Visible = true; ResetFocus(); + //获取基础配置 + GetBaseConfig(); + //获取历史战绩 + GetPastRecord(); } } getroottable().rawdelete("HorseGuessing_Obj"); diff --git a/Project/HorseGuessing/HorseGuessing_KnightInfo.nut b/Project/HorseGuessing/HorseGuessing_KnightInfo.nut index ccc17b8..e289549 100644 --- a/Project/HorseGuessing/HorseGuessing_KnightInfo.nut +++ b/Project/HorseGuessing/HorseGuessing_KnightInfo.nut @@ -18,9 +18,20 @@ class HorseGuessing_KnightInfoC extends LenheartNewUI_Windows { //输入框 InputObject = null; + AniList = null; + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { Childrens = []; + AniList = []; + for (local i = 0; i< 13; i++) { + local obj = sq_getMyCharacter(); + local ani = obj.getVar().GetAnimationMap("common/horseguessing/knight" + i + ".ani", "common/horseguessing/knight" + i + ".ani"); + AniList.append({ + ani = ani, + flag = false + }); + } //注册控件 RegisterWidget(); @@ -39,6 +50,10 @@ class HorseGuessing_KnightInfoC extends LenheartNewUI_Windows { } SendPackEx(T); }.bindenv(this); + BetButton.SetCallBackFunc(function(Button) { + if (Parent.MyState != 0) Button.Visible = false; + else Button.Visible = true; + }.bindenv(this)); Childrens.append(BetButton); InputObject = LenheartNewUI_BaseInput(80, 564, 76, 20); @@ -64,17 +79,21 @@ class HorseGuessing_KnightInfoC extends LenheartNewUI_Windows { //骑手胜率信息 - if (Parent.RiderInfo && Parent.RiderInfo.len() >= 5) { - L_sq_DrawCode("获胜 : " + Parent.RiderInfo[2] + "次", X + 25 + 5, Y + 56 + 17, sq_RGBA(255, 255, 255, 250), 0, 1); - L_sq_DrawCode(Parent.RiderInfo[0] + "胜" + Parent.RiderInfo[1] + "败", X + 25 + 5, Y + 56 + 17 + 19, sq_RGBA(255, 255, 255, 250), 0, 1); + if (Parent.RiderInfo && Parent.RiderInfo.len() > Parent.NowSelectRider && "outcome" in Parent.RiderInfo[Parent.NowSelectRider]) { + local Info = Parent.RiderInfo[Parent.NowSelectRider].outcome; + L_sq_DrawCode("获胜 : " + Info[2] + "次", X + 15 + 5, Y + 20, sq_RGBA(255, 255, 255, 250), 0, 1); + //胜负情况字符串 + local outcomeStr = Info[0] + "胜" + Info[1] + "败"; + L_sq_DrawCode(outcomeStr, X + 50 - LenheartTextClass.GetStringLength(outcomeStr) / 2, Y + 38, sq_RGBA(255, 255, 255, 250), 0, 1); local WinRate = 0; - if (Parent.RiderInfo[0] + Parent.RiderInfo[1] != 0) - WinRate = ((Parent.RiderInfo[0].tofloat() / (Parent.RiderInfo[0] + Parent.RiderInfo[1]).tofloat()) * 100.0).tointeger(); - L_sq_DrawCode("胜率 : " + WinRate + "%", X + 25 + 5, Y + 56 + 17 + 19 + 15, sq_RGBA(255, 255, 255, 250), 0, 1); + if (Info[0] + Info[1] != 0) //判断不要0 / 0 + WinRate = ((Info[0].tofloat() / (Info[0] + Info[1]).tofloat()) * 100.0).tointeger(); + WinRate = "胜率 : " + WinRate + "%"; + L_sq_DrawCode(WinRate, X + 55 - LenheartTextClass.GetStringLength(WinRate) / 2, Y + 54, sq_RGBA(255, 255, 255, 250), 0, 1); - if (Parent.RiderInfo[3] != 0 && Parent.RiderInfo[4] != 0) { - L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", Parent.RiderInfo[3], X + 25 + 5 + 152, Y + 62); - L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", Parent.RiderInfo[4], X + 25 + 5 + 152, Y + 62 + 36); + if (Info[3] != 0 && Info[4] != 0) { + L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", Info[3], X + 25 + 5 + 152, Y + 10); + L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", Info[4], X + 25 + 5 + 152, Y + 46); } } @@ -107,6 +126,14 @@ class HorseGuessing_KnightInfoC extends LenheartNewUI_Windows { if (InputObject.str.len() > 0 && InputObject.str.tointeger() > Parent.ResidueCoin) { InputObject.SetStr(Parent.ResidueCoin.tostring()); } + + //在城镇的时候才播放 + if (sq_GetCurrentModuleType() == 1) { + foreach(value in AniList) { + sq_AnimationProc(value.ani); + sq_drawCurrentFrame(value.ani, -600, 0, true); + } + } } diff --git a/Project/HorseGuessing/HorseGuessing_PastRecord.nut b/Project/HorseGuessing/HorseGuessing_PastRecord.nut new file mode 100644 index 0000000..b67b51a --- /dev/null +++ b/Project/HorseGuessing/HorseGuessing_PastRecord.nut @@ -0,0 +1,68 @@ +/* +文件名:HorseGuessing_PastRecord.nut +路径:Project/HorseGuessing/HorseGuessing_PastRecord.nut +创建日期:2024-09-27 19:10 +文件用途:马战过往战绩窗口 +*/ +class HorseGuessing_PastRecordC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + // Visible = false; + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + } + + function RegisterWidget() {} + + //绘制主界面 + function DrawMain(obj) { + L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 26, X, Y); + + + if (Parent.InfoContestLog) { + foreach(Pos, Value in Parent.InfoContestLog) { + L_sq_DrawCode((format("%03d", Value.Periods)).tostring(), X + 6, Y + 26 + (Pos * 20), sq_RGBA(255, 255, 255, 250), 0, 1); + L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 38 + Value.code, X + 32, Y + 24 + (Pos * 20)); + L_sq_DrawCode(Parent.RiderName[Value.code], X + 32 + 28, Y + 26 + (Pos * 20), sq_RGBA(255, 255, 255, 250), 0, 1); + L_sq_DrawCode((format("%.2f", Value.SOdds.tofloat())).tostring(), X + 32 + 28 + 100, Y + 26 + (Pos * 20), sq_RGBA(255, 255, 255, 250), 0, 1); + } + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X - 7, Y - 50); + + if (Parent && Parent.Visible && Parent.PageSelectM == 2) { + Visible = true; + X = Parent.X + 7; + Y = Parent.Y + 50; + } else { + Visible = false; + } + } + + + //因为要重载LenheartNewUI_Windows的构造函数 + function ResetFocus() { + + } +} + + +getroottable().rawdelete("HorseGuessing_Obj"); \ No newline at end of file diff --git a/Project/HudUi/HudUi.nut b/Project/HudUi/HudUi.nut index d2ca854..88d754a 100644 --- a/Project/HudUi/HudUi.nut +++ b/Project/HudUi/HudUi.nut @@ -573,6 +573,9 @@ class HudUiC extends LenheartNewUI_Windows { for (local i = 0; i< 6; i++) { //消耗品 L_sq_DrawImg("interface2/hud/hud.img", 200, 134 + (i * 31), 567); + } + + for (local i = 0; i< 7; i++) { //上排技能 L_sq_DrawImg("interface2/hud/hud.img", 201, 431 + (i * 31), 531); L_sq_DrawImg("interface2/hud/hud.img", 201, 431 + (i * 31), 562); @@ -586,6 +589,7 @@ class HudUiC extends LenheartNewUI_Windows { //绘制经验盖槽 L_sq_DrawImg("interface2/hud/hud.img", 202, 313, 582); + //绘制经验条 DrawExpBar(obj); diff --git a/Project/SkinHub/SkinHub.nut b/Project/SkinHub/SkinHub.nut new file mode 100644 index 0000000..70516c6 --- /dev/null +++ b/Project/SkinHub/SkinHub.nut @@ -0,0 +1,579 @@ +/* +文件名:SkinHub.nut +路径:Project/SkinHub/SkinHub.nut +创建日期:2024-09-27 22:44 +文件用途:皮肤仓库 +*/ + +class DamageFontObjectC { + X = 0; + Y = 0; + IDX = null; + UIdx = null; + gName = null; + gImgPath = null; + gMaxNumArr = null; + ID = null; + Parent = null; + ItemId = null; + + constructor(ItemId, gName, gImgPath, gMaxNumArr, gId, Parent) { + this.gName = gName; + this.gImgPath = gImgPath; + this.gMaxNumArr = gMaxNumArr; + this.gMaxNumArr = gMaxNumArr; + this.ID = gId; + this.Parent = Parent; + this.ItemId = ItemId; + } + + //绘制 + function Show(obj, x, y) { + X = x; + Y = y; + + //绘制底 + L_sq_DrawImg("interface2/skinstorage/slots.img", 0, x, y); + L_Sq_DrawItem(X + 22, Y + 23, ID, 1, 0, 0, 0); + //绘制盖子 + L_sq_DrawImg("interface2/skinstorage/slots.img", 2, x, y); + // + L_sq_DrawCode(gName, X + 84, Y + 23, sq_RGBA(178, 155, 113, 250), 0, 1); + L_sq_DrawCode("Yosin皮肤字体", X + 84, Y + 40, sq_RGBA(255, 177, 0, 250), 0, 1); + L_sq_DrawCode("无限制使用", X + 84, Y + 55, sq_RGBA(255, 85, 0, 250), 0, 1); + + //绘制选中效果 + if (Parent.FocusPrintIdx == ItemId) L_sq_DrawImg("interface2/skinstorage/slots.img", 4, x, y); + //绘制应用中 + if (Parent.NowDamageSkinIndex == ItemId) L_sq_DrawImg("interface2/skinstorage/slots.img", 23, x + 290, y + 3); + } +} + +class SkinHubC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + Visible = false; + + + //当前字体皮肤编号 + NowDamageSkinIndex = null; + //拥有的字体列表 + HasDamageSkinList = null; + //字体皮肤数据 + DamageSkinList = null; + //数字伤害类型 + RealType = null; + //当前页面 + NowPage = 0; + + //最大伤害数字 + MaxDamageNumber = 99999999; + + //显示对象 + FocusPrintIdx = 561320400; + FocusPrintType = 0; + //Nut白字倍率 + NutWRate = 0; + + FontIdx = 0; + MapBaseXPos = 0; + MapBaseYPos = 0; + DamageFontArray = null; + + //获取字体列表信息 + function GetFontList() { + local T = { + op = 20076005, + } + SendPack(T); + } + + //获取字体列表信息回调 + function GetFontListCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + NowDamageSkinIndex = Jso.damagefontCurrent; + InitDamageFont(NowDamageSkinIndex); + FocusPrintIdx = Jso.damagefontCurrent; + foreach(value in Jso.damagefont) { + DamageSkinList[value].IsHave = true; + } + } + + //基础信息包回调 + function GetBaseInfoCallBack(Chunk) { + DamageSkinList = {}; + local Jso = Json.Decode(Chunk); + local Info = Jso.ZipS; + Info = Json.Decode(L_sq_Dezlib(Info)).info; + foreach(Idx, value in Info) { + value.IsHave <- false; + DamageSkinList.rawset(Idx.tointeger(), value); + } + } + + //初始化伤害字体 + function InitDamageFont(Idx) { + if (Idx == null) { + for (local i = 0; i< 7; i++) { + L_sq_IntiNumberDraw("common/etc/damagefontskin/damagefont00.img", 0 + (i * 10), i); + } + } else { + for (local i = 0; i< 7; i++) { + L_sq_IntiNumberDraw(DamageSkinList[Idx].gImgPath, 0 + (i * 10), i); + } + } + } + + //初始化数字伤害类型 + function InitRealType() { + RealType = [0, 5, 1, 5, 2, 5, 1, 2, 3, 5, 4, 5, 3, 5, 4, 5, 0, 5, 4, 5, 2, 5, 4]; + } + + //设置NUT白字 + function SetNutRate() { + // local allRate = 1.0; + // for (local i = 1; i < 41; i++) { + // allRate = allRate * (sq_GetIntData(obj, 169, i) / 100).tofloat(); + // } + // for (local w = 1; w < 21; w++) { + // allRate = allRate * (sq_GetIntData(obj, 174, w) / 100).tofloat(); + // } + NutWRate = 1.0; + } + + //设置地图原点 + function SetMapBasePos(obj) { + local objectManager = obj.getObjectManager(); + if (!objectManager) return; + MapBaseXPos = objectManager.getFieldXPos(0, ENUM_DRAWLAYER_NORMAL); + MapBaseYPos = objectManager.getFieldYPos(0, 0, ENUM_DRAWLAYER_NORMAL); + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + + DamageFontArray = {}; + DamageSkinList = {}; + HasDamageSkinList = []; + + local T = { + gIdx = 0, //伤害字体排列编号 + gName = "默认伤害字体", //伤害字体名称 + gImgPath = "common/etc/damagefontskin/damagefont00.img", //Img路径 + gMaxNumArr = [73, 72], //普通999帧数数组 + gKeyMaxNumArr = [71, 70], //暴击999帧数数组 + itemId = 561320400, //道具ID + IsHave = true + } + DamageSkinList.rawset(561320400, T); + + //注册控件 + RegisterWidget(); + + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + Pack_Control.rawset(20076006, GetFontListCallBack.bindenv(this)); + Pack_Control.rawset(20076010, GetBaseInfoCallBack.bindenv(this)); + PushDamageFontDataFuncTab.rawset("SkinHub", PushDamageFontArray.bindenv(this)); + + //初始化伤害类型 + InitRealType(); + //初始化伤害字体 + InitDamageFont(NowDamageSkinIndex); + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(765, 2, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + + + for (local i = 0; i< 5; i++) { + //激活按钮 + local ActiveButton = LenheartNewUI_ButtonText(700, 140 + (i * 85), 15, "应 用"); + ActiveButton.Data = i; + ActiveButton.SetFrame(null, 172); + ActiveButton.SetTextOffset(-3, 1); + ActiveButton.OnClickEx = function(Button) { + local T = { + op = 20076007, + itemId = HasDamageSkinList[Button.Data], + type = 0 + } + SendPackEx(T); + NowDamageSkinIndex = HasDamageSkinList[Button.Data]; + FocusPrintIdx = HasDamageSkinList[Button.Data]; + InitDamageFont(HasDamageSkinList[Button.Data]); + }.bindenv(this); + ActiveButton.SetCallBackFunc(function(Button) { + if (Button.Data >= (HasDamageSkinList.len())) { + Button.Visible = false; + } else { + Button.Visible = true; + } + }.bindenv(this)) + AddChild(ActiveButton); + + } + + //测试伤害按钮 + local TestButton = LenheartNewUI_ButtonText(10, 536, 15, "测试字体"); + TestButton.SetFrame(null, 172); + TestButton.SetTextOffset(-7, 1); + TestButton.OnClickEx = function(Button) { + PushDamageFontArray(0x1AB7CDC, 400, 300, 0, Clock(), FocusPrintType, 0, 0); + }.bindenv(this); + TestButton.SetCallBackFunc(function(Button) { + if (Button.isInRect) { + L_sq_DrawWindow(X + 10, Y + 500, 160, 12, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + L_sq_DrawCode("按下[空格键]以测试伤害数字。", X + 18, Y + 512, sq_RGBA(178, 155, 113, 250), 0, 1); + } + }.bindenv(this)) + + AddChild(TestButton); + } + + //绘制主界面 + function DrawMain(obj) { + //绘制窗口 + L_sq_DrawImg("interface2/skinstorage/skinstorage.img", 0, X, Y); + + //绘制字体排列窗口 + L_sq_DrawImg("interface2/skinstorage/skinstorage.img", 5, X + 421 - 9, Y + 108 - 67); + //总览 + L_sq_DrawImg("interface2/skinstorage/tab/tab_summary.img", 3, X + 421 - 8, Y + 46 - 8); + //边框 + L_sq_DrawImg("interface2/skinstorage/tab/tab_partyframe.img", 3, X + 487 - 8, Y + 46 - 8); + //伤害字体 + L_sq_DrawImg("interface2/skinstorage/tab/tab_damagefonts.img", 2, X + 533 + 4, Y + 42 - 3); + //觉醒插图 + L_sq_DrawImg("interface2/skinstorage/tab/tab_cutscene.img", 3, X + 609 - 7, Y + 52 - 14); + //表情 + L_sq_DrawImg("interface2/skinstorage/tab/tab_instantemoticon.img", 3, X + 674 - 16, Y + 49 - 11); + //表情 + L_sq_DrawImg("interface2/skinstorage/tab/tab_weaponlook.img", 3, X + 722 - 7, Y + 55 - 17); + + + L_sq_DrawCode("伤害字体类型: " + FocusPrintType, X + 84, Y + 542, sq_RGBA(178, 155, 113, 250), 0, 1); + + local RealDrawPos = 0; + HasDamageSkinList = []; + foreach(Pos, v in DamageSkinList) { + //如果拥有字体 + if (v.IsHave) { + HasDamageSkinList.append(v.itemId); + local Yoffset = ((RealDrawPos + NowPage) * 85); + RealDrawPos++; + if (Yoffset > 400 || Yoffset< 0) continue; + local Dobj = DamageFontObjectC(v.itemId, v.gName, v.gImgPath, v.gMaxNumArr, v.itemId, this); + Dobj.Show(obj, X + 425, Y + 114 + Yoffset); + } + } + + //绘制页数 + local Page = (abs(NowPage) + 1) + " / " + (abs(HasDamageSkinList.len() - 5) + 1); + L_sq_DrawCode(Page, X + 586 + LenheartTextClass.GetStringLength(Page) / 2, Y + 537, sq_RGBA(150, 255, 30, 250), 0, 1); + + local chr = sq_GetCNRDObjectToSQRCharacter(obj); + local charAni = chr.sq_GetStayAni(); + sq_AnimationProc(charAni); + sq_drawCurrentFrame(charAni, X + 210, Y + 364, false); + + local MonsterAni = T_DrawDynamicAni_Fx(obj, "monster/goblin/animation_goblin2/down.ani", X + 360, Y + 364, "伤害字体哥布林倒地"); + local NeArray = TryGetArry(1); + if (sq_GetCurrentTime(MonsterAni) >= 1000 && NeArray.len() == 0) { + local Timer = Clock(); + local T = { + gIdx = "演示字体" + FontIdx, + XPos = X + 166, + YPos = Y + 230, + DamageNum = 999999999, + Type = 5, + TimeObj = Timer, + isKeyHit = false, + } + NeArray.append(T); + DamageFontArray.rawset(1, NeArray); + sq_Rewind(MonsterAni); + } + } + + function TryGetArry(Type) { + if (DamageFontArray.rawin(Type)) return DamageFontArray[Type]; + else return []; + } + + + //将伤害字体数据Push进数组 + function PushDamageFontArray(ObjAddress, X, Y, Z, Value, Type, A1, A2) { + local Timer = Clock(); + local gRealType; + if (Type <= 7) gRealType = RealType[Type]; + else gRealType = RealType[((Type - 7) % 16) + 7]; + //暴击 + local KeyHit = false; + if (Type == 17) KeyHit = true; + //是扣血还是回血 + if (Type == 7) { + if (Value< 0) gRealType = 4; + } + if (Type == 4) { + if (Value< 0) gRealType = 0; + } + if (Type == 1 || Type == 17) { + //记录总伤害 + local oldDamageNum = Value; + //计算我的真是伤害 + Value = (Value / NutWRate).tointeger(); + //减去真实伤害 就是nut伤害 + local newDamageNum = oldDamageNum - Value; + //如果有Nut伤害存在 + if (newDamageNum > 0) { + local NeArray = TryGetArry(Type); + local Timer = Clock(); + local T = { + gIdx = ObjAddress + FontIdx, + XPos = X, + YPos = Y - Z - (NeArray.len() * 16), + DamageNum = Value, + Type = 0, + TimeObj = Timer, + isKeyHit = KeyHit, + } + NeArray.append(T); + DamageFontArray.rawset(Type, NeArray); + ++FontIdx; + } + } + local NeArray = TryGetArry(Type); + local T = { + gIdx = ObjAddress + FontIdx, + XPos = X + sq_getRandom(-15, 15), + YPos = Y - Z + sq_getRandom(-20, 20), + DamageNum = Value, + Type = gRealType, + TimeObj = Timer, + isKeyHit = KeyHit, + } + NeArray.append(T); + DamageFontArray.rawset(Type, NeArray); + ++FontIdx; + return false; + } + + function DrawFontImg(X, Y, Type, DamageNum, Time, isKeyHit) { + local rate = sq_GetUniformVelocity(60, 100, Time, 100); + rate = rate.tofloat() / 100.0; + //如果暴击 + if (isKeyHit) { + rate *= 1.3; + Type = 4; + } + //白字 + if (Type == 0) { + rate *= 0.7; + Y += 60; + } + local UpOffset = 0; + local Alpha = 0; + //超过0.3秒开始飘 + if (Time >= 300) { + UpOffset = sq_GetUniformVelocity(0, 15, Time - 300, 500); + } + //超过0.3秒开始飘 + if (Time >= 800) { + UpOffset = sq_GetAccel(15, 100, Time - 800, 500, true); + Alpha = sq_GetUniformVelocity(0, 250, Time - 800, 500); + } + if (DamageNum > MaxDamageNumber) { + if (isKeyHit) { + foreach(imgpos in DamageSkinList[FocusPrintIdx].gKeyMaxNumArr) { + L_sq_DrawImg(DamageSkinList[FocusPrintIdx].gImgPath, imgpos, X + ((30 * (MaxDamageNumber.tostring().len())) - ((20 * (MaxDamageNumber.tostring().len())) * rate)), Y + (20 - (20 * rate)) - UpOffset, 0, sq_RGBA(255, 255, 255, 255 - Alpha), rate, rate); + } + } else { + foreach(imgpos in DamageSkinList[FocusPrintIdx].gMaxNumArr) { + L_sq_DrawImg(DamageSkinList[FocusPrintIdx].gImgPath, imgpos, X + ((30 * (MaxDamageNumber.tostring().len())) - ((20 * (MaxDamageNumber.tostring().len())) * rate)), Y + (20 - (20 * rate)) - UpOffset, 0, sq_RGBA(255, 255, 255, 255 - Alpha), rate, rate); + } + } + } else { + // L_sq_DrawNumber(X + ((30 * (DamageNum.tostring().len())) - ((20 * (DamageNum.tostring().len())) * rate)), Y + (20 - (20 * rate)) - UpOffset, sq_RGBA(255, 255, 255, 255 - Alpha), rate, rate, Type, 18 * rate, 6, sq_Abs(DamageNum)); + L_sq_DrawNumber(X, Y - UpOffset, sq_RGBA(255, 255, 255, 255 - Alpha), rate, rate, Type, sq_Abs(DamageNum)); + } + } + + //伤害字体绘制 + function DrawFont(obj) { + foreach(Type, FontArrayObject in DamageFontArray) { + if (Type == 0) continue; + for (local i = 0; i< FontArrayObject.len(); i++) { + local FontObject = FontArrayObject[i]; + if (FontObject) { + local Timer = FontObject.TimeObj; + if (Timer) { + local Time = Clock() - Timer; + if (Time >= 1300) { + FontObject.TimeObj = null; + FontArrayObject.remove(i); + continue; + } else { + DrawFontImg(FontObject.XPos - MapBaseXPos, FontObject.YPos - MapBaseYPos, FontObject.Type, FontObject.DamageNum, Time, FontObject.isKeyHit); + } + } + } + } + } + //白字 + foreach(Type, FontArrayObject in DamageFontArray) { + if (Type != 0) break; + for (local i = 0; i< FontArrayObject.len(); i++) { + local FontObject = FontArrayObject[i]; + if (FontObject) { + local Timer = FontObject.TimeObj; + if (Timer) { + local Time = Clock() - Timer; + if (Time >= 1100) { + FontObject.TimeObj = null; + FontArrayObject.remove(i); + continue; + } else { + DrawFontImg(FontObject.XPos - MapBaseXPos, FontObject.YPos - MapBaseYPos, FontObject.Type, FontObject.DamageNum, Time, FontObject.isKeyHit); + } + } + } + } + } + } + + + function T_DrawDynamicAni_Fx(obj, aniFileName, x, y, aniname) { + local ani = obj.getVar().GetAnimationMap(aniname, aniFileName); + ani.setImageRateFromOriginal(-1.0, 1.0); + sq_AnimationProc(ani); + sq_drawCurrentFrame(ani, x, y, true); + return ani; + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + } + + function TopShow(obj) { + //绘制字体 + DrawFont(obj); + + + if (MousePosFlag == 1) { + L_sq_DrawWindow(X + 60, Y + 500, 160, 12, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + L_sq_DrawCode("使用鼠标滚轮以改变字体类型。", X + 68, Y + 512, sq_RGBA(178, 155, 113, 250), 0, 1); + } + + } + + + + MousePosFlag = 0; + //override + //鼠标滚轮事件回调 + function OnMouseWheel(Flag, MousePos_X, MousePos_Y) { + MousePos_X -= X; + MousePos_Y -= Y; + + + //鼠标在滚动字体类型区域 + if (MousePosFlag == 1) { + if (Flag) { + if (FocusPrintType< 17) FocusPrintType++; + } else { + if (FocusPrintType > 0) FocusPrintType--; + } + } else if (MousePosFlag == 2) { + if (Flag) { + if (NowPage< 0) NowPage++; + } else { + if ((HasDamageSkinList.len()) > abs(NowPage - 5)) NowPage--; + } + } + + //调用原生方法 + LenheartNewUI_Windows.OnMouseWheel(Flag, MousePos_X, MousePos_Y); + } + + //override + function OnMouseProc(Flag, MousePos_X, MousePos_Y) { + //调用原生方法 + LenheartNewUI_Windows.OnMouseProc(Flag, MousePos_X, MousePos_Y); + + MousePos_X -= X; + MousePos_Y -= Y; + + + //鼠标在滚动字体类型区域 + if (MousePos_X >= 82 && MousePos_Y >= 538 && MousePos_X <= 188 && MousePos_Y <= 558) { + MousePosFlag = 1; + } else if (MousePos_X >= 420 && MousePos_Y >= 110 && MousePos_X <= 782 && MousePos_Y <= 564) { + MousePosFlag = 2; + } else { + MousePosFlag = 0; + } + + + } + + + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + + //绘制字体 + if (sq_GetCurrentModuleType() == 3) DrawFont(obj); + //回到城镇清空字体数组 + else if (Visible == false) { + DamageFontArray = null; + DamageFontArray = {}; + MapBaseXPos = 0; + MapBaseYPos = 0; + } + + //设置地图原点 + SetMapBasePos(obj); + //设置NUT白字 + SetNutRate(); + + + if (KeyPressNB.isKeyPress(7, "damage") && this.Visible && sq_GetCurrentModuleType() != 3) { + PushDamageFontArray(0x1AB7CDC, 400, 300, 0, Clock(), FocusPrintType, 0, 0); + } + + } + + + function OpenCallBack() { + this.Visible = true; + ResetFocus(); + GetFontList(); + } + +} + +function Lenheart_SkinHub_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("SkinHub_Obj")) { + local Winobj = LenheartNewUI_CreateWindow(SkinHubC, "皮肤仓库窗口", ((getroottable().Rindro_Scr_Width - 788) / 2).tointeger(), 12, 788, 576, 26); + + EventList_Obj.AddEvent("皮肤仓库", 670, Winobj, "interface2/hud/information_button/information_button_cn.img"); + RootTab.rawset("SkinHub_Obj", Winobj); + } +} + +getroottable()["LenheartFuncTab"].rawset("SkinHubFuncN", Lenheart_SkinHub_Fun); \ No newline at end of file diff --git a/Project/SkinWarehouse/SkinWarehouse.nut b/Project/SkinWarehouse/SkinWarehouse.nut deleted file mode 100644 index 48aabe0..0000000 --- a/Project/SkinWarehouse/SkinWarehouse.nut +++ /dev/null @@ -1,61 +0,0 @@ -/* -文件名:SkinWarehouse.nut -路径:Project/SkinWarehouse/SkinWarehouse.nut -创建日期:2024-08-25 09:55 -文件用途:皮肤仓库 -*/ -class SkinWarehouseC extends LenheartNewUI_Windows { - //调试模式 - // DeBugMode = true; - - //不是窗口 - // NoWindow = true; - - //是否可见 - // Visible = false; - constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { - Childrens = []; - //注册控件 - RegisterWidget(); - - LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); - } - - function RegisterWidget() { - // //关闭按钮 - // local CloseButton = LenheartNewUI_BaseButton(278, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); - // CloseButton.OnClick = function() { - // this.Visible = false; - // }.bindenv(this); - // Childrens.append(CloseButton); - - } - - //绘制主界面 - function DrawMain(obj) { - - } - - function Show(obj) { - DrawMain(obj); - LenheartNewUI_Windows.Show(obj); - - } - - //逻辑入口 - function Proc(obj) { - LenheartNewUI_Windows.SyncPos(X, Y); - } - -} -getroottable().rawdelete("SkinWarehouse_Obj"); - -function Lenheart_SkinWarehouse_Fun(obj) { - local RootTab = getroottable(); - if (!RootTab.rawin("SkinWarehouse_Obj")) { - RootTab.rawset("SkinWarehouse_Obj", true); - LenheartNewUI_CreateWindow(SkinWarehouseC, "皮肤仓库窗口", ((getroottable().Rindro_Scr_Width - 405) / 2).tointeger(), 64, 405, 372, 28); - } -} - -getroottable()["LenheartFuncTab"].rawset("SkinWarehouseFuncN", Lenheart_SkinWarehouse_Fun); \ No newline at end of file diff --git a/folder-alias.json b/folder-alias.json index 852265e..277fdca 100644 --- a/folder-alias.json +++ b/folder-alias.json @@ -100,5 +100,8 @@ }, "Project/HorseGuessing": { "description": "骑士马战" + }, + "Project/SkinHub": { + "description": "皮肤中心" } } \ No newline at end of file