diff --git a/libs/utils.js b/libs/utils.js index a8751ef4..dd3f491a 100644 --- a/libs/utils.js +++ b/libs/utils.js @@ -405,6 +405,11 @@ utils.prototype.encodeRoute = function (route) { var ans=""; var lastMove = "", cnt=0; + var id2number = function (id) { + var number = core.maps.getNumberById(id); + return number==0?id:number; + } + route.forEach(function (t) { if (t=='up' || t=='down' || t=='left' || t=='right') { if (t!=lastMove && cnt>0) { @@ -422,11 +427,11 @@ utils.prototype.encodeRoute = function (route) { cnt=0; } if (t.indexOf('item:')==0) - ans+="I"+t.substring(5)+":"; + ans+="I"+id2number(t.substring(5))+":"; else if (t.indexOf('unEquip:')==0) ans+="u"+t.substring(8); else if (t.indexOf('equip:')==0) - ans+="e"+t.substring(6)+":"; + ans+="e"+id2number(t.substring(6))+":"; else if (t.indexOf('fly:')==0) ans+="F"+t.substring(4)+":"; else if (t.indexOf('choices:')==0) @@ -490,15 +495,23 @@ utils.prototype.decodeRoute = function (route) { "R": "right" } + var number2id = function (nxt) { + if (/^\d+$/.test(nxt)) { + var info = core.maps.blocksInfo[nxt]; + if (core.isset(info)) return info.id; + } + return nxt; + } + while (index