itemShop
This commit is contained in:
parent
103f2c6415
commit
fe6e331fb0
@ -86,6 +86,7 @@ return code;
|
|||||||
|
|
||||||
shoplist
|
shoplist
|
||||||
: shopsub
|
: shopsub
|
||||||
|
| shopitem
|
||||||
| shopcommonevent
|
| shopcommonevent
|
||||||
| emptyshop
|
| emptyshop
|
||||||
;
|
;
|
||||||
@ -100,7 +101,7 @@ return code;
|
|||||||
*/;
|
*/;
|
||||||
|
|
||||||
shopcommonevent
|
shopcommonevent
|
||||||
: '商店 id' IdString '快捷商店栏中名称' EvalString BGNL? '未开启状态则不显示在列表中' Bool BGNL? '执行的公共事件 id' EvalString '参数列表' EvalString?
|
: '公共事件版商店 id' IdString '快捷商店栏中名称' EvalString BGNL? '未开启状态则不显示在列表中' Bool BGNL? '执行的公共事件 id' EvalString '参数列表' EvalString?
|
||||||
|
|
||||||
/* shopcommonevent
|
/* shopcommonevent
|
||||||
tooltip : 全局商店, 执行一个公共事件
|
tooltip : 全局商店, 执行一个公共事件
|
||||||
@ -177,6 +178,40 @@ var code = idString_e_0+'+='+expression_0+';'
|
|||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
|
shopitem
|
||||||
|
: '道具商店 id' IdString '快捷商店栏中名称' EvalString BGNL? '未开启状态则不显示在列表中' Bool BGNL? Newline shopItemChoices+ BEND
|
||||||
|
|
||||||
|
|
||||||
|
/* shopitem
|
||||||
|
tooltip : 道具商店
|
||||||
|
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=%e5%85%a8%e5%b1%80%e5%95%86%e5%ba%97
|
||||||
|
default : ["itemShop","道具商店",false]
|
||||||
|
var code = {
|
||||||
|
'id': IdString_0,
|
||||||
|
'item': true,
|
||||||
|
'textInList': EvalString_0,
|
||||||
|
'mustEnable': Bool_0,
|
||||||
|
'choices': 'choices_aqwedsa'
|
||||||
|
}
|
||||||
|
code=JSON.stringify(code,null,2).split('"choices_aqwedsa"').join('[\n'+shopItemChoices_0+']\n')+',\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
|
shopItemChoices
|
||||||
|
: '道具商店选项' '道具名' IdString '存量' Int '买入价格' Int '卖出价格' 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",""]
|
||||||
|
colour : this.subColor
|
||||||
|
EvalString_0 = EvalString_0 ? (', "sell": '+(parseInt(EvalString_0) || 0)) : '';
|
||||||
|
var code = '{"id": "' + IdString_0 + '", "number": ' + Int_0 + ', "money": ' + Int_1 + EvalString_0 + '},\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
//afterBattle 事件编辑器入口之一
|
//afterBattle 事件编辑器入口之一
|
||||||
afterBattle_m
|
afterBattle_m
|
||||||
: '战斗结束后' BGNL? Newline action+ BEND
|
: '战斗结束后' BGNL? Newline action+ BEND
|
||||||
@ -2840,11 +2875,25 @@ ActionParser.prototype.parse = function (obj,type) {
|
|||||||
obj.id,parser.EvalString(obj.textInList),obj.mustEnable,parser.EvalString(obj.commonEvent),obj.args,next
|
obj.id,parser.EvalString(obj.textInList),obj.mustEnable,parser.EvalString(obj.commonEvent),obj.args,next
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
var builditem = function (obj,parser,next){
|
||||||
|
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.count, choice.money, choice.sell == null ? "" : (""+choice.sell),
|
||||||
|
text_choices
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return MotaActionBlocks['shopitem'].xmlText([
|
||||||
|
obj.id,obj.textInList,obj.mustEnable,text_choices,next
|
||||||
|
]);
|
||||||
|
}
|
||||||
var next=null;
|
var next=null;
|
||||||
if(!obj)obj=[];
|
if(!obj)obj=[];
|
||||||
while(obj.length){
|
while(obj.length){
|
||||||
var shopobj=obj.pop()
|
var shopobj=obj.pop()
|
||||||
if(shopobj.choices)
|
if(shopobj.item)
|
||||||
|
next=builditem(shopobj,this,next);
|
||||||
|
else if(shopobj.choices)
|
||||||
next=buildsub(shopobj,this,next);
|
next=buildsub(shopobj,this,next);
|
||||||
else if(shopobj.commonEvent)
|
else if(shopobj.commonEvent)
|
||||||
next=buildcommentevent(shopobj,this,next);
|
next=buildcommentevent(shopobj,this,next);
|
||||||
|
|||||||
@ -48,8 +48,13 @@ editor_blockly = function () {
|
|||||||
"choices": [
|
"choices": [
|
||||||
{"text": "生命+800", "effect": "status:hp+=800"},
|
{"text": "生命+800", "effect": "status:hp+=800"},
|
||||||
{"text": "攻击+4", "effect": "status:atk+=4"},
|
{"text": "攻击+4", "effect": "status:atk+=4"},
|
||||||
{"text": "防御+4", "effect": "status:def+=4"},
|
]
|
||||||
{"text": "魔防+10", "effect": "status:mdef+=10"}
|
},{
|
||||||
|
"id": "itemShop",
|
||||||
|
"item": true,
|
||||||
|
"textInList": "道具商店",
|
||||||
|
"choices": [
|
||||||
|
{"id": "yellowKey", "count": 10, "money": 10}
|
||||||
]
|
]
|
||||||
},{
|
},{
|
||||||
"id": "keyShop1",
|
"id": "keyShop1",
|
||||||
|
|||||||
@ -1473,8 +1473,8 @@ control.prototype._replayAction_shop = function (action) {
|
|||||||
if (selections.length == 0) return false;
|
if (selections.length == 0) return false;
|
||||||
var shop=core.status.shops[shopId];
|
var shop=core.status.shops[shopId];
|
||||||
if (!shop || !shop.visited) return false;
|
if (!shop || !shop.visited) return false;
|
||||||
// --- 判定commonEvent
|
// --- 判定commonEvent或item
|
||||||
if (shop.commonEvent) {
|
if (shop.commonEvent || shop.item) {
|
||||||
core.openShop(shopId, false);
|
core.openShop(shopId, false);
|
||||||
setTimeout(core.replay);
|
setTimeout(core.replay);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -2469,7 +2469,7 @@ events.prototype.openShop = function (shopId, needVisited) {
|
|||||||
shop.times = shop.times || 0;
|
shop.times = shop.times || 0;
|
||||||
if (shop.commonTimes) shop.times = core.getFlag('commonTimes', 0);
|
if (shop.commonTimes) shop.times = core.getFlag('commonTimes', 0);
|
||||||
if (needVisited && !shop.visited) {
|
if (needVisited && !shop.visited) {
|
||||||
if (!core.flags.enableDisabledShop || shop.commonEvent) {
|
if (!core.flags.enableDisabledShop || shop.commonEvent || shop.item) {
|
||||||
if (shop.times == 0) core.drawTip("该项尚未开启");
|
if (shop.times == 0) core.drawTip("该项尚未开启");
|
||||||
else core.drawTip("该项已失效");
|
else core.drawTip("该项已失效");
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
@ -2481,8 +2481,11 @@ events.prototype.openShop = function (shopId, needVisited) {
|
|||||||
}
|
}
|
||||||
else shop.visited = true;
|
else shop.visited = true;
|
||||||
|
|
||||||
// --- 商店
|
if (shop.item) {
|
||||||
if (shop.commonEvent) {
|
core.status.route.push("shop:" + shopId + ":0");
|
||||||
|
core.insertAction({"type": "insert", "name": "道具商店", "args": [shopId]});
|
||||||
|
return;
|
||||||
|
} else if (shop.commonEvent) {
|
||||||
core.status.route.push("shop:"+shopId+":0");
|
core.status.route.push("shop:"+shopId+":0");
|
||||||
core.insertAction({"type": "insert", "name": shop.commonEvent, "args": shop.args});
|
core.insertAction({"type": "insert", "name": shop.commonEvent, "args": shop.args});
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -266,18 +266,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
{
|
{
|
||||||
"text": "生命+800",
|
"text": "生命+800",
|
||||||
"effect": "status:hp+=800"
|
"effect": "status:hp+=800"
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "攻击+4",
|
|
||||||
"effect": "status:atk+=4"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "防御+4",
|
|
||||||
"effect": "status:def+=4"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "魔防+10",
|
|
||||||
"effect": "status:mdef+=10"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -295,17 +283,20 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
{
|
{
|
||||||
"text": "等级+1",
|
"text": "等级+1",
|
||||||
"need": "100",
|
"need": "100",
|
||||||
"effect": "status:lv+=1;status:hp+=1000;status:atk+=7;status:def+=7"
|
"effect": "status:hp+=1000"
|
||||||
},
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "itemShop",
|
||||||
|
"item": true,
|
||||||
|
"textInList": "道具商店",
|
||||||
|
"mustEnable": false,
|
||||||
|
"choices": [
|
||||||
{
|
{
|
||||||
"text": "攻击+5",
|
"id": "yellowKey",
|
||||||
"need": "30",
|
"number": 10,
|
||||||
"effect": "status:atk+=5"
|
"money": 10
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "防御+5",
|
|
||||||
"need": "30",
|
|
||||||
"effect": "status:def+=5"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user