From 69b52acb463672ba2299df9069134e262bfcb804 Mon Sep 17 00:00:00 2001 From: dljgs1 <906348668@qq.com> Date: Wed, 17 Apr 2019 19:54:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=9F=E9=9A=8F=E5=AF=B9=E8=AF=9D=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/ui.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libs/ui.js b/libs/ui.js index 6764fda6..0ec48f66 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)(,(hero|null|\d+,\d+))?]/g, function (s0, s1, s2, s3) { + .replace(/\\b\[(up|center|down|hero|null)(,(hero|null|\d+,\d+|\d+))?]/g, function (s0, s1, s2, s3) { pos = s1; - if (s3 == 'hero' || s1=='hero') { + if (s3 == 'hero' || s1=='hero' && !s3) { px = core.status.hero.loc.x; py = core.status.hero.loc.y; } @@ -414,8 +414,14 @@ ui.prototype._getPosition = function (content) { } else if (s3) { var str = s3.split(','); - px = parseInt(str[0]); - py = parseInt(str[1]); + if(str.length==1){ + var follower = (core.status.hero.followers||{})[parseInt(str[0])-1]||{}; + px = follower.x || null; + py = follower.y || null; + }else{ + px = parseInt(str[0]); + py = parseInt(str[1]); + } } if(pos=='hero' || pos=='null'){ pos = py==null?'center':(py>=core.__HALF_SIZE__? 'up':'down');