Cartographer map always resets to current map
Schaka opened this issue ยท 3 comments
Also another bug I noticed, once you switch the map in cartographer, every 250ms it will switch it back automatically to the map you are currently on
Thank you for this. If you submit a pull request, I will merge it into master. Unfortunately I can't test anything myself currently, as I'm at work.
This is done in the function function Questie:getPlayerPos()
A "bugfix" is commented but what does it fix?
Fixed it myself, maybe you have another way to do it.
Questie.lua : function Questie:OnUpdate(elapsed)
Replace : Questie.player_x, Questie.player_y = Questie:getPlayerPos();
With:
--Fix by logon
local fx, fy = Questie:getPlayerPos();
if ( ( ( fx ) and ( fx == 0 ) ) and ( ( fy ) and ( fy == 0 ) ) ) then
--DEFAULT_CHAT_FRAME:AddMessage("Questie: Cords equal to 0 using old until data is sane ", 0.95, 0.95, 0.5);
--DEFAULT_CHAT_FRAME:AddMessage(fx.." "..fy, 0.95, 0.95, 0.5);
--DEFAULT_CHAT_FRAME:AddMessage(Questie.player_x.." "..Questie.player_y, 0.95, 0.95, 0.5);
else
Questie.player_x = fx;
Questie.player_y = fy;
end
and
Questie.lua : function Questie:OnUpdate(elapsed)
Replace: function Questie:getPlayerPos()
With
--Fix by logon
function Questie:getPlayerPos()
-- thanks to mapnotes for this "bug fix"
local fx, fy = GetPlayerMapPosition("player");
local map = getCurrentMapID();
if ( ( ( fx ) and ( fx == 0 ) ) and ( ( fy ) and ( fy == 0 ) ) ) then
if (map == -1) then
SetMapToCurrentZone();
DEFAULT_CHAT_FRAME:AddMessage("Questie: Found strange zone MapID: "..map.." reset to currentZone", 0.95, 0.95, 0.5);
end
end
-- thanks mapnotes
return fx, fy;
end
As you can see I use the old sane Player values if the player has the map opened on another zone, and will continue to update as soon as he switches back or closes the map.
The reset zone i switched to only force a reset if the mapID is -1 (Aka strange / null / don't exist)
Im going to run with it some more and see if it works 100%