Merge pull request #111 from zhaouv/v2.0-20180428

V2 0 20180428
This commit is contained in:
Zhang Chen 2018-04-29 13:32:34 +08:00 committed by GitHub
commit 669c59ff41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 141 additions and 79 deletions

File diff suppressed because one or more lines are too long

View File

@ -5,22 +5,22 @@ grammar MotaAction;
//事件 事件编辑器入口之一
event_m
: '事件' BGNL? Newline '覆盖触发器' Bool '启用' Bool '通行状态' B_List '显伤' Bool BGNL? Newline action+ BEND
: '事件' BGNL? Newline '覆盖触发器' Bool '启用' Bool '通行状态' B_0_List '显伤' Bool BGNL? Newline action+ BEND
;
/* event_m
tooltip : 编辑魔塔的事件
helpUrl : https://ckcz123.github.io/mota-js/#/event
default : [false,null,[['不改变','null'],['不可通行','true'],['可以通行','false']],null]
B_List_0=eval(B_List_0);
default : [false,null,null,null]
B_0_List_0=eval(B_0_List_0);
var code = {
'trigger': Bool_0?'action':null,
'enable': Bool_1,
'noPass': B_List_0,
'noPass': B_0_List_0,
'displayDamage': Bool_2,
'data': 'data_asdfefw'
}
if (!Bool_0 && Bool_1 && (B_List_0===null) && Bool_2) code = 'data_asdfefw';
if (!Bool_0 && Bool_1 && (B_0_List_0===null) && Bool_2) code = 'data_asdfefw';
code=JSON.stringify(code,null,2).split('"data_asdfefw"').join('[\n'+action_0+']\n');
return code;
*/
@ -39,10 +39,34 @@ return code;
//商店 事件编辑器入口之一
shop_m
: '全局商店列表' BGNL? Newline shoplist+
;
/* shop_m
tooltip : 全局商店列表
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e5%85%a8%e5%b1%80%e5%95%86%e5%ba%97
var code = '['+shoplist_0+']\n';
return code;
*/
shoplist
: shopsub
| emptyshop
;
emptyshop
: Newline
;
/* emptyshop
var code = ' \n';
return code;
*/
shopsub
: '商店 id' IdString '标题' EvalString '图标' IdString BGNL? Newline '快捷商店栏中名称' EvalString BGNL? Newline '使用' ShopUse_List '消耗' EvalString BGNL? Newline '显示文字' EvalString BGNL? Newline shopChoices+ BEND
;
/* shop_m
/* shopsub
tooltip : 全局商店,消耗填-1表示每个选项的消耗不同,正数表示消耗数值
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e5%85%a8%e5%b1%80%e5%95%86%e5%ba%97
default : ["shop1","贪婪之神","blueShop","1F金币商店",null,"20+10*times*(times+1)","勇敢的武士啊, 给我${need}金币就可以:"]
@ -56,7 +80,7 @@ var code = {
'text': EvalString_3,
'choices': 'choices_asdfefw'
}
code=JSON.stringify(code,null,2).split('"choices_asdfefw"').join('[\n'+shopChoices_0+']\n');
code=JSON.stringify(code,null,2).split('"choices_asdfefw"').join('[\n'+shopChoices_0+']\n')+',\n';
return code;
*/
@ -140,7 +164,7 @@ changeFloor_m
/* changeFloor_m
tooltip : 楼梯, 传送门, 如果目标楼层有多个楼梯, 写upFloor或downFloor可能会导致到达的楼梯不确定, 这时候请使用loc方式来指定具体的点位置
helpUrl : https://ckcz123.github.io/mota-js/#/element?id=%e8%b7%af%e9%9a%9c%ef%bc%8c%e6%a5%bc%e6%a2%af%ef%bc%8c%e4%bc%a0%e9%80%81%e9%97%a8
default : ["MT1",null,0,0,[['不变',''],['上','up'],['下','down'],['左','left'],['右','right']],500,null]
default : ["MT1",null,0,0,null,500,null]
var loc = ', "loc": ['+Number_0+', '+Number_1+']';
if (Stair_List_0!=='loc')loc = ', "stair": "'+Stair_List_0+'"';
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
@ -262,13 +286,13 @@ return code;
*/
setText_s
: '设置剧情文本的属性' '位置' SetTextPosition_List BGNL? '标题颜色' EvalString? '正文颜色' EvalString? '背景色' EvalString? BGNL? '粗体' B_List '打字间隔' EvalString? Newline
: '设置剧情文本的属性' '位置' SetTextPosition_List BGNL? '标题颜色' EvalString? '正文颜色' EvalString? '背景色' EvalString? BGNL? '粗体' B_1_List '打字间隔' EvalString? Newline
;
/* setText_s
tooltip : setText设置剧情文本的属性,颜色为RGB三元组或RGBA四元组,打字间隔为剧情文字添加的时间间隔,为整数或不填
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=settext%ef%bc%9a%e8%ae%be%e7%bd%ae%e5%89%a7%e6%83%85%e6%96%87%e6%9c%ac%e7%9a%84%e5%b1%9e%e6%80%a7
default : [[['不改变','null'],['上','up'],['中','center'],['下','down']],"","","",[['不改变','null'],['设为粗体','true'],['取消粗体','false']],'']
default : [null,"","","",null,'']
SetTextPosition_List_0 =SetTextPosition_List_0==='null'?'': ', "position": "'+SetTextPosition_List_0+'"';
var colorRe = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/;
if (EvalString_0) {
@ -287,8 +311,8 @@ if (EvalString_3) {
if (!/^\d+$/.test(EvalString_3))throw new Error('打字时间间隔必须是整数或不填');
EvalString_3 = ', "time": '+EvalString_3;
}
B_List_0 = ', "bold": '+B_List_0;
var code = '{"type": "setText"'+SetTextPosition_List_0+EvalString_0+EvalString_1+EvalString_2+B_List_0+EvalString_3+'},\n';
B_1_List_0 = ', "bold": '+B_1_List_0;
var code = '{"type": "setText"'+SetTextPosition_List_0+EvalString_0+EvalString_1+EvalString_2+B_1_List_0+EvalString_3+'},\n';
return code;
*/
@ -326,12 +350,19 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=show-%e5%b0%86%e4%b8%80%e
default : ["0","0","",500]
colour : this.eventColor
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var pattern = /^([+-]?\d+)(,[+-]?\d+)*$/;
if(!pattern.test(EvalString_0) || !pattern.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
EvalString_0=EvalString_0.split(',');
EvalString_1=EvalString_1.split(',');
if(EvalString_0.length!==EvalString_1.length)throw new Error('坐标格式错误,请右键点击帮助查看格式');
for(var ii=0;ii<EvalString_0.length;ii++)EvalString_0[ii]='['+EvalString_0[ii]+','+EvalString_1[ii]+']';
var pattern1 = /^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
EvalString_0=[EvalString_0,EvalString_1]
} else {
var pattern2 = /^([+-]?\d+)(,[+-]?\d+)*$/;
if(!pattern2.test(EvalString_0) || !pattern2.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
EvalString_0=EvalString_0.split(',');
EvalString_1=EvalString_1.split(',');
if(EvalString_0.length!==EvalString_1.length)throw new Error('坐标格式错误,请右键点击帮助查看格式');
for(var ii=0;ii<EvalString_0.length;ii++)EvalString_0[ii]='['+EvalString_0[ii]+','+EvalString_1[ii]+']';
}
Int_0 = Int_0 ?(', "time": '+Int_0):'';
var code = '{"type": "show", "loc": ['+EvalString_0.join(',')+']'+IdString_0+''+Int_0+'},\n';
return code;
@ -348,13 +379,20 @@ default : ["","","",500]
colour : this.eventColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
var pattern = /^([+-]?\d+)(,[+-]?\d+)*$/;
if(!pattern.test(EvalString_0) || !pattern.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
var pattern1 = /^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
EvalString_0=[EvalString_0,EvalString_1]
} else {
var pattern2 = /^([+-]?\d+)(,[+-]?\d+)*$/;
if(!pattern2.test(EvalString_0) || !pattern2.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
EvalString_0=EvalString_0.split(',');
EvalString_1=EvalString_1.split(',');
if(EvalString_0.length!==EvalString_1.length)throw new Error('坐标格式错误,请右键点击帮助查看格式');
for(var ii=0;ii<EvalString_0.length;ii++)EvalString_0[ii]='['+EvalString_0[ii]+','+EvalString_1[ii]+']';
floorstr = ', "loc": ['+EvalString_0.join(',')+']';
}
floorstr = ', "loc": ['+EvalString_0.join(',')+']';
}
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
Int_0 = Int_0 ?(', "time": '+Int_0):'';
@ -363,7 +401,7 @@ return code;
*/
trigger_s
: '触发事件' 'x' Int ',' 'y' Int Newline
: '触发事件' 'x' PosString ',' 'y' PosString Newline
;
/* trigger_s
@ -371,7 +409,7 @@ tooltip : trigger: 立即触发另一个地点的事件
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=trigger-%e7%ab%8b%e5%8d%b3%e8%a7%a6%e5%8f%91%e5%8f%a6%e4%b8%80%e4%b8%aa%e5%9c%b0%e7%82%b9%e7%9a%84%e4%ba%8b%e4%bb%b6
default : [0,0]
colour : this.eventColor
var code = '{"type": "trigger", "loc": ['+Int_0+','+Int_1+']},\n';
var code = '{"type": "trigger", "loc": ['+PosString_0+','+PosString_1+']},\n';
return code;
*/
@ -400,7 +438,7 @@ return code;
*/
setBlock_s
: '转变图块为' Int 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? Newline
: '转变图块为' Int 'x' PosString? ',' 'y' PosString? '楼层' IdString? Newline
;
/* setBlock_s
@ -409,8 +447,8 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=setblock%ef%bc%9a%e8%ae%b
colour : this.dataColor
default : [0,"","",""]
var floorstr = '';
if (EvalString_0 && EvalString_1) {
floorstr = ', "loc": ['+EvalString_0+','+EvalString_1+']';
if (PosString_0 && PosString_1) {
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
}
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var code = '{"type": "setBlock", "number":'+Int_0+floorstr+IdString_0+'},\n';
@ -482,7 +520,7 @@ return code;
*/
openDoor_s
: '开门' 'x' Int ',' 'y' Int '楼层' IdString? Newline
: '开门' 'x' PosString ',' 'y' PosString '楼层' IdString? Newline
;
/* openDoor_s
@ -491,36 +529,36 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=opendoor-%e5%bc%80%e9%97%
default : [0,0,""]
colour : this.dataColor
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var code = '{"type": "openDoor", "loc": ['+Int_0+','+Int_1+']'+IdString_0+'},\n';
var code = '{"type": "openDoor", "loc": ['+PosString_0+','+PosString_1+']'+IdString_0+'},\n';
return code;
*/
changeFloor_s
: '楼层切换' IdString 'x' Number ',' 'y' Number '朝向' DirectionEx_List '动画时间' Int? Newline
: '楼层切换' IdString 'x' PosString ',' 'y' PosString '朝向' DirectionEx_List '动画时间' Int? Newline
;
/* changeFloor_s
tooltip : changeFloor: 楼层切换,动画时间可不填
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=changefloor-%e6%a5%bc%e5%b1%82%e5%88%87%e6%8d%a2
default : ["MT1",0,0,[['不变',''],['上','up'],['下','down'],['左','left'],['右','right']],500]
default : ["MT1",0,0,null,500]
colour : this.dataColor
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
Int_0 = Int_0 ?(', "time": '+Int_0):'';
var code = '{"type": "changeFloor", "floorId": "'+IdString_0+'", "loc": ['+Number_0+', '+Number_1+']'+DirectionEx_List_0+Int_0+' },\n';
var code = '{"type": "changeFloor", "floorId": "'+IdString_0+'", "loc": ['+PosString_0+', '+PosString_1+']'+DirectionEx_List_0+Int_0+' },\n';
return code;
*/
changePos_0_s
: '位置切换' 'x' Number ',' 'y' Number '朝向' DirectionEx_List Newline
: '位置切换' 'x' PosString ',' 'y' PosString '朝向' DirectionEx_List Newline
;
/* changePos_0_s
tooltip : changePos: 当前位置切换
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=changepos-%e5%bd%93%e5%89%8d%e4%bd%8d%e7%bd%ae%e5%88%87%e6%8d%a2%e5%8b%87%e5%a3%ab%e8%bd%ac%e5%90%91
default : [0,0,[['不变',''],['上','up'],['下','down'],['左','left'],['右','right']]]
default : [0,0,null]
colour : this.dataColor
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
var code = '{"type": "changePos", "loc": ['+Number_0+','+Number_1+']'+DirectionEx_List_0+'},\n';
var code = '{"type": "changePos", "loc": ['+PosString_0+','+PosString_1+']'+DirectionEx_List_0+'},\n';
return code;
*/
@ -532,7 +570,7 @@ changePos_1_s
tooltip : changePos: 勇士转向
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=changepos-%e5%bd%93%e5%89%8d%e4%bd%8d%e7%bd%ae%e5%88%87%e6%8d%a2%e5%8b%87%e5%a3%ab%e8%bd%ac%e5%90%91
colour : this.dataColor
default : [[['上','up'],['下','down'],['左','left'],['右','right']]]
default : [null]
var code = '{"type": "changePos", "direction": "'+Direction_List_0+'"},\n';
return code;
*/
@ -572,7 +610,9 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=animate%ef%bc%9a%e6%98%be
default : ["zone","hero"]
colour : this.soundColor
if (EvalString_0) {
if(/hero|([+-]?\d+),([+-]?\d+)/.test(EvalString_0)) {
if(/^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-]*,flag:[0-9a-zA-Z_][0-9a-zA-Z_\-]*$/.test(EvalString_0)) {
EvalString_0=', "loc": ["'+EvalString_0.split(',').join('","')+'"]';
} else if (/hero|([+-]?\d+),([+-]?\d+)/.test(EvalString_0)) {
if(EvalString_0.indexOf(',')!==-1)EvalString_0='['+EvalString_0+']';
else EvalString_0='"'+EvalString_0+'"';
EvalString_0 = ', "loc": '+EvalString_0;
@ -585,7 +625,7 @@ return code;
*/
showImage_0_s
: '显示图片' EvalString '起点像素位置' 'x' Number 'y' Number Newline
: '显示图片' EvalString '起点像素位置' 'x' PosString 'y' PosString Newline
;
/* showImage_0_s
@ -593,7 +633,7 @@ tooltip : showImage显示图片
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=showimage%ef%bc%9a%e6%98%be%e7%a4%ba%e5%9b%be%e7%89%87
default : ["bg.jpg",0,0]
colour : this.printColor
var code = '{"type": "showImage", "name": "'+EvalString_0+'", "loc": ['+Number_0+','+Number_1+']},\n';
var code = '{"type": "showImage", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+']},\n';
return code;
*/
@ -708,12 +748,12 @@ default : [null,1]
colour : this.soundColor
if(Int_0<1 || Int_0>10) throw new Error('天气的强度等级, 在1-10之间');
var code = '{"type": "setWeather", "name": "'+Weather_List_0+'", "level": '+Int_0+'},\n';
if(Weather_List_0==='')code = '{"type": "setWeather"},\n';
if(Weather_List_0==='')code = '{"type": "setWeather"},\n';
return code;
*/
move_s
: '移动事件' 'x' EvalString? ',' 'y' EvalString? '动画时间' Int? '消失时无动画时间' Bool BGNL? StepString Newline
: '移动事件' 'x' PosString? ',' 'y' PosString? '动画时间' Int? '消失时无动画时间' Bool BGNL? StepString Newline
;
/* move_s
@ -722,8 +762,8 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=move-%e8%ae%a9%e6%9f%90%e
default : ["","",500,null,"上右3下2左上左2"]
colour : this.eventColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
floorstr = ', "loc": ['+EvalString_0+','+EvalString_1+']';
if (PosString_0 && PosString_1) {
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
}
Int_0 = Int_0 ?(', "time": '+Int_0):'';
var code = '{"type": "move"'+floorstr+''+Int_0+', "steps": '+JSON.stringify(StepString_0)+', "immediateHide": '+Bool_0+'},\n';
@ -1019,31 +1059,37 @@ RawEvalString
: 'sdeirughvuiyasdbe'+ //为了被识别为复杂词法规则
;
Stair_List
: 'loc'|'upFloor'|'downFloor'
PosString
: 'sdeirughvuiyasbde'+ //为了被识别为复杂词法规则
;
Stair_List
: '坐标'|'上楼'|'下楼'
/*Stair_List ['loc','upFloor','downFloor']*/;
SetTextPosition_List
: 'null'|'center'|'up'|'down'
;
: '不改变'|'上'|'中'|'下'
/*SetTextPosition_List ['null','up','center','down']*/;
ShopUse_List
: 'money' | 'experience'
;
: '金币' | '经验'
/*ShopUse_List ['money','experience']*/;
Arithmetic_List
: '+'|'-'|'*'|'/'|'^'|'=='|'!='|'>'|'<'|'>='|'<='|'和'|'或'
;
Weather_List
: '无'|'rain'|'snow'
;
: '无'|'雨'|'雪'
/*Weather_List ['','rain','snow']*/;
B_List
: 'null'
| 'true'
| 'false'
;
B_0_List
: '不改变'|'不可通行'|'可以通行'
/*B_0_List ['null','true','false']*/;
B_1_List
: '不改变'|'设为粗体'|'取消粗体'
/*B_1_List ['null','true','false']*/;
Bool: 'TRUE'
| 'FALSE'
@ -1060,11 +1106,11 @@ fragment EXP : [Ee] [+\-]? Int ; // \- since - means "range" inside [...]
Direction_List
: '上'|'下'|'左'|'右'
;
/*Direction_List ['up','down','left','right']*/;
DirectionEx_List
: '不变'|'上'|'下'|'左'|'右'
;
/*DirectionEx_List ['','up','down','left','right']*/;
StepString
: (Direction_List Int?)+
@ -1174,25 +1220,33 @@ ActionParser.prototype.parse = function (obj,type) {
return MotaActionBlocks['point_m'].xmlText([text_choices]);
case 'shop':
var text_choices = null;
for(var ii=obj.choices.length-1,choice;choice=obj.choices[ii];ii--) {
var text_effect = null;
var effectList = choice.effect.split(';');
for(var jj=effectList.length-1,effect;effect=effectList[jj];jj--) {
if(effect.split('+=').length!==2){
throw new Error('一个商店效果中必须包含恰好一个"+="');
var buildsub = function(obj,parser,next){
var text_choices = null;
for(var ii=obj.choices.length-1,choice;choice=obj.choices[ii];ii--) {
var text_effect = null;
var effectList = choice.effect.split(';');
for(var jj=effectList.length-1,effect;effect=effectList[jj];jj--) {
if(effect.split('+=').length!==2){
throw new Error('一个商店效果中必须包含恰好一个"+="');
}
text_effect=MotaActionBlocks['shopEffect'].xmlText([
MotaActionBlocks['idString_e'].xmlText([effect.split('+=')[0]]),
MotaActionBlocks['evalString_e'].xmlText([effect.split('+=')[1]]),
text_effect]);
}
text_effect=MotaActionBlocks['shopEffect'].xmlText([
MotaActionBlocks['idString_e'].xmlText([effect.split('+=')[0]]),
MotaActionBlocks['evalString_e'].xmlText([effect.split('+=')[1]]),
text_effect]);
text_choices=MotaActionBlocks['shopChoices'].xmlText([
choice.text,choice.need||'',text_effect,text_choices]);
}
text_choices=MotaActionBlocks['shopChoices'].xmlText([
choice.text,choice.need||'',text_effect,text_choices]);
return MotaActionBlocks['shopsub'].xmlText([
obj.id,obj.name,obj.icon,obj.textInList,obj.use,obj.need,parser.EvalString(obj.text),text_choices,next
]);
}
return MotaActionBlocks['shop_m'].xmlText([
obj.id,obj.name,obj.icon,obj.textInList,obj.use,obj.need,this.EvalString(obj.text),text_choices
]);
var next=null;
if(!obj)obj=[];
while(obj.length){
next=buildsub(obj.pop(),this,next);
}
return MotaActionBlocks['shop_m'].xmlText([next]);
default:
return MotaActionBlocks[type+'_m'].xmlText([this.parseList(obj)]);
@ -1263,7 +1317,7 @@ ActionParser.prototype.parseAction = function() {
this.parseAction();
break;
case "show": // 显示
if (typeof data.loc[0] == 'number' && typeof data.loc[1] == 'number')
if (!(data.loc[0] instanceof Array))
data.loc = [data.loc];
var x_str=[],y_str=[];
data.loc.forEach(function (t) {
@ -1275,7 +1329,7 @@ ActionParser.prototype.parseAction = function() {
break;
case "hide": // 消失
data.loc=data.loc||[];
if (typeof data.loc[0] == 'number' && typeof data.loc[1] == 'number')
if (!(data.loc[0] instanceof Array))
data.loc = [data.loc];
var x_str=[],y_str=[];
data.loc.forEach(function (t) {
@ -1528,6 +1582,12 @@ MotaActionFunctions.IdString_pre = function(IdString){
return IdString;
}
MotaActionFunctions.PosString_pre = function(PosString){
if (!PosString || /^-?\d+$/.test(PosString)) return PosString;
if (!(/^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/.test(PosString)))throw new Error(PosString+'中包含了0-9 a-z A-Z _ - :之外的字符,或者是没有以flag: 开头');
return '"'+PosString+'"';
}
MotaActionFunctions.StepString_pre = function(StepString){
//StepString='上右3下2左上左2'
var route = StepString.replace(/上/g,'U').replace(/下/g,'D').replace(/左/g,'L').replace(/右/g,'R');

View File

@ -190,7 +190,8 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
},
"shops": {
"_leaf": true,
"_type": "textarea",
"_type": "event",
"_event": "shop",
"_data": "全局商店,是一个数组 \n 每一项是一个Object代表一个全局商店 \n id 为商店的唯一标识符ID请确保任何两个商店的id都不相同 \n name 为商店的名称(打开商店后的标题) \n icon 为商店的图标在icons.js的npcs中定义。如blueShop可代表蓝色商店。 \n textInList 为其在快捷商店栏中显示的名称,如\"3楼金币商店\"等 \n use 为消耗的类型是金币money还是经验experience。 \n need 是一个表达式计算商店所需要用到的数值可以以times作为参数。 \n text 为商店所说的话。可以用${need}表示需要的数值。\n choices 为商店的各个选项是一个list每一项是一个选项里面text为显示文字effect为选项的效果只能用+=,分号分开。"
},
"levelUp": {

View File

@ -29,7 +29,7 @@ editor_blockly = function () {
{"type": "setValue", "name": "status:hp", "value": "status:hp+\${200*point}"},
]},
]},'point'),
MotaActionFunctions.actionParser.parse({
MotaActionFunctions.actionParser.parse([{
"id": "moneyShop1",
"name": "贪婪之神",
"icon": "blueShop",
@ -43,7 +43,7 @@ editor_blockly = function () {
{"text": "防御+4", "effect": "status:def+=4"},
{"text": "魔防+10", "effect": "status:mdef+=10"}
]
},'shop'),
}],'shop'),
MotaActionBlocks['afterBattle_m'].xmlText(),
MotaActionBlocks['afterGetItem_m'].xmlText(),
MotaActionBlocks['afterOpenDoor_m'].xmlText(),
@ -428,6 +428,7 @@ document.getElementById('blocklyDiv').onmousewheel = function(e){
'autoText_s': 'EvalString_2',
'choices_s': 'EvalString_0',
'function_s': 'RawEvalString_0',
'shopsub': 'EvalString_3',
}
var f = b ? textStringDict[b.type] : null;
if (f) {