修复全局商店不受canUseQuickShop影响的问题

This commit is contained in:
ckcz123 2020-05-09 13:55:55 +08:00
parent 44b73acfa0
commit f1093c3cfd
5 changed files with 17 additions and 20 deletions

View File

@ -1 +1 @@
{"lastUsed":[],"foldPerCol":50,"folded":false,"editorLastFloorId":"sample0","disableBlocklyReplace":false,"shortcut":{"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0}}
{"lastUsed":[],"foldPerCol":50,"folded":false,"editorLastFloorId":"sample1","disableBlocklyReplace":false,"shortcut":{"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0}}

View File

@ -1335,11 +1335,6 @@ actions.prototype._clickQuickShop = function (x, y) {
if (x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
var topIndex = this.HSIZE - parseInt(keys.length / 2) + (core.status.event.ui.offset || 0);
if (y >= topIndex && y < topIndex + keys.length) {
var reason = core.events.canUseQuickShop(keys[y - topIndex]);
if (!core.flags.enableDisabledShop && reason) {
core.drawText(reason);
return;
}
core.events.openShop(keys[y - topIndex], true);
if (core.status.event.id == 'shop')
core.status.event.data.fromList = true;

View File

@ -2366,11 +2366,6 @@ events.prototype.openQuickShop = function (fromUserAction) {
if (Object.keys(core.status.shops).length == 1) {
var shopId = Object.keys(core.status.shops)[0];
if (core.status.event.id != null || !this._checkStatus('shop', false)) return;
var reason = core.events.canUseQuickShop(shopId);
if (!core.flags.enableDisabledShop && reason) {
core.drawText(reason);
return;
}
core.events.openShop(shopId, true);
return;
}
@ -2881,6 +2876,9 @@ 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);
var reason = core.events.canUseQuickShop(shop.id);
if (reason != null) return core.drawTip(reason);
if (needVisited && !shop.visited) {
if (!core.flags.enableDisabledShop || shop.commonEvent || shop.item) {
if (shop.times == 0) core.drawTip("该项尚未开启");
@ -2911,10 +2909,8 @@ events.prototype.openShop = function (shopId, needVisited) {
}
events.prototype._useShop = function (shop, index) {
var reason = core.events.canUseQuickShop(shop.id);
if (!reason && !shop.visited) reason = shop.times ? "该商店已失效" : "该商店尚未开启";
if (reason) {
core.drawTip(reason);
if (!shop.visited) {
core.drawTip(shop.times ? "该商店已失效" : "该商店尚未开启");
return false;
}
var use = shop.use, choice = shop.choices[index];

View File

@ -346,7 +346,7 @@ main.floors.sample1=
"name": "flag:man_times",
"value": "flag:man_times+1"
},
"\t[老人,man]在文字中使用${' ${ '}和 } 可以计算并显示一个表达式的结果。\n",
"\t[老人,man]在文字中使用$+{}可以计算并显示一个表达式的结果。\n",
"\t[老人,man]例如:\n你的当前攻击力是${status:atk},防御力是${status:def}。\n攻防和的十倍是${10*(status:atk+status:def)},攻防之积是${status:atk*status:def}。\n你有${item:yellowKey}把黄钥匙,${item:blueKey}把蓝钥匙,${item:redKey}把红钥匙。\n你有${item:pickaxe}个破,${item:bomb}个炸,${item:centerFly}个飞。\n这是你第${flag:man_times}次和我对话。",
"\t[老人,man]同时,你也可以通过{\"type\": \"setValue\"}来设置一个勇士的属性、道具或某个Flag。",
"\t[老人,man]例如:\n现在我将让你的攻防提升50%,再将攻防和的十倍加到生命值上。",

View File

@ -138,7 +138,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
if (selectItem != null) {
core.setTextAlign('uievent', 'center');
core.fillText("uievent", type == 0 ? "买入个数" : "卖出个数", 364, 320, null, bigFont);
core.fillText("uievent", "◀ " + selectCount + " ▶", 364, 350);
core.fillText("uievent", "< " + selectCount + " >", 364, 350);
core.fillText("uievent", "确定", 364, 380);
}
@ -319,7 +319,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
if (px >= 222 && px <= 282 && py >= 71 && py <= 102) // 离开
return core.insertAction({ "type": "break" });
// ◀,▶
// < >
if (px >= 318 && px <= 341 && py >= 348 && py <= 376)
return _add(item, -1);
if (px >= 388 && px <= 416 && py >= 348 && py <= 376)
@ -330,11 +330,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
// 上一页/下一页
if (px >= 45 && px <= 105 && py >= 388) {
if (page > 1) selectItem -= 6;
if (page > 1) {
selectItem -= 6;
selectCount = 0;
}
return;
}
if (px >= 208 && px <= 268 && py >= 388) {
if (page < totalPage) selectItem = Math.min(selectItem + 6, list.length - 1);
if (page < totalPage) {
selectItem = Math.min(selectItem + 6, list.length - 1);
selectCount = 0;
}
return;
}