remake difficuity choosing, fix some numerical mistake, fix scroll, etc
@ -1 +1 @@
|
||||
{"viewportLoc":[0,0],"editorLastFloorId":"U2"}
|
||||
{"viewportLoc":[0,0],"editorLastFloorId":"QISHI"}
|
@ -1095,16 +1095,16 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"operator": "-=",
|
||||
"value": "flag:mdefShop"
|
||||
},
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "flag:mdefShop",
|
||||
"value": "flag:mdefShop+1"
|
||||
},
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "status:mdef",
|
||||
"operator": "+=",
|
||||
"value": "flag:mdefShop"
|
||||
},
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "flag:mdefShop",
|
||||
"value": "flag:mdefShop+1"
|
||||
}
|
||||
],
|
||||
"false": [
|
||||
|
@ -791,6 +791,17 @@ main.floors.MT0=
|
||||
"type": "if",
|
||||
"condition": "(flag:hard==2)",
|
||||
"true": [
|
||||
{
|
||||
"type": "if",
|
||||
"condition": "(flag:mdefShop<5)",
|
||||
"true": [
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "flag:mdefShop",
|
||||
"value": "5"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "openShop",
|
||||
"id": "mdefShop",
|
||||
|
@ -10,7 +10,7 @@ main.floors.nandu=
|
||||
{
|
||||
"name": "nanduxuanze.jpg",
|
||||
"canvas": "bg",
|
||||
"x": 0,
|
||||
"x": -80,
|
||||
"y": 0
|
||||
}
|
||||
],
|
||||
@ -129,7 +129,7 @@ main.floors.nandu=
|
||||
"code": 6,
|
||||
"image": "0easy.png",
|
||||
"loc": [
|
||||
0,
|
||||
-160,
|
||||
0
|
||||
],
|
||||
"opacity": 1,
|
||||
@ -385,7 +385,7 @@ main.floors.nandu=
|
||||
"code": 6,
|
||||
"image": "0easy.png",
|
||||
"loc": [
|
||||
0,
|
||||
-160,
|
||||
0
|
||||
],
|
||||
"opacity": 1,
|
||||
@ -426,7 +426,7 @@ main.floors.nandu=
|
||||
"code": 6,
|
||||
"image": "0normal.png",
|
||||
"loc": [
|
||||
0,
|
||||
-160,
|
||||
0
|
||||
],
|
||||
"opacity": 1,
|
||||
@ -467,8 +467,8 @@ main.floors.nandu=
|
||||
"code": 6,
|
||||
"image": "0hard.png",
|
||||
"loc": [
|
||||
20,
|
||||
10
|
||||
-160,
|
||||
0
|
||||
],
|
||||
"opacity": 1,
|
||||
"time": 0
|
||||
@ -508,7 +508,7 @@ main.floors.nandu=
|
||||
"code": 6,
|
||||
"image": "0hell.png",
|
||||
"loc": [
|
||||
0,
|
||||
-160,
|
||||
0
|
||||
],
|
||||
"opacity": 1,
|
||||
@ -549,7 +549,7 @@ main.floors.nandu=
|
||||
"code": 6,
|
||||
"image": "0cheating.png",
|
||||
"loc": [
|
||||
0,
|
||||
-160,
|
||||
0
|
||||
],
|
||||
"opacity": 1,
|
||||
|
@ -307,6 +307,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
core.removeFlag("__guards__" + x + "_" + y);
|
||||
}
|
||||
|
||||
core.status.hero.mdef += [20, 3, 2, 1, 0, 20][core.getFlag('hard', 0)];
|
||||
// 获得金币
|
||||
var money = guards.reduce(function (curr, g) {
|
||||
return curr + core.material.enemys[g[2]].money;
|
||||
@ -1594,7 +1595,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
},
|
||||
"drawStatusBar": function () {
|
||||
core.dom.caidan1Ctx.drawImage(core.material.images.images['caidan.png'],0,0)
|
||||
core.drawImage('caidan','caidan.png',-161,0)
|
||||
if (core.status.floorId == 'nandu') core.clearMap('caidan');
|
||||
else core.drawImage('caidan','caidan.png',-161,0);
|
||||
var ctx, fill = function (text, x, y, style) {
|
||||
core.ui.setFont(ctx, /*(/\w+/.test(text) ? 'italic ' : '') + */'18px fzchyjw');
|
||||
core.ui.fillText(ctx, text, x, y, style);
|
||||
@ -1634,9 +1636,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
fill(core.formatBigNumber(core.getRealStatus('def')), 108, 82 + 35 + 36, '#000000');
|
||||
//core.drawImage(ctx, core.statusBar.icons.mdef, 6, 145, 25, 25);
|
||||
//core.drawImage(ctx, core.statusBar.icons.money, 6, 179, 25, 25);
|
||||
fill(core.formatBigNumber(core.status.hero.money), 108, 82 + 35 + 36 + 33, '#000000');
|
||||
fill(core.formatBigNumber(core.status.hero.exp), 108, 82 + 35 + 36 + 33, '#000000');
|
||||
//core.drawImage(ctx, core.statusBar.icons.exp, 6, 213, 25, 25);
|
||||
fill(core.formatBigNumber(core.status.hero.exp), 108, 82 + 35 + 36 + 33 + 33, '#000000');
|
||||
fill(core.formatBigNumber(core.status.hero.money), 108, 82 + 35 + 36 + 33 + 33, '#000000');
|
||||
fill(core.getFlag("juqing", 0), 108, 82 + 35 + 36 + 33 + 33 + 32, '#FF0000');
|
||||
ctx.textAlign = 'left';
|
||||
if (flags.hard - 4) fill1(core.formatBigNumber(core.getRealStatus('mdef')), 76, 166, '#FF1495');
|
||||
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 131 KiB |
@ -117,6 +117,31 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
core.dom.statusCanvas.style.display = core.flags.statusCanvas && !obj.extendToolbar ? "block" : "none";
|
||||
}
|
||||
core.registerResize("statusBar", core.control._resize_statusBar);
|
||||
core.maps._drawThumbnail_realDrawTempCanvas = function (floorId, blocks, options) {
|
||||
// 缩略图:背景
|
||||
this.drawBg(floorId, options);
|
||||
// 缩略图:事件
|
||||
this.drawEvents(floorId, blocks, options);
|
||||
// 缩略图:勇士
|
||||
if (options.heroLoc) {
|
||||
options.heroIcon = options.heroIcon || core.status.hero.image || 'hero.png';
|
||||
options.heroIcon = core.getMappedName(options.heroIcon);
|
||||
var icon = core.material.icons.hero[options.heroLoc.direction];
|
||||
var height = core.material.images.images[options.heroIcon].height / 4;
|
||||
var width = (core.material.images.images[options.heroIcon].width || 128) / 4;
|
||||
core.drawImage(options.ctx, core.material.images.images[options.heroIcon], icon.stop * width, icon.loc * height, width, height,
|
||||
32 * options.heroLoc.x + 32 - width, 32 * options.heroLoc.y + 32 - height, width, height);
|
||||
}
|
||||
// 缩略图:卷轴
|
||||
if (floorId != 'nandu') core.drawImage(options.ctx, 'caidan.png', -161, 0);
|
||||
// 缩略图:前景
|
||||
this.drawFg(floorId, options);
|
||||
// 缩略图:显伤
|
||||
if (options.damage && core.hasItem('book')) {
|
||||
core.updateCheckBlock(floorId);
|
||||
core.control.updateDamage(floorId, options.ctx);
|
||||
}
|
||||
}
|
||||
},
|
||||
"drawLight": function () {
|
||||
|
||||
@ -616,295 +641,295 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
}
|
||||
},
|
||||
"itemShop": function () {
|
||||
// 道具商店相关的插件
|
||||
// 可在全塔属性-全局商店中使用「道具商店」事件块进行编辑(如果找不到可以在入口方块中找)
|
||||
// 道具商店相关的插件
|
||||
// 可在全塔属性-全局商店中使用「道具商店」事件块进行编辑(如果找不到可以在入口方块中找)
|
||||
|
||||
var shopId = null; // 当前商店ID
|
||||
var type = 0; // 当前正在选中的类型,0买入1卖出
|
||||
var selectItem = 0; // 当前正在选中的道具
|
||||
var selectCount = 0; // 当前已经选中的数量
|
||||
var page = 0;
|
||||
var totalPage = 0;
|
||||
var totalMoney = 0;
|
||||
var list = [];
|
||||
var shopInfo = null; // 商店信息
|
||||
var choices = []; // 商店选项
|
||||
var use = 'money';
|
||||
var useText = '金币';
|
||||
var shopId = null; // 当前商店ID
|
||||
var type = 0; // 当前正在选中的类型,0买入1卖出
|
||||
var selectItem = 0; // 当前正在选中的道具
|
||||
var selectCount = 0; // 当前已经选中的数量
|
||||
var page = 0;
|
||||
var totalPage = 0;
|
||||
var totalMoney = 0;
|
||||
var list = [];
|
||||
var shopInfo = null; // 商店信息
|
||||
var choices = []; // 商店选项
|
||||
var use = 'money';
|
||||
var useText = '金币';
|
||||
|
||||
var bigFont = core.ui._buildFont(20, false),
|
||||
middleFont = core.ui._buildFont(18, false);
|
||||
var bigFont = core.ui._buildFont(20, false),
|
||||
middleFont = core.ui._buildFont(18, false);
|
||||
|
||||
this._drawItemShop = function () {
|
||||
// 绘制道具商店
|
||||
this._drawItemShop = function () {
|
||||
// 绘制道具商店
|
||||
|
||||
// Step 1: 背景和固定的几个文字
|
||||
core.ui._createUIEvent();
|
||||
core.clearMap('uievent');
|
||||
core.ui.clearUIEventSelector();
|
||||
// Step 1: 背景和固定的几个文字
|
||||
core.ui._createUIEvent();
|
||||
core.clearMap('uievent');
|
||||
core.ui.clearUIEventSelector();
|
||||
core.setTextAlign('uievent', 'left');
|
||||
core.setTextBaseline('uievent', 'top');
|
||||
core.fillRect('uievent', 0, 0, 480, 480, 'black');
|
||||
core.drawWindowSkin('winskin.png', 'uievent', 0, 0, 480, 64);
|
||||
core.drawWindowSkin('winskin.png', 'uievent', 0, 64, 360, 64);
|
||||
core.drawWindowSkin('winskin.png', 'uievent', 0, 128, 360, 352);
|
||||
core.drawWindowSkin('winskin.png', 'uievent', 360, 64, 120, 64);
|
||||
core.drawWindowSkin('winskin.png', 'uievent', 360, 128, 120, 352);
|
||||
core.setFillStyle('uievent', 'white');
|
||||
core.setStrokeStyle('uievent', 'white');
|
||||
core.fillText("uievent", "购买", 32, 84, 'white', bigFont);
|
||||
core.fillText("uievent", "卖出", 152, 84);
|
||||
core.fillText("uievent", "离开", 272, 84);
|
||||
core.fillText("uievent", "当前" + useText, 374, 75, null, middleFont);
|
||||
core.setTextAlign("uievent", "right");
|
||||
core.fillText("uievent", core.formatBigNumber(core.status.hero.money), 466, 100);
|
||||
core.setTextAlign("uievent", "left");
|
||||
core.ui.drawUIEventSelector(1, "winskin.png", 22 + 120 * type, 76, 60, 33);
|
||||
if (selectItem != null) {
|
||||
core.setTextAlign('uievent', 'center');
|
||||
core.fillText("uievent", type == 0 ? "买入个数" : "卖出个数", 420, 360, null, bigFont);
|
||||
core.fillText("uievent", "< " + selectCount + " >", 420, 390);
|
||||
core.fillText("uievent", "确定", 420, 420);
|
||||
}
|
||||
|
||||
// Step 2:获得列表并展示
|
||||
list = choices.filter(function (one) {
|
||||
if (one.condition != null && one.condition != '') {
|
||||
try { if (!core.calValue(one.condition)) return false; } catch (e) {}
|
||||
}
|
||||
return (type == 0 && one.money != null) || (type == 1 && one.sell != null);
|
||||
});
|
||||
var per_page = 7;
|
||||
totalPage = Math.ceil(list.length / per_page);
|
||||
page = Math.floor((selectItem || 0) / per_page) + 1;
|
||||
|
||||
// 绘制分页
|
||||
if (totalPage > 1) {
|
||||
var half = 180;
|
||||
core.setTextAlign('uievent', 'center');
|
||||
core.fillText('uievent', page + " / " + totalPage, half, 450, null, middleFont);
|
||||
if (page > 1) core.fillText('uievent', '上一页', half - 80, 450);
|
||||
if (page < totalPage) core.fillText('uievent', '下一页', half + 80, 450);
|
||||
}
|
||||
core.setTextAlign('uievent', 'left');
|
||||
|
||||
// 绘制每一项
|
||||
var start = (page - 1) * per_page;
|
||||
for (var i = 0; i < per_page; ++i) {
|
||||
var curr = start + i;
|
||||
if (curr >= list.length) break;
|
||||
var item = list[curr];
|
||||
core.drawIcon('uievent', item.id, 10, 141 + i * 40);
|
||||
core.setTextAlign('uievent', 'left');
|
||||
core.setTextBaseline('uievent', 'top');
|
||||
core.fillRect('uievent', 0, 0, 416, 416, 'black');
|
||||
core.drawWindowSkin('winskin.png', 'uievent', 0, 0, 416, 56);
|
||||
core.drawWindowSkin('winskin.png', 'uievent', 0, 56, 312, 56);
|
||||
core.drawWindowSkin('winskin.png', 'uievent', 0, 112, 312, 304);
|
||||
core.drawWindowSkin('winskin.png', 'uievent', 312, 56, 104, 56);
|
||||
core.drawWindowSkin('winskin.png', 'uievent', 312, 112, 104, 304);
|
||||
core.setFillStyle('uievent', 'white');
|
||||
core.setStrokeStyle('uievent', 'white');
|
||||
core.fillText("uievent", "购买", 32, 74, 'white', bigFont);
|
||||
core.fillText("uievent", "卖出", 132, 74);
|
||||
core.fillText("uievent", "离开", 232, 74);
|
||||
core.fillText("uievent", "当前" + useText, 324, 66, null, middleFont);
|
||||
core.setTextAlign("uievent", "right");
|
||||
core.fillText("uievent", core.formatBigNumber(core.status.hero[use]), 405, 89);
|
||||
core.fillText('uievent', core.material.items[item.id].name, 50, 148 + i * 40, null, bigFont);
|
||||
core.setTextAlign('uievent', 'right');
|
||||
core.fillText('uievent', (type == 0 ? core.calValue(item.money) : core.calValue(item.sell)) + useText + "/个", 340, 149 + i * 40, null, middleFont);
|
||||
core.setTextAlign("uievent", "left");
|
||||
core.ui.drawUIEventSelector(1, "winskin.png", 22 + 100 * type, 66, 60, 33);
|
||||
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", "确定", 364, 380);
|
||||
}
|
||||
|
||||
// Step 2:获得列表并展示
|
||||
list = choices.filter(function (one) {
|
||||
if (one.condition != null && one.condition != '') {
|
||||
try { if (!core.calValue(one.condition)) return false; } catch (e) { }
|
||||
if (curr == selectItem) {
|
||||
// 绘制描述,文字自动放缩
|
||||
var text = core.material.items[item.id].text || "该道具暂无描述";
|
||||
try { text = core.replaceText(text); } catch (e) {}
|
||||
for (var fontSize = 20; fontSize >= 8; fontSize -= 2) {
|
||||
var config = { left: 10, fontSize: fontSize, maxWidth: 467 };
|
||||
var height = core.getTextContentHeight(text, config);
|
||||
if (height <= 60) {
|
||||
config.top = (64 - height) / 2;
|
||||
core.drawTextContent("uievent", text, config);
|
||||
break;
|
||||
}
|
||||
}
|
||||
core.ui.drawUIEventSelector(2, "winskin.png", 8, 137 + i * 40, 343, 40);
|
||||
if (type == 0 && item.number != null) {
|
||||
core.fillText("uievent", "存货", 370, 152, null, bigFont);
|
||||
core.setTextAlign("uievent", "right");
|
||||
core.fillText("uievent", item.number, 470, 152, null, null, 60);
|
||||
} else if (type == 1) {
|
||||
core.fillText("uievent", "数量", 370, 152, null, bigFont);
|
||||
core.setTextAlign("uievent", "right");
|
||||
core.fillText("uievent", core.itemCount(item.id), 470, 152, null, null, 40);
|
||||
}
|
||||
return (type == 0 && one.money != null) || (type == 1 && one.sell != null);
|
||||
});
|
||||
var per_page = 6;
|
||||
totalPage = Math.ceil(list.length / per_page);
|
||||
page = Math.floor((selectItem || 0) / per_page) + 1;
|
||||
|
||||
// 绘制分页
|
||||
if (totalPage > 1) {
|
||||
var half = 156;
|
||||
core.setTextAlign('uievent', 'center');
|
||||
core.fillText('uievent', page + " / " + totalPage, half, 388, null, middleFont);
|
||||
if (page > 1) core.fillText('uievent', '上一页', half - 80, 388);
|
||||
if (page < totalPage) core.fillText('uievent', '下一页', half + 80, 388);
|
||||
}
|
||||
core.setTextAlign('uievent', 'left');
|
||||
|
||||
// 绘制每一项
|
||||
var start = (page - 1) * per_page;
|
||||
for (var i = 0; i < per_page; ++i) {
|
||||
var curr = start + i;
|
||||
if (curr >= list.length) break;
|
||||
var item = list[curr];
|
||||
core.drawIcon('uievent', item.id, 10, 125 + i * 40);
|
||||
core.setTextAlign('uievent', 'left');
|
||||
core.fillText('uievent', core.material.items[item.id].name, 50, 132 + i * 40, null, bigFont);
|
||||
core.setTextAlign('uievent', 'right');
|
||||
core.fillText('uievent', (type == 0 ? core.calValue(item.money) : core.calValue(item.sell)) + useText + "/个", 300, 133 + i * 40, null, middleFont);
|
||||
core.setTextAlign("uievent", "left");
|
||||
if (curr == selectItem) {
|
||||
// 绘制描述,文字自动放缩
|
||||
var text = core.material.items[item.id].text || "该道具暂无描述";
|
||||
try { text = core.replaceText(text); } catch (e) { }
|
||||
for (var fontSize = 20; fontSize >= 8; fontSize -= 2) {
|
||||
var config = { left: 10, fontSize: fontSize, maxWidth: 403 };
|
||||
var height = core.getTextContentHeight(text, config);
|
||||
if (height <= 50) {
|
||||
config.top = (56 - height) / 2;
|
||||
core.drawTextContent("uievent", text, config);
|
||||
break;
|
||||
}
|
||||
}
|
||||
core.ui.drawUIEventSelector(2, "winskin.png", 8, 120 + i * 40, 295, 40);
|
||||
if (type == 0 && item.number != null) {
|
||||
core.fillText("uievent", "存货", 324, 132, null, bigFont);
|
||||
core.setTextAlign("uievent", "right");
|
||||
core.fillText("uievent", item.number, 406, 132, null, null, 40);
|
||||
} else if (type == 1) {
|
||||
core.fillText("uievent", "数量", 324, 132, null, bigFont);
|
||||
core.setTextAlign("uievent", "right");
|
||||
core.fillText("uievent", core.itemCount(item.id), 406, 132, null, null, 40);
|
||||
}
|
||||
core.setTextAlign("uievent", "left");
|
||||
core.fillText("uievent", "预计" + useText, 324, 250);
|
||||
core.setTextAlign("uievent", "right");
|
||||
totalMoney = selectCount * (type == 0 ? core.calValue(item.money) : core.calValue(item.sell));
|
||||
core.fillText("uievent", core.formatBigNumber(totalMoney), 405, 280);
|
||||
core.fillText("uievent", "预计" + useText, 370, 280);
|
||||
core.setTextAlign("uievent", "right");
|
||||
totalMoney = selectCount * (type == 0 ? core.calValue(item.money) : core.calValue(item.sell));
|
||||
core.fillText("uievent", core.formatBigNumber(totalMoney), 470, 310);
|
||||
|
||||
core.setTextAlign("uievent", "left");
|
||||
core.fillText("uievent", type == 0 ? "已购次数" : "已卖次数", 324, 170);
|
||||
core.setTextAlign("uievent", "right");
|
||||
core.fillText("uievent", (type == 0 ? item.money_count : item.sell_count) || 0, 405, 200);
|
||||
}
|
||||
core.setTextAlign("uievent", "left");
|
||||
core.fillText("uievent", type == 0 ? "已购次数" : "已卖次数", 370, 190);
|
||||
core.setTextAlign("uievent", "right");
|
||||
core.fillText("uievent", (type == 0 ? item.money_count : item.sell_count) || 0, 470, 220);
|
||||
}
|
||||
|
||||
core.setTextAlign('uievent', 'left');
|
||||
core.setTextBaseline('uievent', 'alphabetic');
|
||||
}
|
||||
|
||||
var _add = function (item, delta) {
|
||||
if (item == null) return;
|
||||
selectCount = core.clamp(
|
||||
selectCount + delta, 0,
|
||||
Math.min(type == 0 ? Math.floor(core.status.hero[use] / core.calValue(item.money)) : core.itemCount(item.id),
|
||||
type == 0 && item.number != null ? item.number : Number.MAX_SAFE_INTEGER)
|
||||
);
|
||||
}
|
||||
core.setTextAlign('uievent', 'left');
|
||||
core.setTextBaseline('uievent', 'alphabetic');
|
||||
}
|
||||
|
||||
var _confirm = function (item) {
|
||||
if (item == null || selectCount == 0) return;
|
||||
if (type == 0) {
|
||||
core.status.hero[use] -= totalMoney;
|
||||
core.getItem(item.id, selectCount);
|
||||
core.stopSound();
|
||||
core.playSound('确定');
|
||||
if (item.number != null) item.number -= selectCount;
|
||||
item.money_count = (item.money_count || 0) + selectCount;
|
||||
} else {
|
||||
core.status.hero[use] += totalMoney;
|
||||
core.removeItem(item.id, selectCount);
|
||||
core.playSound('确定');
|
||||
core.drawTip("成功卖出" + selectCount + "个" + core.material.items[item.id].name, item.id);
|
||||
if (item.number != null) item.number += selectCount;
|
||||
item.sell_count = (item.sell_count || 0) + selectCount;
|
||||
}
|
||||
var _add = function (item, delta) {
|
||||
if (item == null) return;
|
||||
selectCount = core.clamp(
|
||||
selectCount + delta, 0,
|
||||
Math.min(type == 0 ? Math.floor(core.status.hero[use] / core.calValue(item.money)) : core.itemCount(item.id),
|
||||
type == 0 && item.number != null ? item.number : Number.MAX_SAFE_INTEGER)
|
||||
);
|
||||
}
|
||||
|
||||
var _confirm = function (item) {
|
||||
if (item == null || selectCount == 0) return;
|
||||
if (type == 0) {
|
||||
core.status.hero[use] -= totalMoney;
|
||||
core.getItem(item.id, selectCount);
|
||||
core.stopSound();
|
||||
core.playSound('确定');
|
||||
if (item.number != null) item.number -= selectCount;
|
||||
item.money_count = (item.money_count || 0) + selectCount;
|
||||
} else {
|
||||
core.status.hero[use] += totalMoney;
|
||||
core.removeItem(item.id, selectCount);
|
||||
core.playSound('确定');
|
||||
core.drawTip("成功卖出" + selectCount + "个" + core.material.items[item.id].name, item.id);
|
||||
if (item.number != null) item.number += selectCount;
|
||||
item.sell_count = (item.sell_count || 0) + selectCount;
|
||||
}
|
||||
selectCount = 0;
|
||||
}
|
||||
|
||||
this._performItemShopKeyBoard = function (keycode) {
|
||||
var item = list[selectItem] || null;
|
||||
// 键盘操作
|
||||
switch (keycode) {
|
||||
case 38: // up
|
||||
if (selectItem == null) break;
|
||||
if (selectItem == 0) selectItem = null;
|
||||
else selectItem--;
|
||||
selectCount = 0;
|
||||
}
|
||||
|
||||
this._performItemShopKeyBoard = function (keycode) {
|
||||
var item = list[selectItem] || null;
|
||||
// 键盘操作
|
||||
switch (keycode) {
|
||||
case 38: // up
|
||||
if (selectItem == null) break;
|
||||
if (selectItem == 0) selectItem = null;
|
||||
else selectItem--;
|
||||
selectCount = 0;
|
||||
break;
|
||||
case 37: // left
|
||||
if (selectItem == null) {
|
||||
if (type > 0) type--;
|
||||
break;
|
||||
}
|
||||
_add(item, -1);
|
||||
break;
|
||||
case 39: // right
|
||||
if (selectItem == null) {
|
||||
if (type < 2) type++;
|
||||
break;
|
||||
}
|
||||
_add(item, 1);
|
||||
break;
|
||||
case 40: // down
|
||||
if (selectItem == null) {
|
||||
if (list.length > 0) selectItem = 0;
|
||||
break;
|
||||
}
|
||||
if (list.length == 0) break;
|
||||
selectItem = Math.min(selectItem + 1, list.length - 1);
|
||||
selectCount = 0;
|
||||
break;
|
||||
case 13:
|
||||
case 32: // Enter/Space
|
||||
if (selectItem == null) {
|
||||
if (type == 2)
|
||||
core.insertAction({ "type": "break" });
|
||||
else if (list.length > 0)
|
||||
selectItem = 0;
|
||||
break;
|
||||
}
|
||||
_confirm(item);
|
||||
break;
|
||||
case 27: // ESC
|
||||
if (selectItem == null) {
|
||||
core.insertAction({ "type": "break" });
|
||||
break;
|
||||
}
|
||||
selectItem = null;
|
||||
break;
|
||||
break;
|
||||
case 37: // left
|
||||
if (selectItem == null) {
|
||||
if (type > 0) type--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this._performItemShopClick = function (px, py) {
|
||||
var item = list[selectItem] || null;
|
||||
// 鼠标操作
|
||||
if (px >= 22 && px <= 82 && py >= 71 && py <= 102) {
|
||||
// 买
|
||||
if (type != 0) {
|
||||
type = 0;
|
||||
selectItem = null;
|
||||
selectCount = 0;
|
||||
}
|
||||
return;
|
||||
_add(item, -1);
|
||||
break;
|
||||
case 39: // right
|
||||
if (selectItem == null) {
|
||||
if (type < 2) type++;
|
||||
break;
|
||||
}
|
||||
if (px >= 122 && px <= 182 && py >= 71 && py <= 102) {
|
||||
// 卖
|
||||
if (type != 1) {
|
||||
type = 1;
|
||||
selectItem = null;
|
||||
selectCount = 0;
|
||||
}
|
||||
return;
|
||||
_add(item, 1);
|
||||
break;
|
||||
case 40: // down
|
||||
if (selectItem == null) {
|
||||
if (list.length > 0) selectItem = 0;
|
||||
break;
|
||||
}
|
||||
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)
|
||||
return _add(item, 1);
|
||||
// 确定
|
||||
if (px >= 341 && px <= 387 && py >= 380 && py <= 407)
|
||||
return _confirm(item);
|
||||
|
||||
// 上一页/下一页
|
||||
if (px >= 45 && px <= 105 && py >= 388) {
|
||||
if (page > 1) {
|
||||
selectItem -= 6;
|
||||
selectCount = 0;
|
||||
}
|
||||
return;
|
||||
if (list.length == 0) break;
|
||||
selectItem = Math.min(selectItem + 1, list.length - 1);
|
||||
selectCount = 0;
|
||||
break;
|
||||
case 13:
|
||||
case 32: // Enter/Space
|
||||
if (selectItem == null) {
|
||||
if (type == 2)
|
||||
core.insertAction({ "type": "break" });
|
||||
else if (list.length > 0)
|
||||
selectItem = 0;
|
||||
break;
|
||||
}
|
||||
if (px >= 208 && px <= 268 && py >= 388) {
|
||||
if (page < totalPage) {
|
||||
selectItem = Math.min(selectItem + 6, list.length - 1);
|
||||
selectCount = 0;
|
||||
}
|
||||
return;
|
||||
_confirm(item);
|
||||
break;
|
||||
case 27: // ESC
|
||||
if (selectItem == null) {
|
||||
core.insertAction({ "type": "break" });
|
||||
break;
|
||||
}
|
||||
|
||||
// 实际区域
|
||||
if (px >= 9 && px <= 300 && py >= 120 && py < 360) {
|
||||
if (list.length == 0) return;
|
||||
var index = parseInt((py - 120) / 40);
|
||||
var newItem = 6 * (page - 1) + index;
|
||||
if (newItem >= list.length) newItem = list.length - 1;
|
||||
if (newItem != selectItem) {
|
||||
selectItem = newItem;
|
||||
selectCount = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this._performItemShopAction = function () {
|
||||
if (flags.type == 0) return this._performItemShopKeyBoard(flags.keycode);
|
||||
else return this._performItemShopClick(flags.px, flags.py);
|
||||
}
|
||||
|
||||
this.openItemShop = function (itemShopId) {
|
||||
shopId = itemShopId;
|
||||
type = 0;
|
||||
page = 0;
|
||||
selectItem = null;
|
||||
selectCount = 0;
|
||||
core.isShopVisited(itemShopId);
|
||||
shopInfo = flags.__shops__[shopId];
|
||||
if (shopInfo.choices == null) shopInfo.choices = core.clone(core.status.shops[shopId].choices);
|
||||
choices = shopInfo.choices;
|
||||
use = core.status.shops[shopId].use;
|
||||
if (use != 'exp') use = 'money';
|
||||
useText = use == 'money' ? '金币' : '经验';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
core.insertAction([{
|
||||
this._performItemShopClick = function (px, py) {
|
||||
var item = list[selectItem] || null;
|
||||
// 鼠标操作
|
||||
if (px >= 22 && px <= 82 && py >= 81 && py <= 112) {
|
||||
// 买
|
||||
if (type != 0) {
|
||||
type = 0;
|
||||
selectItem = null;
|
||||
selectCount = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (px >= 142 && px <= 202 && py >= 81 && py <= 112) {
|
||||
// 卖
|
||||
if (type != 1) {
|
||||
type = 1;
|
||||
selectItem = null;
|
||||
selectCount = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (px >= 262 && px <= 322 && py >= 81 && py <= 112) // 离开
|
||||
return core.insertAction({ "type": "break" });
|
||||
// <,>
|
||||
if (px >= 370 && px <= 395 && py >= 392 && py <= 415)
|
||||
return _add(item, -1);
|
||||
if (px >= 445 && px <= 470 && py >= 302 && py <= 415)
|
||||
return _add(item, 1);
|
||||
// 确定
|
||||
if (px >= 392 && px <= 443 && py >= 421 && py <= 446)
|
||||
return _confirm(item);
|
||||
|
||||
// 上一页/下一页
|
||||
if (px >= 70 && px <= 130 && py >= 450) {
|
||||
if (page > 1) {
|
||||
selectItem -= 7;
|
||||
selectCount = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (px >= 230 && px <= 290 && py >= 450) {
|
||||
if (page < totalPage) {
|
||||
selectItem = Math.min(selectItem + 7, list.length - 1);
|
||||
selectCount = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 实际区域
|
||||
if (px >= 9 && px <= 351 && py >= 142 && py < 422) {
|
||||
if (list.length == 0) return;
|
||||
var index = parseInt((py - 142) / 40);
|
||||
var newItem = 7 * (page - 1) + index;
|
||||
if (newItem >= list.length) newItem = list.length - 1;
|
||||
if (newItem != selectItem) {
|
||||
selectItem = newItem;
|
||||
selectCount = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this._performItemShopAction = function () {
|
||||
if (flags.type == 0) return this._performItemShopKeyBoard(flags.keycode);
|
||||
else return this._performItemShopClick(flags.px, flags.py);
|
||||
}
|
||||
|
||||
this.openItemShop = function (itemShopId) {
|
||||
shopId = itemShopId;
|
||||
type = 0;
|
||||
page = 0;
|
||||
selectItem = null;
|
||||
selectCount = 0;
|
||||
core.isShopVisited(itemShopId);
|
||||
shopInfo = flags.__shops__[shopId];
|
||||
if (shopInfo.choices == null) shopInfo.choices = core.clone(core.status.shops[shopId].choices);
|
||||
choices = shopInfo.choices;
|
||||
use = core.status.shops[shopId].use;
|
||||
if (use != 'exp') use = 'money';
|
||||
useText = use == 'money' ? '金币' : '经验';
|
||||
|
||||
core.insertAction([{
|
||||
"type": "while",
|
||||
"condition": "true",
|
||||
"data": [
|
||||
@ -917,10 +942,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
"type": "function",
|
||||
"function": "function () { core.deleteCanvas('uievent'); core.ui.clearUIEventSelector(); }"
|
||||
}
|
||||
]);
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
"enemyLevel": function () {
|
||||
// 此插件将提供怪物手册中的怪物境界显示
|
||||
// 使用此插件需要先给每个怪物定义境界,方法如下:
|
||||
|