using Mir2Assistant.Common.Models; using Mir2Assistant.Utils; using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; namespace Mir2Assistant.Common.Functions; /// /// 技能 /// public static class SkillFunction { /// /// 读取角色技能列表 /// /// public static void ReadSkills(MirGameInstanceModel gameInstance) { Task.Run(() => { bool isXF = false; gameInstance.Skills.Clear(); var memoryUtils = gameInstance!.MemoryUtils!; var addr = memoryUtils.GetMemoryAddress(gameInstance.MirConfig["技能基址"], 0x4, 0); while (memoryUtils.ReadToInt(addr) != 0) { var length = (byte)memoryUtils.ReadToChar(memoryUtils.GetMemoryAddress(addr, 0)); if (length <= 0 || length > 12) { break; } var skill = new SkillModel { Addr = memoryUtils.ReadToInt(addr), Length = length, Name = memoryUtils.ReadToString(memoryUtils.GetMemoryAddress(addr, 1), length), Type = (byte)memoryUtils.ReadToChar(memoryUtils.GetMemoryAddress(addr, 15)), }; if(!isXF && skill.Type == 4) { skill.IsXF = true; isXF = true; } gameInstance.Skills.Add(skill); addr += 4; } }); } /// /// 技能CAll /// public static void SkillCall(MirGameInstanceModel gameInstance, int skillAddr) { SendMirCall.Send(gameInstance, 2001, [skillAddr, gameInstance!.MirConfig["技能CALL地址"]]); } }