-- The supported native BP_PerfectDodgePassive_C::Try Auto Dodge bytecode. -- Pointer and FName relocations are resolved against current reflection metadata. local autoDodgePattern='14 00 ?? ?? ?? ?? ?? ?? ?? ?? 19 20 ?? ?? ?? ?? ?? ?? ?? ?? 1C 00 00 00 ?? ?? ?? ?? ?? ?? ?? ?? 1C ?? ?? ?? ?? ?? ?? ?? ?? 01 ?? ?? ?? ?? ?? ?? ?? ?? 00 ?? ?? ?? ?? ?? ?? ?? ?? 16 07 4F 00 00 00 00 ?? ?? ?? ?? ?? ?? ?? ?? 06 74 02 00 00 0F ?? ?? ?? ?? ?? ?? ?? ?? 00 ?? ?? ?? ?? ?? ?? ?? ?? 68 ?? ?? ?? ?? ?? ?? ?? ?? 17 16 0F ?? ?? ?? ?? ?? ?? ?? ?? 00 ?? ?? ?? ?? ?? ?? ?? ?? 68 ?? ?? ?? ?? ?? ?? ?? ?? 00 ?? ?? ?? ?? ?? ?? ?? ?? 37 7B 14 AE 47 E1 7A A4 3F 16 14 00 ?? ?? ?? ?? ?? ?? ?? ?? 68 ?? ?? ?? ?? ?? ?? ?? ?? 42 ?? ?? ?? ?? ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? ?? ?? 00 ?? ?? ?? ?? ?? ?? ?? ?? 16 14 00 ?? ?? ?? ?? ?? ?? ?? ?? 68 ?? ?? ?? ?? ?? ?? ?? ?? 42 ?? ?? ?? ?? ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? ?? ?? 00 ?? ?? ?? ?? ?? ?? ?? ?? 16 07 74 02 00 00 00 ?? ?? ?? ?? ?? ?? ?? ?? 5F 00 ?? ?? ?? ?? ?? ?? ?? ?? 1C ?? ?? ?? ?? ?? ?? ?? ?? 16 14 00 ?? ?? ?? ?? ?? ?? ?? ?? 19 51 00 ?? ?? ?? ?? ?? ?? ?? ?? 29 00 00 00 ?? ?? ?? ?? ?? ?? ?? ?? 1B ?? ?? ?? ?? ?? ?? ?? ?? 00 00 00 00 2F ?? ?? ?? ?? ?? ?? ?? ?? 0C 00 00 00 21 ?? ?? ?? ?? ?? ?? ?? ?? 00 00 00 00 30 16 07 74 02 00 00 00 ?? ?? ?? ?? ?? ?? ?? ?? 0F ?? ?? ?? ?? ?? ?? ?? ?? 00 ?? ?? ?? ?? ?? ?? ?? ?? 19 20 ?? ?? ?? ?? ?? ?? ?? ?? 1C 00 00 00 ?? ?? ?? ?? ?? ?? ?? ?? 1C ?? ?? ?? ?? ?? ?? ?? ?? 01 ?? ?? ?? ?? ?? ?? ?? ?? 00 ?? ?? ?? ?? ?? ?? ?? ?? 16 0F ?? ?? ?? ?? ?? ?? ?? ?? 00 ?? ?? ?? ?? ?? ?? ?? ?? 68 ?? ?? ?? ?? ?? ?? ?? ?? 16 14 00 ?? ?? ?? ?? ?? ?? ?? ?? 68 ?? ?? ?? ?? ?? ?? ?? ?? 00 ?? ?? ?? ?? ?? ?? ?? ?? 37 00 00 00 00 00 00 E0 3F 16 07 74 02 00 00 00 ?? ?? ?? ?? ?? ?? ?? ?? 0F ?? ?? ?? ?? ?? ?? ?? ?? 00 ?? ?? ?? ?? ?? ?? ?? ?? 2F ?? ?? ?? ?? ?? ?? ?? ?? 0C 00 00 00 21 ?? ?? ?? ?? ?? ?? ?? ?? 00 00 00 00 30 14 00 ?? ?? ?? ?? ?? ?? ?? ?? 19 01 ?? ?? ?? ?? ?? ?? ?? ?? 21 00 00 00 ?? ?? ?? ?? ?? ?? ?? ?? 1C ?? ?? ?? ?? ?? ?? ?? ?? 00 ?? ?? ?? ?? ?? ?? ?? ?? 20 ?? ?? ?? ?? ?? ?? ?? ?? 1D FB FF FF FF 16 04 0B 53' local autoDodgeReferences={{"virtual",315,"HasMatchingGameplayTag"},{"field",1,"CallFunc_Array_Contains_ReturnValue"},{"field",23,"CallFunc_Array_Contains_ReturnValue"},{"call",32,"Array_Contains"},{"field",41,"Noob Tested Handles"},{"field",50,"Handle"},{"field",65,"CallFunc_Array_Contains_ReturnValue"},{"field",88,"CallFunc_GetGameTimeInSeconds_ReturnValue"},{"call",97,"GetGameTimeInSeconds"},{"field",117,"CallFunc_Add_DoubleDouble_ReturnValue"},{"call",126,"Add_DoubleDouble"},{"field",135,"CallFunc_GetGameTimeInSeconds_ReturnValue"},{"field",155,"CallFunc_LessEqual_DoubleDouble_ReturnValue_1"},{"call",164,"LessEqual_DoubleDouble"},{"field",182,"Frame"},{"field",191,"CallFunc_Add_DoubleDouble_ReturnValue"},{"field",202,"CallFunc_BooleanOR_ReturnValue"},{"call",211,"BooleanOR"},{"field",229,"Frame"},{"field",238,"CallFunc_LessEqual_DoubleDouble_ReturnValue_1"},{"field",253,"CallFunc_BooleanOR_ReturnValue"},{"field",263,"CallFunc_GetAbilitySystemComponentFromActorInfo_ReturnValue"},{"call",272,"GetAbilitySystemComponentFromActorInfo"},{"field",283,"CallFunc_HasMatchingGameplayTag_ReturnValue"},{"field",294,"CallFunc_GetAbilitySystemComponentFromActorInfo_ReturnValue"},{"field",306,"CallFunc_HasMatchingGameplayTag_ReturnValue"},{"name",341,"CharacterState.Accessory.ACTNoob.Lv2"},{"field",361,"CallFunc_HasMatchingGameplayTag_ReturnValue"},{"field",379,"CallFunc_Array_Add_ReturnValue"},{"field",401,"CallFunc_Array_Add_ReturnValue"},{"call",410,"Array_Add"},{"field",419,"Noob Tested Handles"},{"field",428,"Handle"},{"field",447,"CallFunc_RandomFloat_ReturnValue"},{"call",456,"RandomFloat"},{"field",467,"CallFunc_LessEqual_DoubleDouble_ReturnValue"},{"call",476,"LessEqual_DoubleDouble"},{"field",485,"CallFunc_RandomFloat_ReturnValue"},{"field",509,"CallFunc_LessEqual_DoubleDouble_ReturnValue"},{"field",527,"Temp_struct_Variable"},{"name",549,"Ability.Action.Hun.PerfectDodge"},{"field",564,"CallFunc_TryActivateExternalActionAbilityInterruptLowerByTag_ReturnValue"},{"field",574,"Ability Input"},{"field",586,"CallFunc_TryActivateExternalActionAbilityInterruptLowerByTag_ReturnValue"},{"call",595,"TryActivateExternalActionAbilityInterruptLowerByTag"},{"field",604,"Temp_struct_Variable"}} function BuildAutoDodgePlan(bytes,resolve) assert(type(bytes)=='table' and #bytes==631,'自动闪避脚本长度不匹配,未修改游戏') local i=0 for token in autoDodgePattern:gmatch('%S+')do i=i+1;assert(token=='??'or bytes[i]==tonumber(token,16),'自动闪避脚本结构不匹配,未修改游戏('..(i-1)..')') end assert(i==#bytes and type(resolve)=='function','自动闪避校验器缺失') for _,ref in ipairs(autoDodgeReferences)do assert(resolve(ref[1],ref[2],ref[3]),'自动闪避引用不匹配:'..ref[3])end -- Each EX_JumpIfNot still evaluates its original local bool. Its false target -- becomes the next statement, leaving the expression length and stack intact. -- Apply chance first, then accessory; restore in reverse order. return {{offset=505,before=628,after=518},{offset=357,before=628,after=370}} end function CreateAutoDodgeLease(binding) assert(binding and binding.address and binding.address%16==0 and binding.size==631 and binding.valid(),'自动闪避目标无效') local original=assert(readBytes(binding.address,binding.size,true),'自动闪避脚本不可读') local plan=BuildAutoDodgePlan(original,binding.resolve) local patched={};for i,v in ipairs(original)do patched[i]=v end local mutable={} for _,p in ipairs(plan)do for j=1,2 do mutable[p.offset+j]=true end patched[p.offset+1]=p.after&255;patched[p.offset+2]=p.after>>8 end local s={pending=false} local function inspect() assert(binding.valid(),'自动闪避脚本身份已变化,保留恢复记录') local bytes=assert(readBytes(binding.address,binding.size,true),'自动闪避脚本不可读,保留恢复记录') assert(#bytes==#original,'自动闪避脚本读取不完整') for i,v in ipairs(original)do assert(mutable[i]or bytes[i]==v,'自动闪避脚本被外部修改,已暂停并保留恢复记录')end for _,p in ipairs(plan)do local value=bytes[p.offset+1]|(bytes[p.offset+2]<<8) assert(value==p.before or value==p.after,'自动闪避补丁被外部修改,保留恢复记录') end return bytes end local function write(p,value) assert(binding.valid(),'自动闪避写入前目标身份已变化') -- Two-byte operands are contained within a cache line for the aligned buffer. -- No opcode, object reference, instruction length, or upper jump byte changes. assert(writeSmallInteger(binding.address+p.offset,value),'自动闪避写入失败') assert(readSmallInteger(binding.address+p.offset)==value,'自动闪避写入读回不一致') end s.apply=function() assert(not s.pending,'自动闪避租约已有待恢复修改') inspect() for _,p in ipairs(plan)do assert(readSmallInteger(binding.address+p.offset)==p.before,'自动闪避已被其他操作开启') s.pending=true;write(p,p.after) end end s.check=function() local bytes=inspect() for i,v in ipairs(patched)do assert(bytes[i]==v,'自动闪避补丁已变化,请关闭后重新开启')end end s.restore=function() if not s.pending then return end -- Validate the whole script before any restore; never overwrite a new asset. inspect() for i=#plan,1,-1 do local p=plan[i];local current=assert(readSmallInteger(binding.address+p.offset),'自动闪避恢复目标不可读') if current==p.after then write(p,p.before)else assert(current==p.before,'自动闪避恢复发生冲突')end end s.pending=false end return s end function StartAutoDodgeManager(binding) assert(not PBZ_AutoDodge,'自动闪避已开启或仍有待恢复记录') local s={lease=CreateAutoDodgeLease(binding)} s.stop=function() s.lease.restore() if s.timer then s.timer.destroy();s.timer=nil end PBZ_AutoDodge=nil end PBZ_AutoDodge=s local ok,e=pcall(function() s.lease.apply() s.timer=createTimer(nil,false);s.timer.Interval=500 s.timer.OnTimer=function() local good,why=pcall(function() if binding.localValid and not binding.localValid()then s.lease.restore();s.paused=true;error('玩家场景已变化,自动闪避已恢复;进入场景后请重新开启') end s.lease.check() end) if not good then s.lastError=tostring(why);s.timer.Enabled=false end end s.timer.Enabled=true end) if not ok then local restored,why=pcall(s.stop) if not restored then s.lastError=tostring(e)..'; '..tostring(why)end error(tostring(e)..(restored and ''or '; 恢复待重试:'..tostring(why))) end return s end -- Loaded in the private player reflection scope; no OS key simulation and no -- persistent file edits. Reflection is performed only when the feature starts. local function autoDodgeClass(cl) local seen={} for i=1,32 do if not ptr(cl)or seen[cl]then return end;seen[cl]=true if fname(cl+0x18)=='BP_PerfectDodgePassive_C'then return cl end cl=q(cl+0x40) end end local function autoDodgeFunction(cl) local f=q(cl+0x48);local seen={} for i=1,2048 do if not ptr(f)or seen[f]then return end;seen[f]=true if fname(f+0x18)=='Try Auto Dodge'then return f end f=q(f+0x28) end end function EnableAutoDodge() assert(not PBZ_AutoDodge,'自动闪避已开启') local c=assert(context(),'请先进入可操作的单机场景');local pawnID=c.id local asc=q(c.pawn+offset(pawnID.class,'AbilitySystemComponent'));local aid=identity(asc) assert(aid and q(asc+0x20)==c.pawn,'玩家能力组件不可用') local container=field(aid.class,'ActivatableAbilities',true) local items=field(container.type,'Items',true);local inner=q(items.address+0x78) local specType=ptr(inner)and q(inner+0x70);local stride=ptr(inner)and readInteger(inner+0x34) assert(ptr(specType)and stride and stride>=0x40 and stride<=0x1000,'自动闪避能力列表结构不匹配') local specs,count=array(asc+container.offset+items.offset,1024) assert(specs and count and count>0,'玩家能力尚未加载') local abilityField=field(specType,'Ability',true);assert(abilityField.size==8,'自动闪避能力引用结构不匹配') local cl for i=0,count-1 do local ability=q(specs+i*stride+abilityField.offset) local candidate=ptr(ability)and autoDodgeClass(classOf(ability)) if candidate then assert(not cl or cl==candidate,'发现多个不兼容的自动闪避类');cl=candidate end end assert(cl,'当前玩家未加载原生自动闪避被动,未修改游戏') local fn=assert(autoDodgeFunction(cl),'原生自动闪避入口缺失') local id=identity(fn) assert(id and fname(id.class+0x18)=='Function'and q(fn+0x20)==cl,'自动闪避函数归属不匹配') local address,size=array(fn+0xB0,4096) assert(address and size==631 and address%16==0,'自动闪避字节码布局不匹配') local function bindingValid() assert(state.pid==getOpenedProcessID(),'游戏进程已变化') local clNow=assert(q(fn+0x10),'自动闪避函数身份不可读') local nameNow=assert(q(fn+0x18),'自动闪避函数名称不可读') local indexNow=assert(readInteger(fn+0xC),'自动闪避函数索引不可读') local ownerNow=assert(q(fn+0x20),'自动闪避函数归属不可读') assert(clNow==id.class and nameNow==id.name and indexNow==id.index and ownerNow==cl,'自动闪避函数已被替换') local data,n=array(fn+0xB0,4096) return data==address and n==size end local function resolve(kind,at,name) if kind=='name'or kind=='virtual'then return fname(address+at+1)==name end local p=q(address+at+1);if not ptr(p)then return false end if kind=='call'then return fname(classOf(p)+0x18)=='Function'and fname(p+0x18)==name end local prop=field(fn,name)or field(cl,name) return prop and prop.address==p end assert(valid(pawnID)and valid(aid)and q(asc+0x20)==c.pawn,'自动闪避开启前玩家已变化') return StartAutoDodgeManager({address=address,size=size,valid=bindingValid,resolve=resolve, localValid=function()local now=context();return now and now.pawn==c.pawn and valid(pawnID)end}) end