魔兽世界9.1开关地图卡顿掉帧怎么办,正式服也是在7月1日上线了9.1版本,那么玩家们在游戏中按M开关地图时卡顿掉帧又应该怎么办呢,可能还有些小伙伴不清楚原因。所以下面就为大家带来了开关地图卡顿掉帧的解决方法介绍!
魔兽世界9.1开关地图卡顿掉帧怎么办

造成卡顿的原因:
C_TaskQuest.GetQuestsForPlayerByMapID
这个api,在9.1,短时间内多次(实际上3~4次)调用就会出现卡顿
简单的测试:
做一个这样的宏:
/run print(C_TaskQuest.GetQuestsForPlayerByMapID(1961))
/run print(C_TaskQuest.GetQuestsForPlayerByMapID(1961))
/run print(C_TaskQuest.GetQuestsForPlayerByMapID(1961))
/run print(C_TaskQuest.GetQuestsForPlayerByMapID(1961))
你去连按试试,就能重现连按M开关地图的卡顿感
这个api是用于返回任务信息的,在开关地图(实际上是地图内容刷新)的时候,瞬间会多次调用的情况。

所以写段代码,给这个api加个缓冲时间,短时间内只让调用1次
代码:放入任意lua文件内
local temp = {}
local pre = C_TaskQuest.GetQuestsForPlayerByMapID
C_TaskQuest.GetQuestsForPlayerByMapID = function(mapID)
if not temp[mapID] or temp[mapID].lasttime < GetTime() then
temp[mapID] = temp[mapID] or {}
temp[mapID].result = pre(mapID)
temp[mapID].lasttime = GetTime()+1
end
return temp[mapID].result
end
宏:每次进游戏自行点击一次
简化版的宏:
/run local m,t,r;local pre = C_TaskQuest.GetQuestsForPlayerByMapID;C_TaskQuest.GetQuestsForPlayerByMapID = function(mapID)if m~=mapID or t~=time() then m=mapID t=time()r = pre(m)end return r end
宏和代码稍微有点区别,效果大概是一样的。
这应该是暴雪对这个api本身做了某些改动导致的,因为9.1之前的版本,这个api也是同时多次调用的情况,但是并不会导致卡顿

PS:因为使用的方法是替换api进行hook操作,在某些时候会出现taint现象
目前已知的,战斗中点击任务列表,会无法打开地图/任务界面(自行按M/L可以打开)
这只是小问题,实际上非常多的插件都会导致类似的问题(理论上可以通过其他方案修复,但是太麻烦了)。