This commit is contained in:
ckcz123 2019-10-28 10:57:25 +08:00
parent 488b3c2eb1
commit 3e38036561
2 changed files with 10 additions and 6 deletions

View File

@ -198,21 +198,22 @@ return code;
*/;
shopItemChoices
: '道具商店选项' '道具名' IdString '存量' EvalString? '买入价格' EvalString? '卖出价格' EvalString? BEND
: '道具名' IdString '存量' EvalString? '买入价格' 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",""]
default : ["yellowKey","","10","",""]
colour : this.subColor
if (EvalString_0 && !/^\d+$/.test(EvalString_0)) throw "存量必须不填或非负整数";
EvalString_0 = EvalString_0 ? (', "number": '+EvalString_0) : '';
EvalString_1 = EvalString_1 ? (', "money": "'+EvalString_1+'"') : '';
EvalString_2 = EvalString_2 ? (', "sell": "'+EvalString_2+'"') : '';
EvalString_1 = EvalString_1 ? (', "money": "'+EvalString_1+'"') : '';
EvalString_2 = EvalString_2 ? (', "sell": "'+EvalString_2+'"') : '';
if (!EvalString_1 && !EvalString_2) throw "买入金额和卖出金额至少需要填写一个";
var code = '{"id": "' + IdString_0 + '"' + EvalString_0 + EvalString_1 + EvalString_2 + '},\n';
EvalString_3 = EvalString_3 ? (', "condition": "'+EvalString_3+'"') : '';
var code = '{"id": "' + IdString_0 + '"' + EvalString_0 + EvalString_1 + EvalString_2 + EvalString_3 + '},\n';
return code;
*/;
@ -2884,7 +2885,7 @@ ActionParser.prototype.parse = function (obj,type) {
for(var ii=obj.choices.length-1,choice;choice=obj.choices[ii];ii--) {
text_choices = MotaActionBlocks['shopItemChoices'].xmlText([
choice.id, choice.number == null ? "" : (""+choice.number), choice.money == null ? "" : (""+choice.money),
choice.sell == null ? "" : (""+choice.sell), text_choices
choice.sell == null ? "" : (""+choice.sell), choice.condition || "", text_choices
]);
}
return MotaActionBlocks['shopitem'].xmlText([

View File

@ -138,6 +138,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
// Step 2获得列表并展示
var choices = core.status.shops[shopId].choices;
list = choices.filter(function (one) {
if (one.condition != null) {
try { if (!core.calValue(one.condition)) return false; } catch (e) {}
}
return (type == 0 && one.money != null) || (type == 1 && one.sell != null);
});
var per_page = 6;