From 3a0c44f34c753f10f51364cf09e58695d8429e44 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Thu, 24 Oct 2019 16:30:23 +0800 Subject: [PATCH] Update shopItemChoices --- _server/MotaAction.g4 | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index ec75b0c1..06ead563 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -198,19 +198,20 @@ return code; */; shopItemChoices - : '道具商店选项' '道具名' IdString '存量' Int '买入价格' EvalString? '卖出价格' EvalString? BEND + : '道具商店选项' '道具名' IdString '存量' EvalString? '买入价格' EvalString? '卖出价格' EvalString? BEND /* shopItemChoices tooltip : 道具商店选项,每一项是道具名;买入或卖出可以不填表示只能卖出或买入 helpUrl : https://h5mota.com/games/template/_docs/#/event?id=%e5%85%a8%e5%b1%80%e5%95%86%e5%ba%97 -default : ["yellowKey","10","10",""] +default : ["yellowKey","","10",""] colour : this.subColor -EvalString_0 = EvalString_0 ? (', "money": '+(parseInt(EvalString_0) || 0)) : ''; -EvalString_1 = EvalString_1 ? (', "sell": '+(parseInt(EvalString_1) || 0)) : ''; -if (!EvalString_0 && !EvalString_1) throw "买入金额和卖出金额至少需要填写一个"; -var code = '{"id": "' + IdString_0 + '", "number": ' + Int_0 + EvalString_0 + EvalString_1 + '},\n'; +EvalString_0 = EvalString_0 ? (', "number": '+(parseInt(EvalString_0) || 0)) : ''; +EvalString_1 = EvalString_1 ? (', "money": '+(parseInt(EvalString_1) || 0)) : ''; +EvalString_2 = EvalString_2 ? (', "sell": '+(parseInt(EvalString_2) || 0)) : ''; +if (!EvalString_1 && !EvalString_2) throw "买入金额和卖出金额至少需要填写一个"; +var code = '{"id": "' + IdString_0 + EvalString_0 + EvalString_1 + EvalString_2 + '},\n'; return code; */; @@ -2881,8 +2882,8 @@ ActionParser.prototype.parse = function (obj,type) { var text_choices = null; for(var ii=obj.choices.length-1,choice;choice=obj.choices[ii];ii--) { text_choices = MotaActionBlocks['shopItemChoices'].xmlText([ - choice.id, choice.number, choice.money == null ? "" : (""+choice.money), choice.sell == null ? "" : (""+choice.sell), - text_choices + choice.id, choice.number == null ? "" : (""+choice.number), choice.money == null ? "" : (""+choice.money), + choice.sell == null ? "" : (""+choice.sell), text_choices ]); } return MotaActionBlocks['shopitem'].xmlText([