diff --git a/libs/ui.js b/libs/ui.js index 5425c2ad..6764fda6 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -403,9 +403,9 @@ ui.prototype._getPosition = function (content) { py = core.status.event.data.y; } content = content.replace("\b", "\\b") - .replace(/\\b\[(up|center|down)(,(hero|null|\d+,\d+))?]/g, function (s0, s1, s2, s3) { + .replace(/\\b\[(up|center|down|hero|null)(,(hero|null|\d+,\d+))?]/g, function (s0, s1, s2, s3) { pos = s1; - if (s3 == 'hero') { + if (s3 == 'hero' || s1=='hero') { px = core.status.hero.loc.x; py = core.status.hero.loc.y; } @@ -417,6 +417,9 @@ ui.prototype._getPosition = function (content) { px = parseInt(str[0]); py = parseInt(str[1]); } + if(pos=='hero' || pos=='null'){ + pos = py==null?'center':(py>=core.__HALF_SIZE__? 'up':'down'); + } return ""; }); return {content: content, position: pos, px: px, py: py};