QuickShop common times

This commit is contained in:
ckcz123 2018-10-30 14:39:15 +08:00
parent b0b6c0be99
commit ca1c5a00ec
3 changed files with 8 additions and 3 deletions

View File

@ -63,18 +63,19 @@ return code;
*/;
shopsub
: '商店 id' IdString '标题' EvalString '图标' IdString BGNL? Newline '快捷商店栏中名称' EvalString BGNL? Newline '使用' ShopUse_List '消耗' EvalString BGNL? Newline '显示文字' EvalString BGNL? Newline shopChoices+ BEND
: '商店 id' IdString '标题' EvalString '图标' IdString BGNL? Newline '快捷商店栏中名称' EvalString '共用times' Bool BGNL? Newline '使用' ShopUse_List '消耗' EvalString BGNL? Newline '显示文字' EvalString BGNL? Newline shopChoices+ BEND
/* 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}金币就可以:"]
default : ["shop1","贪婪之神","blueShop","1F金币商店",false,null,"20+10*times*(times+1)","勇敢的武士啊, 给我${need}金币就可以:"]
var code = {
'id': IdString_0,
'name': EvalString_0,
'icon': IdString_1,
'textInList': EvalString_1,
'commonTimes': Bool_0,
'use': ShopUse_List_0,
'need': EvalString_2,
'text': EvalString_3,
@ -1638,7 +1639,7 @@ ActionParser.prototype.parse = function (obj,type) {
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
obj.id,obj.name,obj.icon,obj.textInList,obj.commonTimes,obj.use,obj.need,parser.EvalString(obj.text),text_choices,next
]);
}
var next=null;

View File

@ -1056,6 +1056,8 @@ actions.prototype.clickShop = function(x,y) {
});
core.updateStatusBar();
shop.times++;
if (shop.commonTimes)
core.setFlag('commonTimes', shop.times);
core.events.openShop(core.status.event.data.id);
}
// 离开

View File

@ -1532,6 +1532,8 @@ events.prototype.vibrate = function(time, callback) {
events.prototype.openShop = function(shopId, needVisited) {
var shop = core.status.shops[shopId];
shop.times = shop.times || 0;
if (shop.commonTimes)
shop.times = core.getFlag('commonTimes', 0);
shop.visited = shop.visited || false;
if (needVisited && !shop.visited) {
if (shop.times==0) core.drawTip("该商店尚未开启");