MC_survival/plugins.js

14397 lines
597 KiB
JavaScript
Raw Normal View History

2025-01-14 12:27:52 +08:00
///<reference path="../types/core.d.ts" />
var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
{
"init": function () {
this.loadCss = function (href) {
var style = document.createElement('link');
style.type = 'text/css';
style.href = href;
style.rel = 'stylesheet';
document.getElementsByTagName('head')[0].appendChild(style);
}
if (core.platform.isPC && main.mode == 'play') {
//core.plugin.loadCss('stars.css');
}
this._afterLoadResources = function () {
// 本函数将在所有资源加载完毕后,游戏开启前被执行
}
},
"drawLight": function () {
// 绘制灯光/漆黑层效果。调用方式 core.plugin.drawLight(...)
// 【参数说明】
// name必填要绘制到的画布名可以是一个系统画布或者是个自定义画布如果不存在则创建
// color可选只能是一个0~1之间的数为不透明度的值。不填则默认为0.9。
// lights可选一个数组定义了每个独立的灯光。
// 其中每一项是三元组 [x,y,r] x和y分别为该灯光的横纵坐标r为该灯光的半径。
// lightDec可选0到1之间光从多少百分比才开始衰减在此范围内保持全亮不设置默认为0。
// 比如lightDec为0.5代表每个灯光部分内圈50%的范围全亮50%以后才开始快速衰减。
// 【调用样例】
// core.plugin.drawLight('curtain'); // 在curtain层绘制全图不透明度0.9,等价于更改画面色调为[0,0,0,0.9]。
// core.plugin.drawLight('ui', 0.95, [[25,11,46]]); // 在ui层绘制全图不透明度0.95,其中在(25,11)点存在一个半径为46的灯光效果。
// core.plugin.drawLight('test', 0.2, [[25,11,46,0.1]]); // 创建一个test图层不透明度0.2,其中在(25,11)点存在一个半径为46的灯光效果灯光中心不透明度0.1。
// core.plugin.drawLight('test2', 0.9, [[25,11,46],[105,121,88],[301,221,106]]); // 创建test2图层且存在三个灯光效果分别是中心(25,11)半径46中心(105,121)半径88中心(301,221)半径106。
// core.plugin.drawLight('xxx', 0.3, [[25,11,46],[105,121,88,0.2]], 0.4); // 存在两个灯光效果它们在内圈40%范围内保持全亮40%后才开始衰减。
this.drawLight = function (name, color, lights, lightDec) {
// 清空色调层也可以修改成其它层比如animate/weather层或者用自己创建的canvas
var ctx = core.getContextByName(name);
if (ctx == null) {
if (typeof name == 'string')
ctx = core.createCanvas(name, 0, 0, core._PX_ || core.__PIXELS__, core._PY_ || core.__PIXELS__, 98);
else return;
}
ctx.mozImageSmoothingEnabled = false;
ctx.webkitImageSmoothingEnabled = false;
ctx.msImageSmoothingEnabled = false;
ctx.imageSmoothingEnabled = false;
core.clearMap(name);
// 绘制色调层,默认不透明度
if (color == null) color = 0.9;
ctx.fillStyle = "rgba(0,0,0," + color + ")";
ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
lightDec = core.clamp(lightDec, 0, 1);
// 绘制每个灯光效果
ctx.globalCompositeOperation = 'destination-out';
lights.forEach(function (light) {
// 坐标,半径,中心不透明度
var x = light[0],
y = light[1],
r = light[2];
// 计算衰减距离
var decDistance = parseInt(r * lightDec);
// 正方形区域的直径和左上角坐标
var grd = ctx.createRadialGradient(x, y, decDistance, x, y, r);
grd.addColorStop(0, "rgba(0,0,0,1)");
grd.addColorStop(1, "rgba(0,0,0,0)");
ctx.beginPath();
ctx.fillStyle = grd;
ctx.arc(x, y, r, 0, 2 * Math.PI);
ctx.fill();
});
ctx.globalCompositeOperation = 'source-over';
// 可以在任何地方如afterXXX或自定义脚本事件调用函数方法为 core.plugin.xxx();
}
},
"shop": function () {
// 【全局商店】相关的功能
//
// 打开一个全局商店
// shopId要打开的商店idnoRoute是否不计入录像
this.openShop = function (shopId, noRoute) {
var shop = core.status.shops[shopId];
// Step 1: 检查能否打开此商店
if (!this.canOpenShop(shopId)) {
core.drawTip("该商店尚未开启");
return false;
}
// Step 2: (如有必要)记录打开商店的脚本事件
if (!noRoute) {
core.status.route.push("shop:" + shopId);
}
// Step 3: 检查道具商店 or 公共事件
if (shop.item) {
if (core.openItemShop) {
core.openItemShop(shopId);
} else {
core.playSound('操作失败');
core.insertAction("道具商店插件不存在!请检查是否存在该插件!");
}
return;
}
if (shop.commonEvent) {
core.insertCommonEvent(shop.commonEvent, shop.args);
return;
}
_shouldProcessKeyUp = true;
// Step 4: 执行标准公共商店
core.insertAction(this._convertShop(shop));
return true;
}
////// 将一个全局商店转变成可预览的公共事件 //////
this._convertShop = function (shop) {
return [
{ "type": "function", "function": "function() {core.addFlag('@temp@shop', 1);}" },
{
"type": "while",
"condition": "true",
"data": [
// 检测能否访问该商店
{
"type": "if",
"condition": "core.isShopVisited('" + shop.id + "')",
"true": [
// 可以访问,直接插入执行效果
{ "type": "function", "function": "function() { core.plugin._convertShop_replaceChoices('" + shop.id + "', false) }" },
],
"false": [
// 不能访问的情况下:检测能否预览
{
"type": "if",
"condition": shop.disablePreview,
"true": [
// 不可预览,提示并退出
{ "type": "playSound", "name": "操作失败" },
"当前无法访问该商店!",
{ "type": "break" },
],
"false": [
// 可以预览:将商店全部内容进行替换
{ "type": "tip", "text": "当前处于预览模式,不可购买" },
{ "type": "function", "function": "function() { core.plugin._convertShop_replaceChoices('" + shop.id + "', true) }" },
]
}
]
}
]
},
{ "type": "function", "function": "function() {core.addFlag('@temp@shop', -1);}" }
];
}
this._convertShop_replaceChoices = function (shopId, previewMode) {
var shop = core.status.shops[shopId];
var choices = (shop.choices || []).filter(function (choice) {
if (choice.condition == null || choice.condition == '') return true;
try { return core.calValue(choice.condition); } catch (e) { return true; }
}).map(function (choice) {
var ableToBuy = core.calValue(choice.need);
return {
"text": choice.text,
"icon": choice.icon,
"color": ableToBuy && !previewMode ? choice.color : [153, 153, 153, 1],
"action": ableToBuy && !previewMode ? [{ "type": "playSound", "name": "商店" }].concat(choice.action) : [
{ "type": "playSound", "name": "操作失败" },
{ "type": "tip", "text": previewMode ? "预览模式下不可购买" : "购买条件不足" }
]
};
}).concat({ "text": "离开", "action": [{ "type": "playSound", "name": "取消" }, { "type": "break" }] });
core.insertAction({ "type": "choices", "text": shop.text, "choices": choices });
}
/// 是否访问过某个快捷商店
this.isShopVisited = function (id) {
if (!core.hasFlag("__shops__")) core.setFlag("__shops__", {});
var shops = core.getFlag("__shops__");
if (!shops[id]) shops[id] = {};
return shops[id].visited;
}
/// 当前应当显示的快捷商店列表
this.listShopIds = function () {
return Object.keys(core.status.shops).filter(function (id) {
return core.isShopVisited(id) || !core.status.shops[id].mustEnable;
});
}
/// 是否能够打开某个商店
this.canOpenShop = function (id) {
if (this.isShopVisited(id)) return true;
var shop = core.status.shops[id];
if (shop.item || shop.commonEvent || shop.mustEnable) return false;
return true;
}
/// 启用或禁用某个快捷商店
this.setShopVisited = function (id, visited) {
if (!core.hasFlag("__shops__")) core.setFlag("__shops__", {});
var shops = core.getFlag("__shops__");
if (!shops[id]) shops[id] = {};
if (visited) shops[id].visited = true;
else delete shops[id].visited;
}
/// 能否使用快捷商店
this.canUseQuickShop = function (id) {
// 如果返回一个字符串,表示不能,字符串为不能使用的提示
// 返回null代表可以使用
// 检查当前楼层的canUseQuickShop选项是否为false
if (core.status.thisMap.canUseQuickShop === false)
return '当前楼层不能使用快捷商店。';
return null;
}
var _shouldProcessKeyUp = true;
/// 允许商店X键退出
core.registerAction('keyUp', 'shops', function (keycode) {
if (!core.status.lockControl || core.status.event.id != 'action') return false;
if ((keycode == 13 || keycode == 32) && !_shouldProcessKeyUp) {
_shouldProcessKeyUp = true;
return true;
}
if (!core.hasFlag("@temp@shop") || core.status.event.data.type != 'choices') return false;
var data = core.status.event.data.current;
var choices = data.choices;
var topIndex = core.actions._getChoicesTopIndex(choices.length);
if (keycode == 88 || keycode == 27) { // X, ESC
core.actions._clickAction(core._HALF_WIDTH_ || core.__HALF_SIZE__, topIndex + choices.length - 1);
return true;
}
return false;
}, 60);
/// 允许长按空格或回车连续执行操作
core.registerAction('keyDown', 'shops', function (keycode) {
if (!core.status.lockControl || !core.hasFlag("@temp@shop") || core.status.event.id != 'action') return false;
if (core.status.event.data.type != 'choices') return false;
core.status.onShopLongDown = true;
var data = core.status.event.data.current;
var choices = data.choices;
var topIndex = core.actions._getChoicesTopIndex(choices.length);
if (keycode == 13 || keycode == 32) { // Space, Enter
core.actions._clickAction(core._HALF_WIDTH_ || core.__HALF_SIZE__, topIndex + core.status.event.selection);
_shouldProcessKeyUp = false;
return true;
}
return false;
}, 60);
// 允许长按屏幕连续执行操作
core.registerAction('longClick', 'shops', function (x, y, px, py) {
if (!core.status.lockControl || !core.hasFlag("@temp@shop") || core.status.event.id != 'action') return false;
if (core.status.event.data.type != 'choices') return false;
var data = core.status.event.data.current;
var choices = data.choices;
var topIndex = core.actions._getChoicesTopIndex(choices.length);
if (Math.abs(x - (core._HALF_WIDTH_ || core.__HALF_SIZE__)) <= 2 && y >= topIndex && y < topIndex + choices.length) {
core.actions._clickAction(x, y);
return true;
}
return false;
}, 60);
},
"removeMap": function () {
// 高层塔砍层插件,删除后不会存入存档,不可浏览地图也不可飞到。
// 推荐用法:
// 对于超高层或分区域塔当在1区时将2区以后的地图删除1区结束时恢复2区进二区时删除1区地图以此类推
// 这样可以大幅减少存档空间,以及加快存读档速度
// 删除楼层
// core.removeMaps("MT1", "MT300") 删除MT1~MT300之间的全部层
// core.removeMaps("MT10") 只删除MT10层
this.removeMaps = function (fromId, toId) {
toId = toId || fromId;
var fromIndex = core.floorIds.indexOf(fromId),
toIndex = core.floorIds.indexOf(toId);
if (toIndex < 0) toIndex = core.floorIds.length - 1;
flags.__visited__ = flags.__visited__ || {};
flags.__removed__ = flags.__removed__ || [];
flags.__disabled__ = flags.__disabled__ || {};
flags.__leaveLoc__ = flags.__leaveLoc__ || {};
for (var i = fromIndex; i <= toIndex; ++i) {
var floorId = core.floorIds[i];
if (core.status.maps[floorId].deleted) continue;
delete flags.__visited__[floorId];
flags.__removed__.push(floorId);
delete flags.__disabled__[floorId];
delete flags.__leaveLoc__[floorId];
(core.status.autoEvents || []).forEach(function (event) {
if (event.floorId == floorId && event.currentFloor) {
core.autoEventExecuting(event.symbol, false);
core.autoEventExecuted(event.symbol, false);
}
});
core.status.maps[floorId].deleted = true;
core.status.maps[floorId].canFlyTo = false;
core.status.maps[floorId].canFlyFrom = false;
core.status.maps[floorId].cannotViewMap = true;
}
}
// 恢复楼层
// core.resumeMaps("MT1", "MT300") 恢复MT1~MT300之间的全部层
// core.resumeMaps("MT10") 只恢复MT10层
this.resumeMaps = function (fromId, toId) {
toId = toId || fromId;
var fromIndex = core.floorIds.indexOf(fromId),
toIndex = core.floorIds.indexOf(toId);
if (toIndex < 0) toIndex = core.floorIds.length - 1;
flags.__removed__ = flags.__removed__ || [];
for (var i = fromIndex; i <= toIndex; ++i) {
var floorId = core.floorIds[i];
if (!core.status.maps[floorId].deleted) continue;
flags.__removed__ = flags.__removed__.filter(function (f) { return f != floorId; });
core.status.maps[floorId] = core.loadFloor(floorId);
}
}
// 分区砍层相关
var inAnyPartition = function (floorId) {
var inPartition = false;
(core.floorPartitions || []).forEach(function (floor) {
var fromIndex = core.floorIds.indexOf(floor[0]);
var toIndex = core.floorIds.indexOf(floor[1]);
var index = core.floorIds.indexOf(floorId);
if (fromIndex < 0 || index < 0) return;
if (toIndex < 0) toIndex = core.floorIds.length - 1;
if (index >= fromIndex && index <= toIndex) inPartition = true;
});
return inPartition;
}
// 分区砍层
this.autoRemoveMaps = function (floorId) {
if (main.mode != 'play' || !inAnyPartition(floorId)) return;
// 根据分区信息自动砍层与恢复
(core.floorPartitions || []).forEach(function (floor) {
var fromIndex = core.floorIds.indexOf(floor[0]);
var toIndex = core.floorIds.indexOf(floor[1]);
var index = core.floorIds.indexOf(floorId);
if (fromIndex < 0 || index < 0) return;
if (toIndex < 0) toIndex = core.floorIds.length - 1;
if (index >= fromIndex && index <= toIndex) {
core.resumeMaps(core.floorIds[fromIndex], core.floorIds[toIndex]);
} else {
core.removeMaps(core.floorIds[fromIndex], core.floorIds[toIndex]);
}
});
}
},
"fiveLayers": function () {
// 是否启用五图层增加背景2层和前景2层 将__enable置为true即会启用启用后请保存后刷新编辑器
// 背景层2将会覆盖背景层 被事件层覆盖 前景层2将会覆盖前景层
// 另外 请注意加入两个新图层 会让大地图的性能降低一些
// 插件作者ad
var __enable = false;
if (!__enable) return;
// 创建新图层
function createCanvas(name, zIndex) {
if (!name) return;
var canvas = document.createElement('canvas');
canvas.id = name;
canvas.className = 'gameCanvas anti-aliasing';
// 编辑器模式下设置zIndex会导致加入的图层覆盖优先级过高
if (main.mode != "editor") canvas.style.zIndex = zIndex || 0;
// 将图层插入进游戏内容
document.getElementById('gameDraw').appendChild(canvas);
var ctx = canvas.getContext('2d');
core.canvas[name] = ctx;
canvas.width = core._PX_ || core.__PIXELS__;
canvas.height = core._PY_ || core.__PIXELS__;
return canvas;
}
var bg2Canvas = createCanvas('bg2', 20);
var fg2Canvas = createCanvas('fg2', 63);
// 大地图适配
core.bigmap.canvas = ["bg2", "fg2", "bg", "event", "event2", "fg", "damage"];
core.initStatus.bg2maps = {};
core.initStatus.fg2maps = {};
if (main.mode == 'editor') {
/*插入编辑器的图层 不做此步新增图层无法在编辑器显示*/
// 编辑器图层覆盖优先级 eui > efg > fg(前景层) > event2(48*32图块的事件层) > event(事件层) > bg(背景层)
// 背景层2(bg2) 插入事件层(event)之前(即bg与event之间)
document.getElementById('mapEdit').insertBefore(bg2Canvas, document.getElementById('event'));
// 前景层2(fg2) 插入编辑器前景(efg)之前(即fg之后)
document.getElementById('mapEdit').insertBefore(fg2Canvas, document.getElementById('ebm'));
// 原本有三个图层 从4开始添加
var num = 4;
// 新增图层存入editor.dom中
editor.dom.bg2c = core.canvas.bg2.canvas;
editor.dom.bg2Ctx = core.canvas.bg2;
editor.dom.fg2c = core.canvas.fg2.canvas;
editor.dom.fg2Ctx = core.canvas.fg2;
editor.dom.maps.push('bg2map', 'fg2map');
editor.dom.canvas.push('bg2', 'fg2');
// 创建编辑器上的按钮
var createCanvasBtn = function (name) {
// 电脑端创建按钮
var input = document.createElement('input');
// layerMod4/layerMod5
var id = 'layerMod' + num++;
// bg2map/fg2map
var value = name + 'map';
input.type = 'radio';
input.name = 'layerMod';
input.id = id;
input.value = value;
editor.dom[id] = input;
input.onchange = function () {
editor.uifunctions.setLayerMod(value);
}
return input;
};
var createCanvasBtn_mobile = function (name) {
// 手机端往选择列表中添加子选项
var input = document.createElement('option');
var id = 'layerMod' + num++;
var value = name + 'map';
input.name = 'layerMod';
input.value = value;
editor.dom[id] = input;
return input;
};
if (!editor.isMobile) {
var input = createCanvasBtn('bg2');
var input2 = createCanvasBtn('fg2');
// 获取事件层及其父节点
var child = document.getElementById('layerMod'),
parent = child.parentNode;
// 背景层2插入事件层前
parent.insertBefore(input, child);
// 不能直接更改背景层2的innerText 所以创建文本节点
var txt = document.createTextNode('bg2');
// 插入事件层前(即新插入的背景层2前)
parent.insertBefore(txt, child);
// 向最后插入前景层2(即插入前景层后)
parent.appendChild(input2);
var txt2 = document.createTextNode('fg2');
parent.appendChild(txt2);
parent.childNodes[2].replaceWith("bg");
parent.childNodes[6].replaceWith("事件");
parent.childNodes[8].replaceWith("fg");
} else {
var input = createCanvasBtn_mobile('bg2');
var input2 = createCanvasBtn_mobile('fg2');
// 手机端因为是选项 所以可以直接改innerText
input.innerText = '背景层2';
input2.innerText = '前景层2';
var parent = document.getElementById('layerMod');
parent.insertBefore(input, parent.children[1]);
parent.appendChild(input2);
}
}
var _loadFloor_doNotCopy = core.maps._loadFloor_doNotCopy;
core.maps._loadFloor_doNotCopy = function () {
return ["bg2map", "fg2map"].concat(_loadFloor_doNotCopy());
}
////// 绘制背景和前景层 //////
core.maps._drawBg_draw = function (floorId, toDrawCtx, cacheCtx, config) {
config.ctx = cacheCtx;
core.maps._drawBg_drawBackground(floorId, config);
// ------ 调整这两行的顺序来控制是先绘制贴图还是先绘制背景图块;后绘制的覆盖先绘制的。
core.maps._drawFloorImages(floorId, config.ctx, 'bg', null, null, config.onMap);
core.maps._drawBgFgMap(floorId, 'bg', config);
if (config.onMap) {
core.drawImage(toDrawCtx, cacheCtx.canvas, core.bigmap.v2 ? -32 : 0, core.bigmap.v2 ? -32 : 0);
core.clearMap('bg2');
core.clearMap(cacheCtx);
}
core.maps._drawBgFgMap(floorId, 'bg2', config);
if (config.onMap) core.drawImage('bg2', cacheCtx.canvas, core.bigmap.v2 ? -32 : 0, core.bigmap.v2 ? -32 : 0);
config.ctx = toDrawCtx;
}
core.maps._drawFg_draw = function (floorId, toDrawCtx, cacheCtx, config) {
config.ctx = cacheCtx;
// ------ 调整这两行的顺序来控制是先绘制贴图还是先绘制前景图块;后绘制的覆盖先绘制的。
core.maps._drawFloorImages(floorId, config.ctx, 'fg', null, null, config.onMap);
core.maps._drawBgFgMap(floorId, 'fg', config);
if (config.onMap) {
core.drawImage(toDrawCtx, cacheCtx.canvas, core.bigmap.v2 ? -32 : 0, core.bigmap.v2 ? -32 : 0);
core.clearMap('fg2');
core.clearMap(cacheCtx);
}
core.maps._drawBgFgMap(floorId, 'fg2', config);
if (config.onMap) core.drawImage('fg2', cacheCtx.canvas, core.bigmap.v2 ? -32 : 0, core.bigmap.v2 ? -32 : 0);
config.ctx = toDrawCtx;
}
////// 移动判定 //////
core.maps._generateMovableArray_arrays = function (floorId) {
return {
bgArray: this.getBgMapArray(floorId),
fgArray: this.getFgMapArray(floorId),
eventArray: this.getMapArray(floorId),
bg2Array: this._getBgFgMapArray('bg2', floorId),
fg2Array: this._getBgFgMapArray('fg2', floorId)
};
}
},
"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 bigFont = core.ui._buildFont(20, false),
middleFont = core.ui._buildFont(18, false);
this._drawItemShop = function () {
// 绘制道具商店
// Step 1: 背景和固定的几个文字
core.ui._createUIEvent();
core.clearMap('uievent');
core.ui.clearUIEventSelector();
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.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) { }
}
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.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.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)
);
}
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;
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;
}
}
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;
}
if (px >= 122 && px <= 182 && py >= 71 && py <= 102) {
// 卖
if (type != 1) {
type = 1;
selectItem = null;
selectCount = 0;
}
return;
}
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 (px >= 208 && px <= 268 && py >= 388) {
if (page < totalPage) {
selectItem = Math.min(selectItem + 6, list.length - 1);
selectCount = 0;
}
return;
}
// 实际区域
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' ? '金币' : '经验';
core.insertAction([{
"type": "while",
"condition": "true",
"data": [
{ "type": "function", "function": "function () { core.plugin._drawItemShop(); }" },
{ "type": "wait" },
{ "type": "function", "function": "function() { core.plugin._performItemShopAction(); }" }
]
},
{
"type": "function",
"function": "function () { core.deleteCanvas('uievent'); core.ui.clearUIEventSelector(); }"
}
]);
}
},
"enemyLevel": function () {
// 此插件将提供怪物手册中的怪物境界显示
// 使用此插件需要先给每个怪物定义境界,方法如下:
// 点击怪物的【配置表格】,找到“【怪物】相关的表格配置”,然后在【名称】仿照增加境界定义:
/*
"level": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "境界"
},
*/
// 然后保存刷新,可以看到怪物的属性定义中出现了【境界】。再开启本插件即可。
// 是否开启本插件,默认禁用;将此改成 true 将启用本插件。
var __enable = false;
if (!__enable) return;
// 这里定义每个境界的显示颜色;可以写'red', '#RRGGBB' 或者[r,g,b,a]四元数组
var levelToColors = {
"萌新一阶": "red",
"萌新二阶": "#FF0000",
"萌新三阶": [255, 0, 0, 1],
};
// 复写 _drawBook_drawName
var originDrawBook = core.ui._drawBook_drawName;
core.ui._drawBook_drawName = function (index, enemy, top, left, width) {
// 如果没有境界,则直接调用原始代码绘制
if (!enemy.level) return originDrawBook.call(core.ui, index, enemy, top, left, width);
// 存在境界,则额外进行绘制
core.setTextAlign('ui', 'center');
if (enemy.specialText.length == 0) {
core.fillText('ui', enemy.name, left + width / 2,
top + 27, '#DDDDDD', this._buildFont(17, true));
core.fillText('ui', enemy.level, left + width / 2,
top + 51, core.arrayToRGBA(levelToColors[enemy.level] || '#DDDDDD'), this._buildFont(14, true));
} else {
core.fillText('ui', enemy.name, left + width / 2,
top + 20, '#DDDDDD', this._buildFont(17, true), width);
switch (enemy.specialText.length) {
case 1:
core.fillText('ui', enemy.specialText[0], left + width / 2,
top + 38, core.arrayToRGBA((enemy.specialColor || [])[0] || '#FF6A6A'),
this._buildFont(14, true), width);
break;
case 2:
// Step 1: 计算字体
var text = enemy.specialText[0] + " " + enemy.specialText[1];
core.setFontForMaxWidth('ui', text, width, this._buildFont(14, true));
// Step 2: 计算总宽度
var totalWidth = core.calWidth('ui', text);
var leftWidth = core.calWidth('ui', enemy.specialText[0]);
var rightWidth = core.calWidth('ui', enemy.specialText[1]);
// Step 3: 绘制
core.fillText('ui', enemy.specialText[0], left + (width + leftWidth - totalWidth) / 2,
top + 38, core.arrayToRGBA((enemy.specialColor || [])[0] || '#FF6A6A'));
core.fillText('ui', enemy.specialText[1], left + (width + totalWidth - rightWidth) / 2,
top + 38, core.arrayToRGBA((enemy.specialColor || [])[1] || '#FF6A6A'));
break;
default:
core.fillText('ui', '多属性...', left + width / 2,
top + 38, '#FF6A6A', this._buildFont(14, true), width);
}
core.fillText('ui', enemy.level, left + width / 2,
top + 56, core.arrayToRGBA(levelToColors[enemy.level] || '#DDDDDD'), this._buildFont(14, true));
}
}
// 也可以复写其他的属性颜色如怪物攻防等,具体参见下面的例子的注释部分
core.ui._drawBook_drawRow1 = function (index, enemy, top, left, width, position) {
// 绘制第一行
core.setTextAlign('ui', 'left');
var b13 = this._buildFont(13, true),
f13 = this._buildFont(13, false);
var col1 = left,
col2 = left + width * 9 / 25,
col3 = left + width * 17 / 25;
core.fillText('ui', '生命', col1, position, '#DDDDDD', f13);
core.fillText('ui', core.formatBigNumber(enemy.hp || 0), col1 + 30, position, /*'red' */ null, b13);
core.fillText('ui', '攻击', col2, position, null, f13);
core.fillText('ui', core.formatBigNumber(enemy.atk || 0), col2 + 30, position, /* '#FF0000' */ null, b13);
core.fillText('ui', '防御', col3, position, null, f13);
core.fillText('ui', core.formatBigNumber(enemy.def || 0), col3 + 30, position, /* [255, 0, 0, 1] */ null, b13);
}
},
"multiHeros": function () {
// 多角色插件
// Step 1: 启用本插件
// Step 2: 定义每个新的角色各项初始数据(参见下方注释)
// Step 3: 在游戏中的任何地方都可以调用 `core.changeHero()` 进行切换;也可以 `core.changeHero(1)` 来切换到某个具体的角色上
// 是否开启本插件,默认禁用;将此改成 true 将启用本插件。
var __enable = false;
if (!__enable) return;
// 在这里定义全部的新角色属性
// 请注意,在这里定义的内容不会多角色共用,在切换时会进行恢复。
// 你也可以自行新增或删除,比如不共用金币则可以加上"money"的初始化,不共用道具则可以加上"items"的初始化,
// 多角色共用hp的话则删除hp等等。总之不共用的属性都在这里进行定义就好。
var hero1 = {
"floorId": "MT0", // 该角色初始楼层ID如果共用楼层可以注释此项
"image": "brave.png", // 角色的行走图名称;此项必填不然会报错
"name": "1号角色",
"lv": 1,
"hp": 10000, // 如果HP共用可注释此项
"atk": 1000,
"def": 1000,
"mdef": 0,
// "money": 0, // 如果要不共用金币则取消此项注释
// "exp": 0, // 如果要不共用经验则取消此项注释
"loc": { "x": 0, "y": 0, "direction": "up" }, // 该角色初始位置;如果共用位置可注释此项
"items": {
"tools": {}, // 如果共用消耗道具(含钥匙)则可注释此项
// "constants": {}, // 如果不共用永久道具(如手册)可取消注释此项
"equips": {}, // 如果共用在背包的装备可注释此项
},
"equipment": [], // 如果共用装备可注释此项;此项和上面的「共用在背包的装备」需要拥有相同状态,不然可能出现问题
};
// 也可以类似新增其他角色
// 新增的角色,各项属性共用与不共用的选择必须和上面完全相同,否则可能出现问题。
// var hero2 = { ...
var heroCount = 2; // 包含默认角色在内总共多少个角色,该值需手动修改。
this.initHeros = function () {
core.setFlag("hero1", core.clone(hero1)); // 将属性值存到变量中
// core.setFlag("hero2", core.clone(hero2)); // 更多的角色也存入变量中;每个定义的角色都需要新增一行
// 检测是否存在装备
if (hero1.equipment) {
if (!hero1.items || !hero1.items.equips) {
alert('多角色插件的equipment和道具中的equips必须拥有相同状态');
}
// 存99号套装为全空
var saveEquips = core.getFlag("saveEquips", []);
saveEquips[99] = [];
core.setFlag("saveEquips", saveEquips);
} else {
if (hero1.items && hero1.items.equips) {
alert('多角色插件的equipment和道具中的equips必须拥有相同状态');
}
}
}
// 在游戏开始注入initHeros
var _startGame_setHard = core.events._startGame_setHard;
core.events._startGame_setHard = function () {
_startGame_setHard.call(core.events);
core.initHeros();
}
// 切换角色
// 可以使用 core.changeHero() 来切换到下一个角色
// 也可以 core.changeHero(1) 来切换到某个角色默认角色为0
this.changeHero = function (toHeroId) {
var currHeroId = core.getFlag("heroId", 0); // 获得当前角色ID
if (toHeroId == null) {
toHeroId = (currHeroId + 1) % heroCount;
}
if (currHeroId == toHeroId) return;
var saveList = Object.keys(hero1);
// 保存当前内容
var toSave = {};
// 暂时干掉 drawTip 和 音效,避免切装时的提示
var _drawTip = core.ui.drawTip;
core.ui.drawTip = function () { };
var _playSound = core.control.playSound;
core.control.playSound = function () { }
// 记录当前录像,因为可能存在换装问题
core.clearRouteFolding();
var routeLength = core.status.route.length;
// 优先判定装备
if (hero1.equipment) {
core.items.quickSaveEquip(100 + currHeroId);
core.items.quickLoadEquip(99);
}
saveList.forEach(function (name) {
if (name == 'floorId') toSave[name] = core.status.floorId; // 楼层单独设置
else if (name == 'items') {
toSave.items = core.clone(core.status.hero.items);
Object.keys(toSave.items).forEach(function (one) {
if (!hero1.items[one]) delete toSave.items[one];
});
} else toSave[name] = core.clone(core.status.hero[name]); // 使用core.clone()来创建新对象
});
core.setFlag("hero" + currHeroId, toSave); // 将当前角色信息进行保存
var data = core.getFlag("hero" + toHeroId); // 获得要切换的角色保存内容
// 设置角色的属性值
saveList.forEach(function (name) {
if (name == "floorId");
else if (name == "items") {
Object.keys(core.status.hero.items).forEach(function (one) {
if (data.items[one]) core.status.hero.items[one] = core.clone(data.items[one]);
});
} else {
core.status.hero[name] = core.clone(data[name]);
}
});
// 最后装上装备
if (hero1.equipment) {
core.items.quickLoadEquip(100 + toHeroId);
}
core.ui.drawTip = _drawTip;
core.control.playSound = _playSound;
core.status.route = core.status.route.slice(0, routeLength);
core.control._bindRoutePush();
// 插入事件:改变角色行走图并进行楼层切换
var toFloorId = data.floorId || core.status.floorId;
var toLoc = data.loc || core.status.hero.loc;
core.insertAction([
{ "type": "setHeroIcon", "name": data.image || "hero.png" }, // 改变行走图
// 同层则用changePos不同层则用changeFloor这是为了避免共用楼层造成触发eachArrive
toFloorId != core.status.floorId ? {
"type": "changeFloor",
"floorId": toFloorId,
"loc": [toLoc.x, toLoc.y],
"direction": toLoc.direction,
"time": 0 // 可以在这里设置切换时间
} : { "type": "changePos", "loc": [toLoc.x, toLoc.y], "direction": toLoc.direction }
// 你还可以在这里执行其他事件,比如增加或取消跟随效果
]);
core.setFlag("heroId", toHeroId); // 保存切换到的角色ID
}
},
"heroFourFrames": function () {
// 样板的勇士/跟随者移动时只使用2、4两帧观感较差。本插件可以将四帧全用上。
// 是否启用本插件
var __enable = true;
if (!__enable) return;
["up", "down", "left", "right"].forEach(function (one) {
// 指定中间帧动画
core.material.icons.hero[one].midFoot = 2;
});
var heroMoving = function (timestamp) {
if (core.status.heroMoving <= 0) return;
if (timestamp - core.animateFrame.moveTime > core.values.moveSpeed) {
core.animateFrame.leftLeg++;
core.animateFrame.moveTime = timestamp;
}
core.drawHero(['stop', 'leftFoot', 'midFoot', 'rightFoot'][core.animateFrame.leftLeg % 4], 4 * core.status.heroMoving);
}
core.registerAnimationFrame('heroMoving', true, heroMoving);
core.events._eventMoveHero_moving = function (step, moveSteps) {
var curr = moveSteps[0];
var direction = curr[0],
x = core.getHeroLoc('x'),
y = core.getHeroLoc('y');
// ------ 前进/后退
var o = direction == 'backward' ? -1 : 1;
if (direction == 'forward' || direction == 'backward') direction = core.getHeroLoc('direction');
var faceDirection = direction;
if (direction == 'leftup' || direction == 'leftdown') faceDirection = 'left';
if (direction == 'rightup' || direction == 'rightdown') faceDirection = 'right';
core.setHeroLoc('direction', direction);
if (curr[1] <= 0) {
core.setHeroLoc('direction', faceDirection);
moveSteps.shift();
return true;
}
if (step <= 4) core.drawHero('stop', 4 * o * step);
else if (step <= 8) core.drawHero('leftFoot', 4 * o * step);
else if (step <= 12) core.drawHero('midFoot', 4 * o * (step - 8));
else if (step <= 16) core.drawHero('rightFoot', 4 * o * (step - 8)); // if (step == 8) {
if (step == 8 || step == 16) {
core.setHeroLoc('x', x + o * core.utils.scan2[direction].x, true);
core.setHeroLoc('y', y + o * core.utils.scan2[direction].y, true);
core.updateFollowers();
curr[1]--;
if (curr[1] <= 0) moveSteps.shift();
core.setHeroLoc('direction', faceDirection);
return step == 16;
}
return false;
}
},
"routeFixing": function () {
// 是否开启本插件true 表示启用false 表示禁用。
var __enable = true;
if (!__enable) return;
/*
使用说明启用本插件后录像回放时您可以用数字键1或6分别切换到原速或24倍速
暂停播放时按数字键7电脑按N可以单步播放手机端可以点击难度单词切换出数字键
数字键2-5可以进行录像自助精修具体描述见下实际弹窗请求您输入时不要带有任何空格
up down left right 勇士向某个方向行走一步或撞击
item:ID 使用某件道具 item:bomb 表示使用炸弹
unEquip:n 卸掉身上第(n+1)件装备n从0开始 unEquip:1 默认表示卸掉盾牌
equip:ID 穿上某件装备 equip:sword1 表示装上铁剑
saveEquip:n 将身上的当前套装保存到第n套快捷套装n从0开始
loadEquip:n 快捷换上之前保存好的第n套套装
fly:ID 使用楼传飞到某一层 fly:MT10 表示飞到主塔10层
choices:none 确认框/选择项超时作者未设置超时时间则此项视为缺失
choices:n 确认框/选择项选择第(n+1)选择项n从0开始确认框n为0表示确定1表示取消
选择项n为负数时表示选择倒数第 -n -1 表示最后一项V2.8.2起标准全局商店的离开
此项缺失的话确认框将选择作者指定的默认项初始光标位置选择项将弹窗请求补选后台录像验证中选最后一项可以复写函数来修改
shop:ID 打开某个全局商店 shop:itemShop 表示打开道具商店因此连载塔千万不要中途修改商店ID
turn 单击勇士Z键转身core.turnHero() 会产生此项因此通过事件等方式强制让勇士转向应该用 core.setHeroLoc()
turn:dir 勇士转向某个方向dir 可以为 up down left right此项一般是读取自动存档产生的属于样板的不良特性请勿滥用
getNext 轻按获得身边道具优先获得面前的面前没有则按上下左右顺序依次获得身边如果没有道具则此项会被跳过
input:none 等待用户操作事件中超时作者未设置超时时间则此项会导致报错
input:xxx 可能表示等待用户操作事件的一个操作如按键操作将直接记录 input:keycode
也可能表示一个接受用户输入数字的输入后者的情况下 xxx 为输入的整数此项缺失的话前者将直接报错后者将用0代替后者现在支持负数了
input2:xxx 可能表示读取全局存储core.getGlobal读取到的值也可能表示一个接受用户输入文本的输入
两种情况下 xxx 都为 base64 编码此项缺失的话前者将重新现场读取后者将用空字符串代替
no 走到可穿透的楼梯上不触发楼层切换事件通过本插件可以让勇士停在旁边没有障碍物的楼梯上哦
move:x:y 尝试瞬移到 [x,y] 不改变朝向该点甚至可以和勇士相邻或者位于视野外
key:n 松开键值为n的键 key:49 表示松开大键盘数字键1默认会触发使用破墙镐
click:n:px:py 点击自绘状态栏n为0表示横屏1表示竖屏[px,py] 为点击的像素坐标
random:n 生成了随机数n core.rand2(num) 的返回结果n必须在 [0,num-1] 范围num必须为正整数此项缺失将导致现场重新随机生成数值可能导致回放结果不一致
作者自定义的新项一般为js对象可以先JSON.stringify()再core.encodeBase64()得到纯英文数字的内容需要用(半角圆括弧)括起来
当您使用数字键5将一些项追加到即将播放内容的开头时请注意要逆序逐项追加或者每追加一项就按下数字键7或字母键N单步播放一步
但是input input2 random choices是被动读取的单步播放如果触发了相应的事件就会连续读取这时候只能提前逐项追加好
电脑端熟练以后推荐直接在控制台操作 core.status.route core.status.replay.toReplay后者录像回放时才有配合 core.push() core.unshift() 更加灵活自由哦
*/
core.actions.registerAction('onkeyUp', '_sys_onkeyUp_replay', function (e) {
if (this._checkReplaying()) {
if (e.keyCode == 27) // ESCAPE
core.stopReplay();
else if (e.keyCode == 90) // Z
core.speedDownReplay();
else if (e.keyCode == 67) // C
core.speedUpReplay();
else if (e.keyCode == 32) // SPACE
core.triggerReplay();
else if (e.keyCode == 65) // A
core.rewindReplay();
else if (e.keyCode == 83) // S
core.control._replay_SL();
else if (e.keyCode == 88) // X
core.control._replay_book();
else if (e.keyCode == 33 || e.keyCode == 34) // PgUp/PgDn
core.control._replay_viewMap();
else if (e.keyCode == 78) // N
core.stepReplay();
else if (e.keyCode == 84) // T
core.control._replay_toolbox();
else if (e.keyCode == 81) // Q
core.control._replay_equipbox();
else if (e.keyCode == 66) // B
core.ui._drawStatistics();
else if (e.keyCode == 49 || e.keyCode == 54) // 1/6原速/24倍速播放
core.setReplaySpeed(e.keyCode == 49 ? 1 : 24);
else if (e.keyCode > 49 && e.keyCode < 54) { // 2-5录像精修
switch (e.keyCode - 48) {
case 2: // pop
alert("您已移除已录制内容的最后一项:" + core.status.route.pop());
break;
case 3: // push
core.utils.myprompt("请输入您要追加到已录制内容末尾的项:", "", function (value) {
if (value != null) core.status.route.push(value);
});
break;
case 4: // shift
alert("您已移除即将播放内容的第一项:" + core.status.replay.toReplay.shift());
break;
case 5: // unshift
core.utils.myprompt("请输入您要追加到即将播放内容开头的项:", "", function (value) {
if (value != null) core.status.replay.toReplay.unshift(value);
});
}
}
return true;
}
}, 100);
},
"numpad": function () {
// 样板自带的整数输入事件为白屏弹窗且可以误输入任意非法内容但不支持负整数观感较差。本插件可以将其美化成仿RM样式使其支持负整数同时带有音效
// 另一方面4399等第三方平台不允许使用包括 core.myprompt() 和 core.myconfirm() 在内的弹窗,因此也需要此插件来替代,不然类似生命魔杖的道具就不好实现了
// 关于负整数输入V2.8.2原生支持其录像的压缩和解压,只是默认的 core.events._action_input() 函数将负数取了绝对值,可以只复写下面的 core.isReplaying() 部分来取消
// 是否启用本插件false表示禁用true表示启用
var __enable = true;
if (!__enable) return;
core.events._action_input = function (data, x, y, prefix) { // 复写整数输入事件
if (core.isReplaying()) { // 录像回放时,处理方式不变,但增加负整数支持
core.events.__action_getInput(core.replaceText(data.text, prefix), false, function (value) {
value = parseInt(value) || 0; // 去掉了取绝对值的步骤
core.status.route.push("input:" + value);
core.setFlag("input", value);
core.doAction();
});
} else {
// 正常游戏中,采用暂停录制的方式然后用事件流循环“绘制-等待-变量操作”三板斧实现按照13*13适配的
// 您可以自行修改循环内的内容来适配15*15或其他需求或干脆作为公共事件编辑。
core.insertAction([
// 记录当前录像长度,下面的循环结束后裁剪。达到“暂停录制”的效果
{ "type": "function", "function": "function(){flags['@temp@length']=core.status.route.length}" },
{ "type": "setValue", "name": "flag:input", "value": "0" },
{
"type": "while",
"condition": "true",
"data": [
{ "type": "drawBackground", "background": "winskin.png", "x": 16, "y": 16, "width": 384, "height": 384 },
{ "type": "drawIcon", "id": "X10181", "x": 32, "y": 288 },
{ "type": "drawIcon", "id": "X10185", "x": 64, "y": 288 },
{ "type": "drawIcon", "id": "X10186", "x": 96, "y": 288 },
{ "type": "drawIcon", "id": "X10187", "x": 128, "y": 288 },
{ "type": "drawIcon", "id": "X10188", "x": 160, "y": 288 },
{ "type": "drawIcon", "id": "X10189", "x": 192, "y": 288 },
{ "type": "drawIcon", "id": "X10193", "x": 224, "y": 288 },
{ "type": "drawIcon", "id": "X10194", "x": 256, "y": 288 },
{ "type": "drawIcon", "id": "X10195", "x": 288, "y": 288 },
{ "type": "drawIcon", "id": "X10196", "x": 320, "y": 288 },
{ "type": "drawIcon", "id": "X10197", "x": 352, "y": 288 },
{ "type": "drawIcon", "id": "X10286", "x": 32, "y": 352 },
{ "type": "drawIcon", "id": "X10169", "x": 96, "y": 352 },
{ "type": "drawIcon", "id": "X10232", "x": 128, "y": 352 },
{ "type": "drawIcon", "id": "X10185", "x": 320, "y": 352 },
{ "type": "drawIcon", "id": "X10242", "x": 352, "y": 352 },
{ "type": "fillBoldText", "x": 48, "y": 256, "style": [255, 255, 255, 1], "font": "bold 32px Consolas", "text": "${flag:input}" },
{ "type": "fillBoldText", "x": 32, "y": 48, "style": [255, 255, 255, 1], "font": "16px Consolas", "text": core.replaceText(data.text, prefix) },
{
"type": "wait",
"forceChild": true,
"data": [{
"case": "keyboard",
"keycode": "48,49,50,51,52,53,54,55,56,57",
"action": [
// 按下数字键追加到已输入内容的末尾但禁止越界。变量keycode-48就是末位数字
{ "type": "playSound", "name": "光标移动" },
{
"type": "if",
"condition": "(flag:input<0)",
"true": [
{ "type": "setValue", "name": "flag:input", "value": "10*flag:input-(flag:keycode-48)" },
],
"false": [
{ "type": "setValue", "name": "flag:input", "value": "10*flag:input+(flag:keycode-48)" },
]
},
{ "type": "setValue", "name": "flag:input", "value": "core.clamp(flag:input,-9e15,9e15)" },
]
},
{
"case": "keyboard",
"keycode": "189",
"action": [
// 按下减号键,变更已输入内容的符号
{ "type": "playSound", "name": "跳跃" },
{ "type": "setValue", "name": "flag:input", "value": "-flag:input" },
]
},
{
"case": "keyboard",
"keycode": "8",
"action": [
// 按下退格键,从已输入内容的末尾删除一位
{ "type": "playSound", "name": "取消" },
{ "type": "setValue", "name": "flag:input", "operator": "//=", "value": "10" },
]
},
{
"case": "keyboard",
"keycode": "27",
"action": [
// 按下ESC键清空已输入内容
{ "type": "playSound", "name": "读档" },
{ "type": "setValue", "name": "flag:input", "value": "0" },
]
},
{
"case": "keyboard",
"keycode": "13",
"action": [
// 按下回车键,确定
{ "type": "break", "n": 1 },
]
},
{
"case": "mouse",
"px": [32, 63],
"py": [288, 320],
"action": [
// 点击减号变号。右边界写63防止和下面重叠
{ "type": "playSound", "name": "跳跃" },
{ "type": "setValue", "name": "flag:input", "value": "-flag:input" },
]
},
{
"case": "mouse",
"px": [64, 384],
"py": [288, 320],
"action": [
// 点击数字追加到已输入内容的末尾但禁止越界。变量x-2就是末位数字
{ "type": "playSound", "name": "光标移动" },
{
"type": "if",
"condition": "(flag:input<0)",
"true": [
{ "type": "setValue", "name": "flag:input", "value": "10*flag:input-(flag:x-2)" },
],
"false": [
{ "type": "setValue", "name": "flag:input", "value": "10*flag:input+(flag:x-2)" },
]
},
{ "type": "setValue", "name": "flag:input", "value": "core.clamp(flag:input,-9e15,9e15)" },
]
},
{
"case": "mouse",
"px": [32, 64],
"py": [352, 384],
"action": [
// 点击左箭头,退格
{ "type": "playSound", "name": "取消" },
{ "type": "setValue", "name": "flag:input", "operator": "//=", "value": "10" },
]
},
{
"case": "mouse",
"px": [96, 160],
"py": [352, 384],
"action": [
// 点击CE清空
{ "type": "playSound", "name": "读档" },
{ "type": "setValue", "name": "flag:input", "value": "0" },
]
},
{
"case": "mouse",
"px": [320, 384],
"py": [352, 384],
"action": [
// 点击OK确定
{ "type": "break", "n": 1 },
]
}
]
}
]
},
{ "type": "clearMap" },
// 裁剪录像,只保留'input:n',然后继续录制
{ "type": "function", "function": "function(){core.status.route.splice(flags['@temp@length']);core.status.route.push('input:'+core.getFlag('input',0))}" }
], x, y);
core.events.doAction();
}
}
},
"sprites": function () {
// // 基于canvas的sprite化摘编整理自万宁魔塔
// //
// // ---------------------------------------- 第一部分 js代码 (必装) --------------------------------------- //
// /* ---------------- 用法说明 ---------------- *
// * 1. 创建sprite: var sprite = new Sprite(x, y, w, h, z, reference, name);
// * 其中x y w h为画布的横纵坐标及长宽reference为参考系只能填game相对于游戏画面和window相对于窗口
// * 且当为相对游戏画面时长宽与坐标将会乘以放缩比例相当于用createCanvas创建
// * z为纵深表示不同元素之间的覆盖关系大的覆盖小的
// * name为自定义名称可以不填
// * 2. 删除: sprite.destroy();
// * 3. 设置css特效: sprite.setCss(css);
// * 其中css直接填 box-shadow: 0px 0px 10px black;的形式即可与style标签与css文件内写法相同
// * 对于已设置的特效,如果之后不需要再次设置,可以不填
// * 4. 添加事件监听器: sprite.addEventListener(); 用法与html元素的addEventListener完全一致
// * 5. 移除事件监听器: sprite.removeEventListener(); 用法与html元素的removeEventListener完全一致
// * 6. 属性列表
// * (1) sprite.x | sprite.y | sprite.width | sprite.height | sprite.zIndex | sprite.reference 顾名思义
// * (2) sprite.canvas 该sprite的画布
// * (3) sprite.context 该画布的CanvasRenderingContext2d对象即样板中常见的ctx
// * (4) sprite.count 不要改这个玩意
// * 7. 使用样板api进行绘制
// * 示例:
// * var ctx = sprite.context;
// * core.fillText(ctx, 'xxx', 100, 100);
// * core.fillRect(ctx, 0, 0, 50, 50);
// * 当然也可以使用原生js
// * ctx.moveTo(0, 0);
// * ctx.bezierCurveTo(50, 50, 100, 0, 100, 50);
// * ctx.stroke();
// * ---------------- 用法说明 ---------------- */
// var count = 0;
// /** 创建一个sprite画布
// * @param {number} x
// * @param {number} y
// * @param {number} w
// * @param {number} h
// * @param {number} z
// * @param {'game' | 'window'} reference 参考系,游戏画面或者窗口
// * @param {string} name 可选sprite的名称方便通过core.dymCanvas获取
// */
// function Sprite(x, y, w, h, z, reference, name) {
// this.x = x;
// this.y = y;
// this.width = w;
// this.height = h;
// this.zIndex = z;
// this.reference = reference;
// this.canvas = null;
// this.context = null;
// this.count = 0;
// this.name = name || '_sprite_' + count;
// this.style = null;
// /** 初始化 */
// this.init = function () {
// if (reference === 'window') {
// var canvas = document.createElement('canvas');
// this.canvas = canvas;
// this.context = canvas.getContext('2d');
// canvas.width = w;
// canvas.height = h;
// canvas.style.width = w + 'px';
// canvas.style.height = h + 'px';
// canvas.style.position = 'absolute';
// canvas.style.top = y + 'px';
// canvas.style.left = x + 'px';
// canvas.style.zIndex = z.toString();
// document.body.appendChild(canvas);
// this.style = canvas.style;
// } else {
// this.context = core.createCanvas(this.name || '_sprite_' + count, x, y, w, h, z);
// this.canvas = this.context.canvas;
// this.canvas.style.pointerEvents = 'auto';
// this.style = this.canvas.style;
// }
// this.count = count;
// count++;
// }
// this.init();
// /** 设置css特效
// * @param {string} css
// */
// this.setCss = function (css) {
// css = css.replace('\n', ';').replace(';;', ';');
// var effects = css.split(';');
// var self = this;
// effects.forEach(function (v) {
// var content = v.split(':');
// var name = content[0];
// var value = content[1];
// name = name.trim().split('-').reduce(function (pre, curr, i, a) {
// if (i === 0 && curr !== '') return curr;
// if (a[0] === '' && i === 1) return curr;
// return pre + curr.toUpperCase()[0] + curr.slice(1);
// }, '');
// var canvas = self.canvas;
// if (name in canvas.style) canvas.style[name] = value;
// });
// return this;
// }
// /**
// * 移动sprite
// * @param {boolean} isDelta 是否是相对位置如果是那么sprite会相对于原先的位置进行移动
// */
// this.move = function (x, y, isDelta) {
// if (x !== undefined && x !== null) this.x = x;
// if (y !== undefined && y !== null) this.y = y;
// if (this.reference === 'window') {
// var ele = this.canvas;
// ele.style.left = x + (isDelta ? parseFloat(ele.style.left) : 0) + 'px';
// ele.style.top = y + (isDelta ? parseFloat(ele.style.top) : 0) + 'px';
// } else core.relocateCanvas(this.context, x, y, isDelta);
// return this;
// }
// /**
// * 重新设置sprite的大小
// * @param {boolean} styleOnly 是否只修改css效果如果是那么将会不高清如果不是那么会清空画布
// */
// this.resize = function (w, h, styleOnly) {
// if (w !== undefined && w !== null) this.w = w;
// if (h !== undefined && h !== null) this.h = h;
// if (reference === 'window') {
// var ele = this.canvas;
// ele.style.width = w + 'px';
// ele.style.height = h + 'px';
// if (!styleOnly) {
// ele.width = w;
// ele.height = h;
// }
// } else core.resizeCanvas(this.context, w, h, styleOnly);
// return this;
// }
// /**
// * 旋转画布
// */
// this.rotate = function (angle, cx, cy) {
// if (this.reference === 'window') {
// var left = this.x;
// var top = this.y;
// this.canvas.style.transformOrigin = (cx - left) + 'px ' + (cy - top) + 'px';
// if (angle === 0) {
// canvas.style.transform = '';
// } else {
// canvas.style.transform = 'rotate(' + angle + 'deg)';
// }
// } else {
// core.rotateCanvas(this.context, angle, cx, cy);
// }
// return this;
// }
// /**
// * 清除sprite
// */
// this.clear = function (x, y, w, h) {
// if (this.reference === 'window') {
// this.context.clearRect(x, y, w, h);
// } else {
// core.clearMap(this.context, x, y, w, h);
// }
// return this;
// }
// /** 删除 */
// this.destroy = function () {
// if (this.reference === 'window') {
// if (this.canvas) document.body.removeChild(this.canvas);
// } else {
// core.deleteCanvas(this.name || '_sprite_' + this.count);
// }
// }
// /** 添加事件监听器 */
// this.addEventListener = function () {
// this.canvas.addEventListener.apply(this.canvas, arguments);
// }
// /** 移除事件监听器 */
// this.removeEventListener = function () {
// this.canvas.removeEventListener.apply(this.canvas, arguments);
// }
// }
// window.Sprite = Sprite;
},
"hotReload": function () {
/* ---------- ---------- *
1. libs/ main.js index.html 中的任意一个文件被更改后会自动刷新塔的页面
2. 修改楼层文件后自动在塔的页面上显示出来不需要刷新
3. 修改脚本编辑或插件编写后也能自动更新更改的插件或脚本但不保证不会出问题一般都不会有问题的
4. 修改图块属性怪物属性等后会自动更新
5. 当全塔属性被修改时会自动刷新塔的页面
6. 样板的 styles.css 被修改后也可以直接显示不需要刷新
7. 其余内容修改后不会自动更新也不会刷新
/* ---------- 使 ---------- *
1. 前往 https://nodejs.org/en/ 下载node.js的LTS版本点左边那个绿色按钮并安装
2. 将该插件复制到插件编写中
3. 在造塔群的群文件-魔塔样板·改中找到server.js下载并放到塔的根目录与启动服务同一级
4. 在该目录下按下shift+鼠标右键win11只按右键即可选择在终端打开或在powershell打开
5. 运行node server.js即可
*/
if (main.mode !== 'play' || main.replayChecking) return;
/**
* 发送请求
* @param {string} url
* @param {string} type
* @param {string} data
* @returns {Promise<string>}
*/
// async function post(url, type, data) {
// const xhr = new XMLHttpRequest();
// xhr.open(type, url);
// xhr.send(data);
// const res = await new Promise(res => {
// xhr.onload = e => {
// if (xhr.status !== 200) {
// console.error(`hot reload: http ${xhr.status}`);
// res('@error');
// } else res('success');
// };
// xhr.onerror = e => {
// res('@error');
// console.error(`hot reload: error on connection`);
// };
// });
// if (res === 'success') return xhr.response;
// else return '@error';
// }
/**
* 热重载css
* @param {string} data
*/
// function reloadCss(data) {
// const all = Array.from(document.getElementsByTagName('link'));
// all.forEach(v => {
// if (v.rel !== 'stylesheet') return;
// if (v.href === `http://127.0.0.1:3000/${data}`) {
// v.remove();
// const link = document.createElement('link');
// link.rel = 'stylesheet';
// link.type = 'text/css';
// link.href = data;
// document.head.appendChild(link);
// console.log(`css hot reload: ${data}`);
// }
// });
// }
/**
* 热重载楼层
* @param {string} data
*/
// async function reloadFloor(data) {
// // 首先重新加载main.floors对应的楼层
// await import(`/project/floors/${data}.js?v=${Date.now()}`);
// // 然后写入core.floors并解析
// core.floors[data] = main.floors[data];
// const floor = core.loadFloor(data);
// if (core.isPlaying()) {
// core.status.maps[data] = floor;
// delete core.status.mapBlockObjs[data];
// core.extractBlocks(data);
// if (data === core.status.floorId) {
// core.drawMap(data);
// core.setWeather(
// core.animateFrame.weather.type,
// core.animateFrame.weather.level
// );
// }
// core.updateStatusBar(true, true);
// }
// console.log(`floor hot reload: ${data}`);
// }
/**
* 热重载脚本编辑及插件编写
* @param {string} data
*/
// async function reloadScript(data) {
// if (data === 'plugins') {
// // 插件编写比较好办
// const before = plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1;
// // 这里不能用动态导入,因为动态导入会变成模块,变量就不是全局的了
// const script = document.createElement('script');
// script.src = `/project/plugins.js?v=${Date.now()}`;
// document.body.appendChild(script);
// await new Promise(res => {
// script.onload = () => res('success');
// });
// const after = plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1;
// // 找到差异的函数
// for (const id in before) {
// const fn = before[id];
// if (typeof fn !== 'function') continue;
// if (fn.toString() !== after[id]?.toString()) {
// try {
// core.plugin[id] = after[id];
// core.plugin[id].call(core.plugin);
// core.updateStatusBar(true, true);
// console.log(`plugin hot reload: ${id}`);
// } catch (e) {
// console.error(e);
// }
// }
// }
// } else if (data === 'functions') {
// // 脚本编辑略微麻烦点
// const before = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a;
// // 这里不能用动态导入,因为动态导入会变成模块,变量就不是全局的了
// const script = document.createElement('script');
// script.src = `/project/functions.js?v=${Date.now()}`;
// document.body.appendChild(script);
// await new Promise(res => {
// script.onload = () => res('success');
// });
// const after = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a;
// // 找到差异的函数
// for (const mod in before) {
// const fns = before[mod];
// for (const id in fns) {
// const fn = fns[id];
// if (typeof fn !== 'function' || id === 'hasSpecial')
// continue;
// const now = after[mod][id];
// if (fn.toString() !== now.toString()) {
// try {
// if (mod === 'events') {
// core.events.eventdata[id] = now;
// } else if (mod === 'enemys') {
// core.enemys.enemydata[id] = now;
// } else if (mod === 'actions') {
// core.actions.actionsdata[id] = now;
// } else if (mod === 'control') {
// core.control.controldata[id] = now;
// } else if (mod === 'ui') {
// core.ui.uidata[id] = now;
// }
// core.updateStatusBar(true, true);
// console.log(
// `function hot reload: ${mod}.${id}`
// );
// } catch (e) {
// console.error(e);
// }
// }
// }
// }
// }
// }
/**
* 属性热重载包括全塔属性等
* @param {string} data
*/
// async function reloadData(data) {
// const script = document.createElement('script');
// script.src = `/project/${data}.js?v=${Date.now()}`;
// document.body.appendChild(script);
// await new Promise(res => {
// script.onload = () => res('success');
// });
// let after;
// if (data === 'data')
// after = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d;
// if (data === 'enemys')
// after = enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80;
// if (data === 'icons')
// after = icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1;
// if (data === 'items')
// after = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a;
// if (data === 'maps')
// after = maps_90f36752_8815_4be8_b32b_d7fad1d0542e;
// if (data === 'events')
// after = events_c12a15a8_c380_4b28_8144_256cba95f760;
// if (data === 'enemys') {
// core.enemys.enemys = after;
// for (var enemyId in after) {
// core.enemys.enemys[enemyId].id = enemyId;
// }
// core.material.enemys = core.getEnemys();
// } else if (data === 'icons') {
// core.icons.icons = after;
// core.material.icons = core.getIcons();
// } else if (data === 'items') {
// core.items.items = after;
// for (var itemId in after) {
// core.items.items[itemId].id = itemId;
// }
// core.material.items = core.getItems();
// } else if (data === 'maps') {
// core.maps.blocksInfo = after;
// core.status.mapBlockObjs = {};
// core.status.number2block = {};
// Object.values(core.status.maps).forEach(v => delete v.blocks);
// core.extractBlocks();
// core.setWeather(
// core.animateFrame.weather.type,
// core.animateFrame.weather.level
// );
// core.drawMap();
// } else if (data === 'events') {
// core.events.commonEvent = after.commonEvent;
// } else if (data === 'data') {
// location.reload();
// }
// core.updateStatusBar(true, true);
// console.log(`data hot reload: ${data}`);
// }
// 初始化
(async function () {
// const data = await post('/reload', 'POST', 'test');
// if (data === '@error') {
// console.log(`未检测到node服务热重载插件将无法使用`);
// } else {
// console.log(`热重载插件加载成功`);
// // reload
// setInterval(async () => {
// const res = await post('/reload', 'POST');
// if (res === '@error') return;
// if (res === 'true') location.reload();
// else return;
// }, 1000);
// // hot reload
// setInterval(async () => {
// const res = await post('/hotReload', 'POST');
// const data = res.split('@@');
// data.forEach(v => {
// if (v === '') return;
// const [type, file] = v.split(':');
// if (type === 'css') reloadCss(file);
// if (type === 'data') reloadData(file);
// if (type === 'floor') reloadFloor(file);
// if (type === 'script') reloadScript(file);
// });
// }, 1000);
// }
})();
},
"高级动画": function () {
// -------------------- 插件说明 -------------------- //
// github仓库https://github.com/unanmed/animate
// npm包名mutate-animate
// npm地址https://www.npmjs.com/package/mutate-animate
// 不要去尝试读这个插件,这个插件是经过了打包的,不是人类可读的(
// 想读的话可以去github读
// 该插件是一个轻量型多功能动画插件,可以允许你使用内置或自定义的速率曲线或轨迹等
// 除此之外,你还可以自定义绘制函数,来让你的动画可视化
// -------------------- 安装说明 -------------------- //
// 直接复制到插件中即可注意所有插件中不能出现插件名为animate的插件
// 该插件分为动画和渐变两部分,教程分开,动画在前,渐变在后
// -------------------- 动画使用教程 -------------------- //
// 1. 首先创建一个异步函数
// async function ani() { }
// 2. 引入插件中的类和函数,引入内容要看个人需求,所有可用的函数在本插件末尾可以看到
// const { Animation, linear, bezier, circle, hyper, trigo, power, inverseTrigo, shake, sleep } = core.plugin.animate
// 3. 在函数内部创建一个动画
// const animate = new Animation();
// 4. 为动画创建一个绘制函数这里以绘制一个矩形为例当然也可以使用core.fillRect替代ctx.fillRect来绘制矩形
// const ctx = core.createCanvas('animate', 0, 0, 416, 416, 100);
// ctx.save();
// const fn = () => {
// ctx.restore();
// ctx.save();
// ctx.clearRect(0, 0, 800, 800);
// ctx.translate(animate.x, animate.y);
// ctx.rotate(animate.angle * Math.PI / 180);
// const size = animate.size;
// ctx.fillRect(-30 * size, -30 * size, 60 * size, 60 * size);
// }
// animate.ticker.add(fn);
// 5. 执行动画
// 下面先对一些概念进行解释
// 动画分为很多种内置的有move(移动至某一点) rotate(旋转) scale(放缩) moveAs(以指定路径移动) shake(震动)
// 对于不同的动画种类其所对应的属性也不同move moveAs shake均对应x和y这两个属性
// rotate对应anglescale对应size。你也可以自定义属性这个之后会提到
// 除了执行动画之外,这里还提供了三个等待函数,可以等待某个动画执行完毕,以及一个等待指定时长的函数
// 分别是animate.n(等待指定数量的动画执行完毕)
// animate.w(等待指定类型的动画执行完毕,也可以是自定义类型)
// animate.all(等待所有动画执行完毕)
// sleep(等待指定时长)
// 执行动画时,要求一个渐变函数,当然这个插件内置了非常丰富的渐变函数,也就是速率曲线。
// 线性渐变函数 linear(),该函数返回一个线性变化函数
// 三角渐变函数 trigo('sin' | 'sec', EaseMode),该函数返回一个指定属性的三角函数变化函数
// 其中EaseMode可以填'in' 'out' 'in-out' 'center'
// 分别表示 慢-快 快-慢 慢-快-慢 快-慢-快
// 幂函数渐变 power(n, EaseMode)该函数返回一个以x^n变化的函数n是指数
// 双曲渐变函数 hyper('sin' | 'tan' | 'sec', EaseMode),该函数返回一个双曲函数,分别是双曲正弦、双曲正切、双曲正割
// 反三角渐变函数 inverseTrigo('sin' | 'tan', EaseMode),该函数返回一个反三角函数
// 贝塞尔曲线渐变函数 bezier(...cps),参数为贝塞尔曲线的控制点纵坐标(横坐标不能自定义,毕竟一个时刻不能对应多个速率)
// 示例bezier(0.4, 0.2, 0.7); // 三个控制点的四次贝塞尔曲线渐变函数
// 了解完渐变函数以后,这里还有一个特殊的渐变函数-shake
// shake(power, timing),这个函数是一个震荡函数,会让一个值来回变化,实现震动的效果
// 其中power是震动的最大值timing是渐变函数描述了power在震动时大小的变化
// 下面,我们就可以进行动画的执行了,我们以 运动 + 旋转 + 放缩为例
// animate.mode(hyper('sin', 'out')) // 设置渐变函数为 双曲正弦 快 -> 慢,注意不能加分号
// .time(1000) // 设置动画的执行时间为1000毫秒
// .move(300, 300) // 移动至[300, 300]的位置
// .relative() // 设置相对模式为相对之前,与之前为相加的关系
// .mode(power(3, 'center')) // 设置为 x^3 快-慢-快 的渐变函数
// .time(3000)
// .rotate(720) // 旋转720度
// .absolute() // 设置相对模式为绝对
// .mode(trigo('sin', 'in')) // 设置渐变函数为 正弦 慢 -> 快
// .time(1500)
// .scale(3); // 放缩大小至3倍
// 这样,我们就把三种基础动画都执行了一遍,同时,这种写法非常直观,出现问题时也可以很快地找到问题所在
// 下面,我们需要等待动画执行完毕,因为同一种动画不可能同时执行两个
// await animate.n(1); // 等待任意一个动画执行完毕别把await忘了
// await animate.w('scale'); // 等待放缩动画执行完毕
// await animate.all(); // 等待所有动画执行完毕
// await sleep(1000); // 等待1000毫秒
// 下面,还有一个特殊的动画函数-moveAs
// 这是一个非常强大的函数,它允许你让你的物体按照指定路线运动
// 说到这,我们需要先了解一下运动函数。
// 该插件内置了两个运动函数,分别是圆形运动和贝塞尔曲线运动
// 圆形运动 circle(r, n, timing, inverse)r是圆的半径n是圈数timing描述半径大小的变化inverse说明了是否翻转timing函数后面三个可以不填
// 贝塞尔曲线 bezierPath(start, end, ...cps)
// 其中start和end是起点和结束点应当填入[x, y]数组cps是控制点也是[x, y]数组
// 示例bezierPath([0, 0], [200, 200], [100, 50], [300, 150], [200, 180]);
// 这是一个起点为 [0, 0],终点为[200, 200],有三个控制点的四次贝塞尔曲线
// 下面,我们就可以使用路径函数了
// animate.mode(hyper('sin', 'in-out')) // 设置渐变曲线
// .time(5000)
// .relative() // 设置为相对模式,这个比较必要,不然的话很可能出现瞬移
// .moveAs(circle(100, 5, linear())) // 创建一个5圈的半径从0至100逐渐变大的圆轨迹是个螺旋线并让物体沿着它运动
//
// 最后,还有一个震动函数 shake(x, y)x和y表示了在横向上和纵向上的震动幅度1表示为震动幅度的100%
// 示例:
// animate.mode(shake(5, hyper('sin', 'in')), true) // 这里第二个参数说明是震动函数
// .time(2000)
// .shake(1, 0.5)
// 这样,所有内置动画就已经介绍完毕
// 6. 自定义动画属性
// 本插件允许你自定义一个动画属性,但功能可能不会像自带的属性那么强大
// 你可以在创建动画之后使用animate.register(key, init)来注册一个自定义属性
// 其中key是自定义属性的名称init是自定义属性的初始值这个值应当在0-1之间变化
// 你可以通过animate.value[key]来获取你注册的自定义属性
// 对于自定义属性的动画你应当使用animate.apply(key, n, first)
// 其中key是你的自定义属性的名称n是其目标值first是一个布尔值说明了是否将该动画插入到目前所有的动画之前即每帧会优先执行该动画
// 下面是一个不透明度的示例
// animate.register('opacity', 1); // 这句话应该放到刚创建动画之后
// ctx.globalAlpha = animate.value.opacity; // 这句话应当放到每帧绘制的函数里面,放在绘制之前
// animate.mode(bezier(0.9, 0.1, 0.05)) // 设置渐变函数
// .time(2000)
// .absolute()
// .apply('opacity', 0.3); // 将不透明度按照渐变曲线更改为0.3
// 7. 运行动画
// 还记得刚开始定义的async function 吗,直接调用它就能执行动画了!
// 示例ani(); // 执行刚刚写的所有动画
// 8. 自定义速率曲线和路径
// 该插件中,速率曲线和路径均可自定义
// 对于速率曲线,其类型为 (input: number) => number
// 它接受一个范围在 0-1 的值,输出一个 0-1 的值表示了动画的完成度1表示动画已完成0表示动画刚开始当前大于1小于0也不会报错也会执行相应的动画
// 对于路径,其类型为 (input: number) => [number, number]
// 它与速率曲线类似,接收一个 0-1 的值,输出一个坐标数组
// 9. 多个属性绑定
// 该插件中你可以绑定多个动画属性你可以使用ani.bind(...attr)来绑定。
// 绑定之后这三个动画属性可以被一个返回了长度为3的数组的渐变函数执行。
// 绑定使用ani.bind设置渐变函数仍然使用ani.mode注意它与单个动画属性是分开的也就是它不会影响正常的渐变函数。
// 然后使用ani.applyMulti即可执行动画
// 例如:
// // 自定义的一个三属性渐变函数
// function b(input) {
// return [input * 100, input ** 2 * 100, input ** 3 * 100];
// }
// ani.bind('a', 'b', 'c') // 这样会绑定abc这三个动画属性
// .mode(b) // 自定义的一个返回了长度为3的数组的函数
// .time(5000)
// .absolute()
// .applyMulti(); // 执行这个动画
// 9. 监听 动画的生命周期钩子
// 这个插件还允许你去监听动画的状态,可以监听动画的开始、结束、运行
// 你可以使用 animate.listen(type, fn)来监听fn的类型是 (a: Animation, type: string) => void
// 当然,一般情况下你不会用到这个功能,插件中已经帮你包装了三个等待函数,他们就是以这些监听为基础的
// 10. 自定义时间获取函数
// 你可以修改ani.getTime来修改动画的时间获取函数例如想让动画速度变成一半可以写ani.getTime = () => Date.now() / 2
// 这样可以允许你随意控制动画的运行速度,暂停,甚至是倒退。该值默认为`Date.now`
// -------------------- 渐变使用教程 -------------------- //
// 相比于动画,渐变属于一种较为简便的动画,它可以让你在设置一个属性后使属性缓慢变化值目标值而不是突变至目标值
// 现在假设你已经了解了动画的使用,下面我们来了解渐变。
// 1. 创建一个渐变实例
// 与动画类似你需要使用new来实例化一个渐变当然别忘了引入
// const { Transition } = core.plugin.animate;
// const tran = new Transition();
// 2. 绘制
// const ctx = core.createCanvas('transition', 0, 0, 416, 416, 100);
// ctx.save();
// const fn = () => {
// ctx.restore();
// ctx.save();
// ctx.clearRect(0, 0, 800, 800);
// ctx.beginPath();
// ctx.arc(tran.value.x, tran.value.y, 50, 0, Math.PI * 2); // 使用tran.value.xxx获取当前的属性
// ctx.fill();
// // 当然也可以用样板的api例如core.fillCircle();等
// }
// animate.ticker.add(fn);
// 3. 设置渐变
// 同样与动画类似你可以使用tran.time()设置渐变时间使用tran.mode()设置渐变函数使用tran.absolute()和tran.relative()设置相对模式
// 例如:
// tran.time(1000)
// .mode(hyper('sin', 'out'))
// .absolute();
// 4. 初始化渐变属性
// 与动画不同的是动画在执行一个自定义属性前都需要register而渐变不需要。
// 你可以通过tran.value.xxx = yyy来设置动画属性或使用tran.transition('xxx', yyy)来设置
// 你的首次赋值即是初始化了渐变属性,这时是不会执行渐变的,例如:
// tran.value.x = 200;
// tran.transition('y', 200);
// 上述例子便是将 x 和 y 初始化成了200
// 5. 执行渐变
// 初始化完成后,便可以直接执行渐变了,有两种方法
// tran.value.x = 400; // 将 x 缓慢移动至400
// tran.transition('y', 400); // 将 y 缓慢移动至400
// 6. 自定义时间获取函数
// 与动画类似你依然可以通过修改tran.getTime来修改时间获取函数
if (main.replayChecking) return core.plugin.animate = {};
var M = Object.defineProperty;
var E = (n, s, t) => s in n ? M(n, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[s] = t;
var o = (n, s, t) => (E(n, typeof s != "symbol" ? s + "" : s, t), t);
let b = [];
const k = (n) => {
for (const s of b)
if (s.status === "running")
try {
for (const t of s.funcs)
t(n - s.startTime);
} catch (t) {
s.destroy(), console.error(t);
}
requestAnimationFrame(k);
};
requestAnimationFrame(k);
class I {
constructor() {
o(this, "funcs", []);
o(this, "status", "stop");
o(this, "startTime", 0);
this.status = "running", b.push(this), requestAnimationFrame((s) => this.startTime = s);
}
add(s, t = !1) {
return t ? this.funcs.unshift(s) : this.funcs.push(s), this;
}
remove(s) {
const t = this.funcs.findIndex((e) => e === s);
if (t === -1)
/*throw new ReferenceError(
"You are going to remove nonexistent ticker function."
);*/
return this.funcs.splice(t, 1), this;
}
clear() {
this.funcs = [];
}
destroy() {
this.clear(), this.stop();
}
stop() {
this.status = "stop", b = b.filter((s) => s !== this);
}
}
class F {
constructor() {
o(this, "timing");
o(this, "relation", "absolute");
o(this, "easeTime", 0);
o(this, "applying", {});
o(this, "getTime", Date.now);
o(this, "ticker", new I());
o(this, "value", {});
o(this, "listener", {});
this.timing = (s) => s;
}
async all() {
if (Object.values(this.applying).every((s) => s === !0))
throw new ReferenceError("There is no animates to be waited.");
await new Promise((s) => {
const t = () => {
Object.values(this.applying).every((e) => e === !1) && (this.unlisten("end", t), s("all animated."));
};
this.listen("end", t);
});
}
async n(s) {
const t = Object.values(this.applying).filter((i) => i === !0).length;
if (t < s)
throw new ReferenceError(
`You are trying to wait ${s} animate, but there are only ${t} animate animating.`
);
let e = 0;
await new Promise((i) => {
const r = () => {
e++, e === s && (this.unlisten("end", r), i(`${s} animated.`));
};
this.listen("end", r);
});
}
async w(s) {
if (this.applying[s] === !1)
throw new ReferenceError(`The ${s} animate is not animating.`);
await new Promise((t) => {
const e = () => {
this.applying[s] === !1 && (this.unlisten("end", e), t(`${s} animated.`));
};
this.listen("end", e);
});
}
listen(s, t) {
var e, i;
(i = (e = this.listener)[s]) != null || (e[s] = []), this.listener[s].push(t);
}
unlisten(s, t) {
const e = this.listener[s].findIndex((i) => i === t);
if (e === -1)
throw new ReferenceError(
"You are trying to remove a nonexistent listener."
);
this.listener[s].splice(e, 1);
}
hook(...s) {
const t = Object.entries(this.listener).filter(
(e) => s.includes(e[0])
);
for (const [e, i] of t)
for (const r of i)
r(this, e);
}
}
function T(n) {
return n != null;
}
async function R(n) {
return new Promise((s) => setTimeout(s, n));
}
class Y extends F {
constructor() {
super();
o(this, "shakeTiming");
o(this, "path");
o(this, "multiTiming");
o(this, "value", {});
o(this, "size", 1);
o(this, "angle", 0);
o(this, "targetValue", {
system: {
move: [0, 0],
moveAs: [0, 0],
resize: 0,
rotate: 0,
shake: 0,
"@@bind": []
},
custom: {}
});
o(this, "animateFn", {
system: {
move: [() => 0, () => 0],
moveAs: () => 0,
resize: () => 0,
rotate: () => 0,
shake: () => 0,
"@@bind": () => 0
},
custom: {}
});
o(this, "ox", 0);
o(this, "oy", 0);
o(this, "sx", 0);
o(this, "sy", 0);
o(this, "bindInfo", []);
this.timing = (t) => t, this.shakeTiming = (t) => t, this.multiTiming = (t) => [t, t], this.path = (t) => [t, t], this.applying = {
move: !1,
scale: !1,
rotate: !1,
shake: !1
}, this.ticker.add(() => {
const { running: t } = this.listener;
if (T(t))
for (const e of t)
e(this, "running");
});
}
get x() {
return this.ox + this.sx;
}
get y() {
return this.oy + this.sy;
}
mode(t, e = !1) {
return typeof t(0) == "number" ? e ? this.shakeTiming = t : this.timing = t : this.multiTiming = t, this;
}
time(t) {
return this.easeTime = t, this;
}
relative() {
return this.relation = "relative", this;
}
absolute() {
return this.relation = "absolute", this;
}
bind(...t) {
return this.applying["@@bind"] === !0 && this.end(!1, "@@bind"), this.bindInfo = t, this;
}
unbind() {
return this.applying["@@bind"] === !0 && this.end(!1, "@@bind"), this.bindInfo = [], this;
}
move(t, e) {
return this.applying.move && this.end(!0, "move"), this.applySys("ox", t, "move"), this.applySys("oy", e, "move"), this;
}
rotate(t) {
return this.applySys("angle", t, "rotate"), this;
}
scale(t) {
return this.applySys("size", t, "resize"), this;
}
shake(t, e) {
this.applying.shake === !0 && this.end(!0, "shake"), this.applying.shake = !0;
const { easeTime: i, shakeTiming: r } = this, h = this.getTime();
if (this.hook("start", "shakestart"), i <= 0)
return this.end(!1, "shake"), this;
const l = () => {
const c = this.getTime() - h;
if (c > i) {
this.ticker.remove(l), this.applying.shake = !1, this.sx = 0, this.sy = 0, this.hook("end", "shakeend");
return;
}
const a = c / i,
m = r(a);
this.sx = m * t, this.sy = m * e;
};
return this.ticker.add(l), this.animateFn.system.shake = l, this;
}
moveAs(t) {
this.applying.moveAs && this.end(!0, "moveAs"), this.applying.moveAs = !0, this.path = t;
const { easeTime: e, relation: i, timing: r } = this, h = this.getTime(), [l, u] = [this.x, this.y], [c, a] = (() => {
if (i === "absolute")
return t(1); {
const [d, f] = t(1);
return [l + d, u + f];
}
})();
if (this.hook("start", "movestart"), e <= 0)
return this.end(!1, "moveAs"), this;
const m = () => {
const f = this.getTime() - h;
if (f > e) {
this.end(!0, "moveAs");
return;
}
const v = f / e,
[g, w] = t(r(v));
i === "absolute" ? (this.ox = g, this.oy = w) : (this.ox = l + g, this.oy = u + w);
};
return this.ticker.add(m, !0), this.animateFn.system.moveAs = m, this.targetValue.system.moveAs = [c, a], this;
}
register(t, e) {
if (typeof this.value[t] == "number")
return this.error(
`Property ${t} has been regietered twice.`,
"reregister"
);
this.value[t] = e, this.applying[t] = !1;
}
apply(t, e, i = !1) {
this.applying[t] === !0 && this.end(!1, t), t in this.value || this.error(
`You are trying to execute nonexistent property ${t}.`
), this.applying[t] = !0;
const r = this.value[t],
h = this.getTime(),
{ timing: l, relation: u, easeTime: c } = this,
a = u === "absolute" ? e - r : e;
if (this.hook("start"), c <= 0)
return this.end(!1, t), this;
const m = () => {
const f = this.getTime() - h;
if (f > c) {
this.end(!1, t);
return;
}
const v = f / c,
g = l(v);
this.value[t] = r + g * a;
};
return this.ticker.add(m, i), this.animateFn.custom[t] = m, this.targetValue.custom[t] = a + r, this;
}
applyMulti(t = !1) {
this.applying["@@bind"] === !0 && this.end(!1, "@@bind"), this.applying["@@bind"] = !0;
const e = this.bindInfo,
i = e.map((m) => this.value[m]),
r = this.getTime(),
{ multiTiming: h, relation: l, easeTime: u } = this,
c = h(1);
if (c.length !== i.length)
throw new TypeError(
`The number of binded animate attributes and timing function returns's length does not match. binded: ${e.length}, timing: ${c.length}`
);
if (this.hook("start"), u <= 0)
return this.end(!1, "@@bind"), this;
const a = () => {
const d = this.getTime() - r;
if (d > u) {
this.end(!1, "@@bind");
return;
}
const f = d / u,
v = h(f);
e.forEach((g, w) => {
l === "absolute" ? this.value[g] = v[w] : this.value[g] = i[w] + v[w];
});
};
return this.ticker.add(a, t), this.animateFn.custom["@@bind"] = a, this.targetValue.system["@@bind"] = c, this;
}
applySys(t, e, i) {
i !== "move" && this.applying[i] === !0 && this.end(!0, i), this.applying[i] = !0;
const r = this[t],
h = this.getTime(),
l = this.timing,
u = this.relation,
c = this.easeTime,
a = u === "absolute" ? e - r : e;
if (this.hook("start", `${i}start`), c <= 0)
return this.end(!1, i);
const m = () => {
const f = this.getTime() - h;
if (f > c) {
this.end(!0, i);
return;
}
const v = f / c,
g = l(v);
this[t] = r + a * g, t !== "oy" && this.hook(i);
};
this.ticker.add(m, !0), t === "ox" ? this.animateFn.system.move[0] = m : t === "oy" ? this.animateFn.system.move[1] = m : this.animateFn.system[i] = m, i === "move" ? (t === "ox" && (this.targetValue.system.move[0] = a + r), t === "oy" && (this.targetValue.system.move[1] = a + r)) : i !== "shake" && (this.targetValue.system[i] = a + r);
}
error(t, e) {
throw e === "repeat" ? new Error(
`Cannot execute the same animation twice. Info: ${t}`
) : e === "reregister" ? new Error(
`Cannot register an animated property twice. Info: ${t}`
) : new Error(t);
}
end(t, e) {
if (t === !0)
if (this.applying[e] = !1, e === "move" ? (this.ticker.remove(this.animateFn.system.move[0]), this.ticker.remove(this.animateFn.system.move[1])) : e === "moveAs" ? this.ticker.remove(this.animateFn.system.moveAs) : e === "@@bind" ? this.ticker.remove(this.animateFn.system["@@bind"]) : this.ticker.remove(
this.animateFn.system[e]
), e === "move") {
const [i, r] = this.targetValue.system.move;
this.ox = i, this.oy = r, this.hook("moveend", "end");
} else if (e === "moveAs") {
const [i, r] = this.targetValue.system.moveAs;
this.ox = i, this.oy = r, this.hook("moveend", "end");
} else
e === "rotate" ? (this.angle = this.targetValue.system.rotate, this.hook("rotateend", "end")) : e === "resize" ? (this.size = this.targetValue.system.resize, this.hook("resizeend", "end")) : e === "@@bind" ? this.bindInfo.forEach((r, h) => {
this.value[r] = this.targetValue.system["@@bind"][h];
}) : (this.sx = 0, this.sy = 0, this.hook("shakeend", "end"));
else
this.applying[e] = !1, this.ticker.remove(this.animateFn.custom[e]), this.value[e] = this.targetValue.custom[e], this.hook("end");
}
}
class j extends F {
constructor() {
super();
o(this, "now", {});
o(this, "target", {});
o(this, "transitionFn", {});
o(this, "value");
o(this, "handleSet", (t, e, i) => (this.transition(e, i), !0));
o(this, "handleGet", (t, e) => this.now[e]);
this.timing = (t) => t, this.value = new Proxy(this.target, {
set: this.handleSet,
get: this.handleGet
});
}
mode(t) {
return this.timing = t, this;
}
time(t) {
return this.easeTime = t, this;
}
relative() {
return this.relation = "relative", this;
}
absolute() {
return this.relation = "absolute", this;
}
transition(t, e) {
if (e === this.target[t])
return this;
if (!T(this.now[t]))
return this.now[t] = e, this;
this.applying[t] && this.end(t, !0), this.applying[t] = !0, this.hook("start");
const i = this.getTime(),
r = this.easeTime,
h = this.timing,
l = this.now[t],
u = e + (this.relation === "absolute" ? 0 : l),
c = u - l;
this.target[t] = u;
const a = () => {
const d = this.getTime() - i;
if (d >= r) {
this.end(t);
return;
}
const f = d / r;
this.now[t] = h(f) * c + l, this.hook("running");
};
return this.transitionFn[t] = a, r <= 0 ? (this.end(t), this) : (this.ticker.add(a), this);
}
end(t, e = !1) {
const i = this.transitionFn[t];
if (!T(i))
/*throw new ReferenceError(
`You are trying to end an ended transition: ${t}`
);*/
this.ticker.remove(this.transitionFn[t]), delete this.transitionFn[t], this.applying[t] = !1, this.hook("end"), e || (this.now[t] = this.target[t]);
}
}
const x = (...n) => n.reduce((s, t) => s + t, 0),
y = (n) => {
if (n === 0)
return 1;
let s = n;
for (; n > 1;)
n--, s *= n;
return s;
},
A = (n, s) => Math.round(y(s) / (y(n) * y(s - n))),
p = (n, s, t = (e) => 1 - s(1 - e)) => n === "in" ? s : n === "out" ? t : n === "in-out" ? (e) => e < 0.5 ? s(e * 2) / 2 : 0.5 + t((e - 0.5) * 2) / 2 : (e) => e < 0.5 ? t(e * 2) / 2 : 0.5 + s((e - 0.5) * 2) / 2,
$ = Math.cosh(2),
z = Math.acosh(2),
V = Math.tanh(3),
P = Math.atan(5);
function O() {
return (n) => n;
}
function q(...n) {
const s = [0].concat(n);
s.push(1);
const t = s.length,
e = Array(t).fill(0).map((i, r) => A(r, t - 1));
return (i) => {
const r = e.map((h, l) => h * s[l] * (1 - i) ** (t - l - 1) * i ** l);
return x(...r);
};
}
function U(n, s) {
if (n === "sin") {
const t = (i) => Math.sin(i * Math.PI / 2);
return p(s, (i) => 1 - t(1 - i), t);
}
if (n === "sec") {
const t = (i) => 1 / Math.cos(i);
return p(s, (i) => t(i * Math.PI / 3) - 1);
}
throw new TypeError(
"Unexpected parameters are delivered in trigo timing function."
);
}
function C(n, s) {
if (!Number.isInteger(n))
throw new TypeError(
"The first parameter of power timing function only allow integer."
);
return p(s, (e) => e ** n);
}
function G(n, s) {
if (n === "sin")
return p(s, (e) => (Math.cosh(e * 2) - 1) / ($ - 1));
if (n === "tan") {
const t = (i) => Math.tanh(i * 3) * 1 / V;
return p(s, (i) => 1 - t(1 - i), t);
}
if (n === "sec") {
const t = (i) => 1 / Math.cosh(i);
return p(s, (i) => 1 - (t(i * z) - 0.5) * 2);
}
throw new TypeError(
"Unexpected parameters are delivered in hyper timing function."
);
}
function N(n, s) {
if (n === "sin") {
const t = (i) => Math.asin(i) / Math.PI * 2;
return p(s, (i) => 1 - t(1 - i), t);
}
if (n === "tan") {
const t = (i) => Math.atan(i * 5) / P;
return p(s, (i) => 1 - t(1 - i), t);
}
throw new TypeError(
"Unexpected parameters are delivered in inverse trigo timing function."
);
}
function B(n, s = () => 1) {
let t = -1;
return (e) => (t *= -1, e < 0.5 ? n * s(e * 2) * t : n * s((1 - e) * 2) * t);
}
function D(n, s = 1, t = [0, 0], e = 0, i = (h) => 1, r = !1) {
return (h) => {
const l = s * h * Math.PI * 2 + e * Math.PI / 180,
u = Math.cos(l),
c = Math.sin(l),
a = n * i(i(r ? 1 - h : h));
return [a * u + t[0], a * c + t[1]];
};
}
function H(n, s, ...t) {
const e = [n].concat(t);
e.push(s);
const i = e.length,
r = Array(i).fill(0).map((h, l) => A(l, i - 1));
return (h) => {
const l = r.map((c, a) => c * e[a][0] * (1 - h) ** (i - a - 1) * h ** a),
u = r.map((c, a) => c * e[a][1] * (1 - h) ** (i - a - 1) * h ** a);
return [x(...l), x(...u)];
};
}
if ('animate' in core.plugin) throw new ReferenceError(`插件中已存在名为animate的属性`);
core.plugin.animate = {
Animation: Y,
AnimationBase: F,
Ticker: I,
Transition: j,
sleep: R,
circle: D,
bezierPath: H,
linear: O,
bezier: q,
trigo: U,
power: C,
hyper: G,
inverseTrigo: N,
shake: B
}
},
"平滑移动视角": function () {
// ---------- 插件说明 ---------- //
// 该插件允许你能够平滑移动大地图的镜头,达到更好的视觉体验
// 直接复制进插件内即可,注意别忘了安装前置插件,前置插件要放到该插件前面
// ---------- 配置说明 ---------- //
// 你可以在插件的第 60 - 80 行更改平滑移动的信息,包括速率曲线、移动时间等
if (main.replayChecking) return;
const { Transition, hyper } = core.plugin.animate;
function debounce(func, time) {
let timeout = 0;
// @ts-ignore
return (...params) => {
clearTimeout(timeout);
timeout = window.setTimeout(() => {
func(...params);
}, time);
};
}
const tran = new Transition();
tran.value.x = 0;
tran.value.y = 0;
let needSmooth = false;
tran.ticker.add(() => {
if (core.isPlaying() && needSmooth) {
core.setViewport(tran.value.x, tran.value.y);
}
});
const func = debounce(() => {
needSmooth = false;
}, 700);
control.prototype._drawHero_updateViewport = function (x, y, offset) {
const ox = core.clamp(
(x - core._HALF_WIDTH_) * 32 + offset.x,
0,
Math.max(32 * core.bigmap.width - core._PX_, 0)
);
const oy = core.clamp(
(y - core._HALF_HEIGHT_) * 32 + offset.y,
0,
Math.max(32 * core.bigmap.height - core._PY_, 0)
);
if (core.isReplaying()) {
core.bigmap.offsetX = ox;
core.bigmap.offsetY = oy;
core.control.updateViewport();
return;
}
tran.transition('x', ox).transition('y', oy);
if (tran.easeTime > 0) {
needSmooth = true;
func();
} else {
core.setViewport(tran.value.x, tran.value.y);
}
};
let time2 = Date.now();
const origin1 = control.prototype._moveAction_moving;
control.prototype._moveAction_moving = function (...params) {
// 防止瞬移+移动的情况
if (Date.now() - time2 > 30)
tran.mode(hyper('sin', 'out')).time(230).absolute();
return origin1.call(this, ...params);
};
const origin2 = control.prototype.moveDirectly;
control.prototype.moveDirectly = function (...params) {
time2 = Date.now();
tran.mode(hyper('sin', 'out')).time(230).absolute();
return origin2.call(this, ...params);
};
/*const origin3 = events.prototype._changeFloor_beforeChange;
events.prototype._changeFloor_beforeChange = function (...params) {
tran.time(0).absolute();
return origin3.call(this, ...params);
};*/
},
"大地图视角移动修复": function () {
////// 清除地图 //////
ui.prototype.clearMap = function (name, x, y, width, height) {
if (name == 'all') {
for (var m in core.canvas) {
core.canvas[m].clearRect(-32, -32, core.canvas[m].canvas.width + 32, core.canvas[m].canvas.height + 32);
}
core.dom.gif.innerHTML = "";
core.removeGlobalAnimate();
core.deleteCanvas(function (one) { return one.startsWith('_bigImage_'); });
core.setWeather(null);
} else {
var ctx = this.getContextByName(name);
if (ctx) {
if (x != null && y != null && width != null && height != null) {
ctx.clearRect(x, y, width, height);
} else {
if (core.bigmap.v2 && core.bigmap.canvas.indexOf(name) != -1) {
if (ctx.canvas.getAttribute('isHD')) {
const sx = -32 / core.domStyle.scale / devicePixelRatio;
const sy = -32 / core.domStyle.scale / devicePixelRatio;
const width = ctx.canvas.width / core.domStyle.scale / devicePixelRatio;
const height = ctx.canvas.height / core.domStyle.scale / devicePixelRatio;
ctx.clearRect(sx, sy, width, height);
} else {
ctx.clearRect(-32, -32, ctx.canvas.width, ctx.canvas.height);
}
} else {
if (ctx.canvas.getAttribute('isHD')) {
const width = ctx.canvas.width / core.domStyle.scale / devicePixelRatio;
const height = ctx.canvas.height / core.domStyle.scale / devicePixelRatio;
ctx.clearRect(0, 0, width, height);
} else {
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
}
}
}
}
}
}
},
"1-flag初始化": function () {
this.initVariable = function () {
//todo 开局飞行器清掉
console.log("flag初始化完成");
flags.craftGuide11 = {I554 /*橡木木板*/: [["I549","","","",2],], I555 /*白桦木板*/: [["I550","","","",2],], I556 /*云杉木板*/: [["I551","","","",2],], I557 /*丛林木板*/: [["I552","","","",2],], I558 /*金合欢木板*/: [["I553","","","",2],], I560 /*工作台*/: [["I554","I554","I554","I554",1],["I555","I555","I555","I555",1],["I556","I556","I556","I556",1],["I557","I557","I557","I557",1],["I558","I558","I558","I558",1],], I661 /*木棍*/: [["I681","","","",6],["I554","","I554","",4],["I555","","I555","",4],["I556","","I556","",4],["I557","","I557","",4],["I558","","I558","",4],], I684 /*棕色蘑菇块*/: [["I682","I682","I682","I682",1],], I685 /*红色蘑菇块*/: [["I683","I683","I683","I683",1],], I692 /*黄珊瑚块*/: [["I688","I688","I688","I688",2],], I693 /*红珊瑚块*/: [["I689","I689","I689","I689",2],], I694 /*蓝珊瑚块*/: [["I690","I690","I690","I690",2],], I695 /*粉珊瑚块*/: [["I691","I691","I691","I691",2],], I664 /*火把*/: [["I670","","I661","",4],["I523","","I661","",4],], I671 /*皮革*/: [["I672","I672","","",1],], I522 /*羊毛*/: [["I675","I675","I675","I675",1],], I523 /*煤炭*/: [["I535","","","",9],], I621 /*小麦种子*/: [["I625","","","",1],], I622 /*西瓜种子*/: [["I631","","","",1],], };
flags.craftGuide12 = {I527 /*铁锭*/: [["I536","","","",9],], I528 /*铜锭*/: [["I537","","","",9],], I529 /*金锭*/: [["I538","","","",9],["","","","",],], I530 /*红石*/: [["I539","","","",9],], I531 /*青金石*/: [["I540","","","",9],], I616 /*剪刀*/: [["I527","","","I527",1],], I635 /*雕刻南瓜*/: [["I634","I616","","",1],], I666 /*骨粉*/: [["I667","","","",3],], I669 /*金粒*/: [["I529","","","",9],], I671 /*皮革*/: [["I696","I696","I696","I696",1],], I674 /*燧石*/: [["I520","I520","I520","I520",2],], I680 /*糖*/: [["I679","","","",1],], };
flags.craftGuide13 = {I543 /*紫水晶块*/: [["I534","I534","I534","I534",1],], I687 /*干海带*/: [["I686","I686","I686","I686",1],], };
flags.craftGuide14 = {};
flags.craftGuide15 = {I703 /*末影之眼*/: [["I702","I708","","",1],], };
flags.craftGuide16 = {I554 /*橡木木板*/: [["I549","","","",2],], };
flags.craftGuide17 = {};
flags.craftGuide18 = {I554 /*橡木木板*/: [["I549","","","",2],], };
flags.craftGuide19 = {I554 /*橡木木板*/: [["I549","","","",2],], };
flags.craftGuide1a = {I554 /*橡木木板*/: [["I549","","","",2],], };
flags.craftGuide21 = {I554 /*橡木木板*/: [["","","","","I549","","","","",2],], I555 /*白桦木板*/: [["","","","","I550","","","","",2],], I556 /*云杉木板*/: [["","","","","I551","","","","",2],], I557 /*丛林木板*/: [["","","","","I552","","","","",2],], I558 /*金合欢木板*/: [["","","","","I553","","","","",2],], I559 /*箱子*/: [["I554","I554","I554","I554","","I554","I554","I554","I554",1],["I555","I555","I555","I555","","I555","I555","I555","I555",1],["I556","I556","I556","I556","","I556","I556","I556","I556",1],["I557","I557","I557","I557","","I557","I557","I557","I557",1],["I558","I558","I558","I558","","I558","I558","I558","I558",1],], I560 /*工作台*/: [["I554","I554","","I554","I554","","","","",1],["I555","I555","","I555","I555","","","","",1],["I556","I556","","I556","I556","","","","",1],["I557","I557","","I557","I557","","","","",1],["I558","I558","","I558","I558","","","","",1],], I567 /*篝火*/: [["","I661","","I661","I670","I661","I549","I549","I549",1],["","I661","","I661","I670","I661","I550","I550","I550",1],["","I661","","I661","I670","I661","I551","I551","I551",1],["","I661","","I661","I670","I661","I552","I552","I552",1],["","I661","","I661","I670","I661","I553","I553","I553",1],], I569 /*木剑*/: [["","I554","","","I554","","","I661","",1],["","I555","","","I555","","","I661","",1],["","I556","","","I556","","","I661","",1],["","I557","","","I557","","","I661","",1],["","I558","","","I558","","","I661","",1],], I574 /*木斧*/: [["I554","I554","","I554","I661","","","I661","",1],["I555","I555","","I555","I661","","","I661","",1],["I556","I556","","I556","I661","","","I661","",1],["I557","I557","","I557","I661","","","I661","",1],["I558","I558","","I558","I661","","","I661","",1],], I579 /*木镐*/: [["I554","I554","I554","","I661","","","I661","",1],["I555","I555","I555","","I661","","","I661","",1],["I556","I556","I556","","I661","","","I661","",1],["I557","I557","I557","","I661","","","I661","",1],["I558","I558","I558","","I661","","","I661","",1],], I584 /*木锹*/: [["","I554","","","I661","","","I661","",1],["","I555","","","I661","","","I661","",1],["","I556","","","I661","","","I661","",1],["","I557","","","I661","","","I661","",1],["","I558","","","I661","","","I661","",1],], I589 /*木锄*/: [["I554","I554","","","I661","","","I661","",1],["I555","I555","","","I661","","","I661","",1],["I556","I556","","","I661","","","I661","",1],["I557","I557","","","I661","","","I661","",1],["I558","I558","","","I661","","","I661","",1],], I570 /*石剑*/: [["","I515","","","I515","","","I661","",1],], I575 /*石斧*/: [["I515","I515","","I515","I661","","","I661","",1],], I580 /*石镐*/: [["I515","I515","I515","","I661","","","I661","",1],], I585 /*石锹*/: [["","I515","","","I661","","","I661","",1],], I590 /*石锄*/: [["I515","I515","","","I661","","","I661","",1],], I594 /*皮革帽子*/: [["I671","I671","I671","I671","","I671","","","",1],], I595 /*皮革胸甲*/: [["I671","","I671","I671","I671","I671","I671","I671","I671",1],], I596 /*皮革护腿*/: [["I671","I671","I671","I671","","I671","I671","","I671",1],], I597 /*皮革靴子*/: [["","","","I671","","I671","I671","","I671",1],], I598 /*铜头盔*/: [["I528","I528","I528","I528","","I528","","","",1],], I599 /*铜胸甲*/: [["I528","","I528","I528","I528","I528","I528","I528","I528",1],], I600 /*铜护腿*/: [["I528","I528","I528","I528","","I528","I528","","I528",1],], I601 /*铜靴子*/: [["","","","I528","","I528","I528","","I528",1],], I617 /*木盾*/: [["I554","","I554","I554","I554","I554","","I554","",1],["I555","","I555","I555","I555","I555","","I555","",1],["I556","","I556","I556","I556","I556","","I556","",1],["I557","","I557","I557","I557","I557","","I557","",1],["I558","","I558","I558","I558","I558","","I558","",1],], I618 /*铜盾*/: [["I528","","I528","I528","I528","I528","","I528","",1],], I661 /*木棍*/: [["","","","","I681","","","","",6],["","I554","","","I554","","","","",4],["","I555","","","I555","","","","",4],["","I556","","","I556","","","","",4],["","I557","","","I557","","","","",4],[
flags.craftGuide22 = {I527 /*铁锭*/: [["","","","","I536","","","","",9],], I528 /*铜锭*/: [["","","","","I537","","","","",9],], I529 /*金锭*/: [["","","","","I538","","","","",9],["I669","I669","I669","I669","I669","I669","I669","I669","I669",1],], I530 /*红石*/: [["","","","","I539","","","","",9],], I531 /*青金石*/: [["","","","","I540","","","","",9],], I536 /*铁块*/: [["I527","I527","I527","I527","I527","I527","I527","I527","I527",1],], I537 /*铜块*/: [["I528","I528","I528","I528","I528","I528","I528","I528","I528",1],], I538 /*金块*/: [["I529","I529","I529","I529","I529","I529","I529","I529","I529",1],], I539 /*红石块*/: [["I530","I530","I530","I530","I530","I530","I530","I530","I530",1],], I540 /*青金石块*/: [["I531","I531","I531","I531","I531","I531","I531","I531","I531",1],], I571 /*铁剑*/: [["","I527","","","I527","","","I661","",1],], I576 /*铁斧*/: [["I527","I527","","I527","I661","","","I661","",1],], I581 /*铁镐*/: [["I527","I527","I527","","I661","","","I661","",1],], I586 /*铁锹*/: [["","I527","","","I661","","","I661","",1],], I591 /*铁锄*/: [["I527","I527","","","I661","","","I661","",1],], I572 /*金剑*/: [["","I529","","","I529","","","I661","",1],], I577 /*金斧*/: [["I529","I529","","I529","I661","","","I661","",1],], I582 /*金镐*/: [["I529","I529","I529","","I661","","","I661","",1],], I587 /*金锹*/: [["","I529","","","I661","","","I661","",1],], I592 /*金锄*/: [["I529","I529","","","I661","","","I661","",1],], I602 /*铁头盔*/: [["I527","I527","I527","I527","","I527","","","",1],], I603 /*铁胸甲*/: [["I527","","I527","I527","I527","I527","I527","I527","I527",1],], I604 /*铁护腿*/: [["I527","I527","I527","I527","","I527","I527","","I527",1],], I605 /*铁靴子*/: [["","","","I527","","I527","I527","","I527",1],], I606 /*金头盔*/: [["I529","I529","I529","I529","","I529","","","",1],], I607 /*金胸甲*/: [["I529","","I529","I529","I529","I529","I529","I529","I529",1],], I608 /*金护腿*/: [["I529","I529","I529","I529","","I529","I529","","I529",1],], I609 /*金靴子*/: [["","","","I529","","I529","I529","","I529",1],], I614 /*弓*/: [["","I661","I675","I661","","I675","","I661","I675",1],], I615 /*箭*/: [["","I674","","","I661","","","I676","",4],], I616 /*剪刀*/: [["I527","","","","I527","","","","",1],], I635 /*雕刻南瓜*/: [["I634","I616","","","","","","","",1],], I565 /*床*/: [["","","","I522","I522","I522","","","",1],], I568 /*垃圾桶*/: [["I528","I528","I528","I527","","I527","I527","I527","I527",1],], I653 /*钓鱼竿*/: [["I661","","","I675","I661","","I675","","I661",1],], I654 /*桶*/: [["","","","I527","","I527","","I527","",1],], I657 /*时钟*/: [["","I529","","I529","I530","I529","","I529","",1],], I658 /*玻璃瓶*/: [["","","","I518","","I518","","I518","",3],], I665 /*提灯*/: [["","","","","I664","","","I527","",1],], I666 /*骨粉*/: [["","","","","I667","","","","",3],], I667 /*骨头*/: [["","","","I666","I666","I666","","","",1],], I669 /*金粒*/: [["","","","","I529","","","","",9],], I671 /*皮革*/: [["I696","I696","","I696","I696","","","","",1],], I673 /*书*/: [["","","","","","I671","I677","I677","I677",1],], I674 /*燧石*/: [["I520","I520","","I520","I520","","","","",2],], I677 /*纸*/: [["","","","I679","I679","I679","","","",3],], I680 /*糖*/: [["","","","","I679","","","","",1],], };
flags.craftGuide23 = {I541 /*钻石块*/: [["I532","I532","I532","I532","I532","I532","I532","I532","I532",1],], I542 /*绿宝石块*/: [["I533","I533","I533","I533","I533","I533","I533","I533","I533",1],], I543 /*紫水晶块*/: [["I534","I534","","I534","I534","","","","",1],], I573 /*钻石剑*/: [["","I532","","","I532","","","I661","",1],], I578 /*钻石斧*/: [["I532","I532","","I532","I661","","","I661","",1],], I583 /*钻石镐*/: [["I532","I532","I532","","I661","","","I661","",1],], I588 /*钻石锹*/: [["","I532","","","I661","","","I661","",1],], I593 /*钻石锄*/: [["I532","I532","","","I661","","","I661","",1],], I610 /*钻石头盔*/: [["I532","I532","I532","I532","","I532","","","",1],], I611 /*钻石胸甲*/: [["I532","","I532","I532","I532","I532","I532","I532","I532",1],], I612 /*钻石护腿*/: [["I532","I532","I532","I532","","I532","I532","","I532",1],], I613 /*钻石靴子*/: [["","","","I532","","I532","I532","","I532",1],], I619 /*钻石盾*/: [["I532","","I532","I532","I532","I532","","I532","",1],], I564 /*铁砧*/: [["I536","I536","I536","","I536","","I536","I536","I536",1],], I687 /*干海带*/: [["I686","I686","","I686","I686","","","","",1],], I706 /*TNT*/: [["I513","I668","I513","I668","I513","I668","I513","I668","I513",1],], };
flags.craftGuide24 = {I563 /*附魔台*/: [["","I673","","I532","I519","I532","I519","I519","I519",1],], };
flags.craftGuide25 = {I562 /*酿造台*/: [["","I707","","","I515","","I515","I515","I515",1],], I566 /*末影箱*/: [["I519","I519","I519","I519","I703","I519","I519","I519","I519",1],], I629 /*金苹果*/: [["I538","I538","I538","I538","I628","I538","I538","I538","I538",1],], I632 /*闪烁西瓜片*/: [["I529","I529","I529","I529","I631","I529","I529","I529","I529",1],], I633 /*金胡萝卜*/: [["I529","I529","I529","I529","I627","I529","I529","I529","I529",1],], I708 /*烈焰粉*/: [["","","","","I707","","","","",2],], I703 /*末影之眼*/: [["I702","I708","","","","","","","",1],], };
flags.craftGuide26 = {I554 /*橡木木板*/: [["","","","","I549","","","","",2],], };
flags.craftGuide27 = {I629 /*金苹果*/: [["I529","I529","I529","I529","I628","I529","I529","I529","I529",1],], };
flags.craftGuide28 = {I554 /*橡木木板*/: [["","","","","I549","","","","",2],], };
flags.craftGuide29 = {I554 /*橡木木板*/: [["","","","","I549","","","","",2],], };
flags.craftGuide2a = {I554 /*橡木木板*/: [["","","","","I549","","","","",2],], };
flags.weapon = {I569 /*木剑*/: [20, 1, -8, 1, 2, ],I570 /*石剑*/: [50, 2, -8, 1, 2, ],I571 /*铁剑*/: [120, 5, -8, 1, 2, ],I572 /*金剑*/: [60, 4, -8, 1, 2, ],I573 /*钻石剑*/: [480, 10, -8, 1, 2, ],I614 /*弓*/: [150, 4, -34, 3, 3, ],};
flags.tool = {I574 /*木斧*/: [20, 2, 2],I575 /*石斧*/: [50, 3, 2],I576 /*铁斧*/: [120, 4, 2],I577 /*金斧*/: [35, 7, 2],I578 /*钻石斧*/: [480, 5, 2],I579 /*木镐*/: [20, 2, 1],I580 /*石镐*/: [50, 3, 1],I581 /*铁镐*/: [120, 4, 1],I582 /*金镐*/: [35, 7, 1],I583 /*钻石镐*/: [480, 5, 1],I584 /*木锹*/: [20, 2, 3],I585 /*石锹*/: [50, 3, 3],I586 /*铁锹*/: [120, 4, 3],I587 /*金锹*/: [35, 7, 3],I588 /*钻石锹*/: [480, 5, 3],I589 /*木锄*/: [20, 1, 1],I590 /*石锄*/: [50, 1, 1],I591 /*铁锄*/: [120, 1, 1],I592 /*金锄*/: [35, 1, 1],I593 /*钻石锄*/: [480, 1, 1],I653 /*钓鱼竿*/: [60, 1, 1],};
flags.equip = {I617 /*木盾*/: [60, 1],I618 /*铜盾*/: [150, 2],I619 /*钻石盾*/: [525, 3],I595 /*皮革胸甲*/: [85, 1],I599 /*铜胸甲*/: [130, 2],I603 /*铁胸甲*/: [265, 3],I607 /*金胸甲*/: [155, 2],I611 /*钻石胸甲*/: [575, 4],I596 /*皮革护腿*/: [75, 1],I600 /*铜护腿*/: [110, 2],I604 /*铁护腿*/: [230, 2],I608 /*金护腿*/: [135, 2],I612 /*钻石护腿*/: [500, 3],I594 /*皮革帽子*/: [60, 1],I598 /*铜头盔*/: [90, 1],I602 /*铁头盔*/: [180, 2],I606 /*金头盔*/: [110, 1],I610 /*钻石头盔*/: [420, 3],I597 /*皮革靴子*/: [55, 1],I601 /*铜靴子*/: [80, 1],I605 /*铁靴子*/: [165, 2],I609 /*金靴子*/: [95, 1],I613 /*钻石靴子*/: [360, 3],};
flags.wfk = {305: [["I511", 1, 100],],339: [["I511", 1, 100],],340: [["I511", 1, 100],],341: [["I511", 1, 100],],342: [["I512", 1, 100],],343: [["I513", 1, 100],],344: [["I514", 1, 100],],345: [["I746", 1, 0],],346: [["I515", 1, 100],],347: [["I517", 1, 100],],348: [["I746", 1, 0],],349: [["I520", 1, 100],["I674", 1, 10],],350: [["I549", 4, 100],["I544", 2, 70],["I628", 1, 5],],351: [["I550", 4, 100],["I545", 1, 100],["I545", 1, 40],],352: [["I551", 5, 100],["I546", 1, 60],["I546", 1, 60],],353: [["I552", 6, 100],["I547", 1, 50],["I547", 1, 50],],354: [["I553", 4, 100],["I548", 1, 70],["I548", 1, 70],],355: [["I544", 1, 100],],356: [["I545", 1, 100],],357: [["I546", 1, 100],],358: [["I547", 1, 100],],359: [["I548", 1, 100],],360: [["I549", 1, 100],],361: [["I550", 1, 100],],362: [["I551", 1, 100],],363: [["I552", 1, 100],],364: [["I553", 1, 100],],365: [["I554", 1, 100],],366: [["I555", 1, 100],],367: [["I556", 1, 100],],368: [["I557", 1, 100],],369: [["I558", 1, 100],],370: [["I662", 1, 100],],371: [["I663", 1, 100],],372: [["I746", 1, 0],],373: [["I746", 1, 0],],374: [["I638", 1, 100],["I638", 1, 5],],375: [["I639", 1, 100],["I639", 1, 5],],376: [["I678", 1, 100],],377: [["I678", 1, 100],],378: [["I679", 1, 100],["I679", 2, 50],["I679", 2, 50],],379: [["I634", 1, 100],["I705", 1, 10],],380: [["I635", 1, 100],],381: [["I631", 2, 100],["I631", 1, 50],["I705", 1, 10],],382: [["I681", 1, 100],],383: [["I681", 2, 100],["I681", 2, 50],],386: [["I661", 1, 40],["I661", 1, 40],],387: [["I637", 1, 100],["I705", 1, 10],],388: [["I637", 1, 100],["I705", 1000, 100],],389: [["I682", 3, 95],["I682", 5, 50],["I684", 4, 100],],390: [["I683", 3, 95],["I683", 5, 50],["I685", 4, 100],],391: [["I684", 1, 100],],392: [["I685", 1, 100],],393: [["I746", 1, 0],],394: [["I686", 1, 100],["I686", 1, 50],],395: [["I688", 1, 100],["I705", 1, 10],],396: [["I689", 1, 100],["I705", 1, 10],],397: [["I690", 1, 100],["I705", 1, 10],],398: [["I691", 1, 100],["I705", 1, 10],],399: [["I692", 1, 100],],400: [["I693", 1, 100],],401: [["I694", 1, 100],],402: [["I695", 1, 100],],403: [["I523", 1, 100],["I705", 3, 50],["I523", 1, 50],],404: [["I524", 1, 100],["I705", 3, 50],],405: [["I525", 1, 100],["I705", 3, 50],],406: [["I526", 1, 100],["I705", 3, 50],],407: [["I530", 2, 100],["I705", 3, 50],["I530", 1, 50],],408: [["I531", 2, 100],["I705", 3, 50],["I531", 1, 50],],409: [["I532", 1, 100],["I705", 5, 40],],410: [["I533", 1, 100],["I705", 5, 40],],411: [["I534", 2, 100],["I705", 8, 10],["I534", 2, 50],],412: [["I682", 1, 100],],413: [["I683", 1, 100],],414: [["I560", 1, 100],],415: [["I561", 1, 100],],416: [["I562", 1, 100],],417: [["I563", 1, 100],],418: [["I564", 1, 100],],419: [["I565", 1, 100],],420: [["I559", 1, 100],],421: [["I519", 8, 100],],422: [["I567", 1, 100],],423: [["I567", 1, 100],],424: [["I665", 1, 100],],425: [["I568", 1, 100],],426: [["I511", 1, 100],],427: [["I631", 1, 100],["I631", 1, 50],["I631", 1, 50],],428: [["I621", 1, 100],],429: [["I623", 1, 100],],430: [["I627", 1, 100],],431: [["I636", 1, 100],],432: [["I746", 1, 0],],433: [["I746", 1, 0],],896: [["I519", 1, 100],],897: [["I727", 1, 100],],898: [["I522", 1, 100],],899: [["I535", 1, 100],],900: [["I536", 1, 100],],901: [["I537", 1, 100],],902: [["I538", 1, 100],],903: [["I539", 1, 100],],904: [["I540", 1, 100],],905: [["I541", 1, 100],],906: [["I542", 1, 100],],907: [["I746", 1, 0],],908: [["I746", 1, 0],],909: [["I746", 1, 0],],910: [["I746", 1, 0],],911: [["I746", 1, 0],],912: [["I746", 1, 0],],913: [["I746", 1, 0],],914: [["I746", 1, 0],],915: [["I746", 1, 0],],916: [["I515", 1, 100],],917: [["I746", 1, 0],],918: [["I625", 4, 100],["I621", 3, 100],["I705", 1, 20],],919: [["I623", 1, 100],["I623", 2, 60],["I705", 1, 20],],920: [["I627", 2, 100],["I627", 2, 60],["I705", 1, 20],],921: [["I511", 1, 100],],928: [["I521", 1, 100],],926: [["I721", 1, 100],],922: [["I722", 1, 100],],923: [["I723", 1, 100],],927: [["I724", 1, 90],],924: [["I725", 1, 100],],925: [["I726", 1, 100],],929: [["I728", 1, 100],],930: [["I729", 1, 100],],};
flags.ffk = {I512: [[342], [1, 1, 1], [0]], I513: [[343], [1, 1, 1], [0]], I514: [[344], [1, 1, 1], [0]], I515: [[916], [1, 1, 1], [0]], I516: [[346], [1, 1, 1], [0]], I517: [[347], [1, 1, 1], [0]], I520: [[349], [1, 1, 1], [0]], I544: [[355], [0, 1, 0], [1,305,339,340,341,921]], I545: [[356], [0, 1, 0], [1,305,339,340,341,921]], I546: [[357], [0, 1, 0], [1,305,339,340,341,921]], I547: [[358], [0, 1, 0], [1,305,339,340,341,921]], I548: [[359], [0, 1, 0], [1,305,339,340,341,921]], I549: [[360], [1, 1, 1], [0]], I550: [[361], [1, 1, 1], [0]], I551: [[362], [1, 1, 1], [0]], I552: [[363], [1, 1, 1], [0]], I553: [[364], [1, 1, 1], [0]], I554: [[365], [1, 1, 1], [0]], I555: [[366], [1, 1, 1], [0]], I556: [[367], [1, 1, 1], [0]], I557: [[368], [1, 1, 1], [0]], I558: [[369], [1, 1, 1], [0]], I662: [[370], [0, 1, 0], [3,345,348]], I663: [[371], [0, 1, 0], [0]], I638: [[374], [0, 1, 0], [1,305,339,340,341,921]], I639: [[375], [0, 1, 0], [1,305,339,340,341,921]], I678: [[376], [0, 1, 0], [0]], I634: [[379], [0, 1, 0], [0]], I635: [[380], [0, 1, 0], [0]], I681: [[382], [0, 1, 0], [1,305,339,340,341,921]], I637: [[387], [0, 1, 0], [1,343,344]], I684: [[391], [1, 1, 1], [0]], I685: [[392], [1, 1, 1], [0]], I688: [[395], [0, 1, 0], [1,345,348]], I689: [[396], [0, 1, 0], [1,345,348]], I690: [[397], [0, 1, 0], [1,345,348]], I691: [[398], [0, 1, 0], [1,345,348]], I692: [[399], [1, 1, 1], [0]], I693: [[400], [1, 1, 1], [0]], I694: [[401], [1, 1, 1], [0]], I695: [[402], [1, 1, 1], [0]], I543: [[411], [1, 1, 1], [0]], I682: [[412], [0, 1, 0], [1,347]], I683: [[413], [0, 1, 0], [1,347]], I560: [[414], [0, 1, 0], [0]], I561: [[415], [0, 1, 0], [0]], I562: [[416], [0, 1, 0], [0]], I563: [[417], [0, 1, 0], [0]], I564: [[418], [0, 1, 0], [0]], I565: [[419], [0, 1, 0], [0]], I559: [[420], [0, 1, 0], [0]], I566: [[421], [0, 1, 0], [0]], I567: [[423], [0, 1, 0], [0]], I665: [[424], [0, 1, 0], [0]], I568: [[425], [0, 1, 0], [0]], I622: [[427], [0, 1, 0], [1,426]], I621: [[428], [0, 1, 0], [1,426]], I623: [[429], [0, 1, 0], [1,426]], I627: [[430], [0, 1, 0], [1,426]], I518: [[433], [1, 1, 1], [0]], I519: [[896], [1, 1, 1], [0]], I521: [[928], [1, 1, 1], [0]], I522: [[898], [1, 1, 1], [0]], I535: [[899], [1, 1, 1], [0]], I536: [[900], [1, 1, 1], [0]], I537: [[901], [1, 1, 1], [0]], I538: [[902], [1, 1, 1], [0]], I539: [[903], [1, 1, 1], [0]], I540: [[904], [1, 1, 1], [0]], I541: [[905], [1, 1, 1], [0]], I542: [[906], [1, 1, 1], [0]], I511: [[921], [1, 1, 1], [6]], I655: [[348], [1, 0, 1], [7]], I666: [[372], [0, 1, 0], [8]], I589: [[426], [1, 0, 0], [5]], I590: [[426], [1, 0, 0], [5]], I591: [[426], [1, 0, 0], [5]], I592: [[426], [1, 0, 0], [5]], I593: [[426], [1, 0, 0], [5]], I721: [[926], [1, 1, 1], [0]], I722: [[922], [1, 1, 1], [0]], I723: [[923], [1, 1, 1], [0]], I724: [[927], [1, 1, 1], [0]], I725: [[924], [1, 1, 1], [0]], I726: [[925], [1, 1, 1], [0]], I727: [[897], [1, 1, 1], [0]], I728: [[929], [1, 1, 1], [0]], I729: [[930], [1, 1, 1], [0]], };
flags.fuelGuide = {I522 /*羊毛*/: [5],I661 /*木棍*/: [5],I701 /*凝胶*/: [5],I549 /*橡木原木*/: [9],I550 /*白桦原木*/: [9],I551 /*云杉原木*/: [9],I552 /*丛林原木*/: [9],I553 /*金合欢原木*/: [9],I554 /*橡木木板*/: [9],I555 /*白桦木板*/: [9],I556 /*云杉木板*/: [9],I557 /*丛林木板*/: [9],I558 /*金合欢木板*/: [9],I687 /*干海带*/: [9],I670 /*木炭*/: [24],I523 /*煤炭*/: [24],I535 /*煤炭块*/: [240],};
flags.furGuide = {I513 /*沙子-玻璃*/: ["I518"],I514 /*红沙-玻璃*/: ["I518"],I515 /*圆石-石头*/: ["I516"],I524 /*粗铁-铁锭*/: ["I527"],I525 /*粗铜-铜锭*/: ["I528"],I526 /*粗金-金锭*/: ["I529"],I549 /*橡木原木-木炭*/: ["I670"],I550 /*白桦原木-木炭*/: ["I670"],I551 /*云杉原木-木炭*/: ["I670"],I552 /*丛林原木-木炭*/: ["I670"],I553 /*金合欢原木-木炭*/: ["I670"],I640 /*生鸡肉-熟鸡肉*/: ["I641"],I642 /*生羊肉-熟羊肉*/: ["I643"],I644 /*生牛肉-熟牛排*/: ["I645"],I646 /*生兔肉-熟兔肉*/: ["I647"],I648 /*生鳕鱼-熟鳕鱼*/: ["I649"],I650 /*生鲑鱼-熟鲑鱼*/: ["I651"],I655 /*水桶-桶*/: ["I654"],I659 /*水瓶-玻璃瓶*/: ["I658"],I667 /*骨头-骨粉*/: ["I666"],I639 /*玫瑰-糖*/: ["I680"],I679 /*甘蔗-糖*/: ["I680"],I686 /*海带-干海带*/: ["I687"],I696 /*腐肉-皮革*/: ["I671"],};
flags.cropslist = {I544 /*橡树树苗*/: [4500,[355,350],[305,339,340,341,921]],I545 /*白桦树苗*/: [4500,[356,351],[305,339,340,341,921]],I546 /*云杉树苗*/: [5500,[357,352],[305,339,340,341,921]],I547 /*丛林树苗*/: [6500,[358,353],[305,339,340,341,921]],I548 /*金合欢树苗*/: [4500,[359,354],[305,339,340,341,921]],I621 /*小麦种子*/: [3000,[428,918],[426]],I622 /*西瓜种子*/: [3000,[427,381],[426]],I623 /*马铃薯*/: [3000,[429,919],[426]],I627 /*胡萝卜*/: [3000,[430,920],[426]],I682 /*棕色蘑菇*/: [4500,[412,389],[347]],I683 /*红色蘑菇*/: [4500,[413,390],[347]],I681 /*竹子*/: [4500,[382,383],[305,339,340,341,921]],};
flags.enemyGuide = {E1:[[0.6,0.6,0.8,85,80,1,5,0,0.8,0.8,1],["I701",[1,1],40],[]],E5:[[0.5,0.7,0.9,85,80,1,5,0,0.8,0.8,1],["I701",[1,1],40],[]],E9:[[0.8,0.9,1,74,78,1,7,0,1,1,0],["I696",[1,1],30],["I527",[1,1],4]],E13:[[0.8,0.9,1,76,78,1,7,0,1,1,0],["I696",[1,1],30],["I529",[1,1],3]],E17:[[0.8,0.9,1,74,78,1,8,0,1,1,0],["I696",[1,1],30],["I528",[1,1],5]],E21:[[0.5,0.8,0.9,60,78,3,8,0,1,1,0],["I667",[1,1],30],["I614",[1,1],10]],E25:[[0.5,2,0,70,78,1,5,0,1,1,0],["I668",[1,1],30],[]],E29:[[0.7,1.5,0,75,76,2,5,1,1.6,1.6,0],["I668",[1,2],100],[]],E33:[[0.8,0.9,1,80,84,1,8,0,1,1,1],["I675",[1,2],40],[]],E37:[[1.2,1.2,1.4,70,96,1,10,0,1.6,1.6,1],["I702",[1,1],20],[]],E41:[[0.8,0.8,0.7,81,92,1,6,0,0.8,0.8,1],["I671",[1,2],40],[]],E45:[[0.7,0.1,0.8,74,80,2,6,1,1,1,0],["I648",[1,1],40],[]],E53:[[1,1.1,1.2,82,98,1,10,0,1.2,1.2,0],["I700",[1,1],30],["I676",[1,1],40]],E57:[[0.8,0.7,1,65,84,2,7,0,1,1,0],["I533",[1,1],40],["I614",[1,1],10]],E61:[[2,0.4,1.6,45,80,3,8,1,2.5,2.5,0],["I533",[1,1],40],["I620",[1,1],100]],E65:[[0.3,0.1,0.3,90,100,1,14,1,0,0,0],[],[]],E69:[[1,1,1,68,88,1,7,0,1,1,0],["I533",[1,1],40],["I576",[1,1],10]],E73:[[2.2,1.2,1.8,50,50,1,9,0,1.2,1.2,0],["I533",[1,1],40],[]],};
flags.tech2 = {灵感: [["解锁铁、金合成表","解锁红石科技、钻石合成表","解锁附魔、下界合成表","解锁酿造、下界合金合成表","解锁灼热科技","解锁末地合成表","解锁虚空科技","解锁更多的虚空科技","解锁更多的虚空科技",],["解锁铁、金合成表","解锁红石科技、钻石合成表","解锁附魔、下界合成表","解锁酿造、下界合金合成表","解锁灼热科技","解锁末地合成表","解锁虚空科技","解锁更多的虚空科技","解锁更多的虚空科技",],["","","","","","","","","",],["解锁更多的合成配方"]],领悟: [["打怪经验+1","打怪经验+2","打怪经验+3","打怪经验+4","打怪经验+5","打怪经验+6","打怪经验+7","打怪经验+8","打怪经验+9","打怪经验+10",],["打怪经验+1","打怪经验+1 -> 打怪经验+2","打怪经验+2 -> 打怪经验+3","打怪经验+3 -> 打怪经验+4","打怪经验+4 -> 打怪经验+5","打怪经验+5 -> 打怪经验+6","打怪经验+6 -> 打怪经验+7","打怪经验+7 -> 打怪经验+8","打怪经验+8 -> 打怪经验+9","打怪经验+9 -> 打怪经验+10",],["","","","","","","","","","",],["每一次战斗都一场修行,使你能从中吸收更多的经验"]],生命之力: [["基础生命上限+4","基础生命上限+8","基础生命上限+12","基础生命上限+18","基础生命上限+24","基础生命上限+30","基础生命上限+36","基础生命上限+44","基础生命上限+52","基础生命上限+60",],["基础生命上限+4","基础生命上限+4 -> 基础生命上限+8","基础生命上限+8 -> 基础生命上限+12","基础生命上限+12 -> 基础生命上限+18","基础生命上限+18 -> 基础生命上限+24","基础生命上限+24 -> 基础生命上限+30","基础生命上限+30 -> 基础生命上限+36","基础生命上限+36 -> 基础生命上限+44","基础生命上限+44 -> 基础生命上限+52","基础生命上限+52 -> 基础生命上限+60",],["","","","","","","","","","",],["使你的生命力得到强化"]],增幅: [["基础攻击+1","基础攻击+2","基础攻击+4","基础攻击+6","基础攻击+9","基础攻击+12","基础攻击+16","基础攻击+20","基础攻击+24","基础攻击+28",],["基础攻击+1","基础攻击+1 -> 基础攻击+2","基础攻击+2 -> 基础攻击+4","基础攻击+4 -> 基础攻击+6","基础攻击+6 -> 基础攻击+9","基础攻击+9 -> 基础攻击+12","基础攻击+12 -> 基础攻击+16","基础攻击+16 -> 基础攻击+20","基础攻击+20 -> 基础攻击+24","基础攻击+24 -> 基础攻击+28",],["","","","","","","","","","",],["激发内在的力量,提高你的攻击力"]],坚定: [["基础防御+1","基础防御+2","基础防御+3","基础防御+4","基础防御+5","基础防御+6","基础防御+7","基础防御+8","基础防御+9","基础防御+10",],["基础防御+1","基础防御+1 -> 基础防御+2","基础防御+2 -> 基础防御+3","基础防御+3 -> 基础防御+4","基础防御+4 -> 基础防御+5","基础防御+5 -> 基础防御+6","基础防御+6 -> 基础防御+7","基础防御+7 -> 基础防御+8","基础防御+8 -> 基础防御+9","基础防御+9 -> 基础防御+10",],["","","","","","","","","","",],["使你能够抵御更强大的攻击"]],敏捷: [["基础攻速+1","基础攻速+2","基础攻速+3","基础攻速+4","基础攻速+5","基础攻速+6","基础攻速+7","基础攻速+8","基础攻速+9","基础攻速+10",],["基础攻速+1","基础攻速+1 -> 基础攻速+2","基础攻速+2 -> 基础攻速+3","基础攻速+3 -> 基础攻速+4","基础攻速+4 -> 基础攻速+5","基础攻速+5 -> 基础攻速+6","基础攻速+6 -> 基础攻速+7","基础攻速+7 -> 基础攻速+8","基础攻速+8 -> 基础攻速+9","基础攻速+9 -> 基础攻速+10",],["","","","","","","","","","",],["提升攻击速度,让你在战斗中更加灵活"]],耐力: [["饱食度上限+10","饱食度上限+20","饱食度上限+30","饱食度上限+40","饱食度上限+50","饱食度上限+60","饱食度上限+70","饱食度上限+80","饱食度上限+90","饱食度上限+100",],["饱食度上
flags.tech3 = {灵感: [[0,0,0,0,0,0,0,8,9,],[0,0,0,0,0,0,0,5280,6210,],[2,3,4,5,6,7,8,8,8,]],领悟: [[1,2,3,4,5,6,7,8,9,10,],[420,900,1440,2040,2700,3420,4200,5040,5940,6900,],[1,2,3,4,5,6,7,7,8,]],生命之力: [[1,2,3,4,5,6,7,8,9,10,],[420,900,1440,2040,2700,3420,4200,5040,5940,6900,],[1,1,2,3,4,5,6,7,8,]],增幅: [[1,2,3,4,5,6,7,8,9,10,],[420,900,1440,2040,2700,3420,4200,5040,5940,6900,],[1,1,2,3,4,5,6,7,8,]],坚定: [[1,2,3,4,5,6,7,8,9,10,],[420,900,1440,2040,2700,3420,4200,5040,5940,6900,],[1,1,2,3,4,5,6,7,8,]],敏捷: [[1,2,3,4,5,6,7,8,9,10,],[420,810,1290,1830,2430,3070,3780,4530,5340,6210,],[1,1,2,3,4,5,6,7,8,]],耐力: [[1,1,2,2,3,4,5,6,7,8,],[420,450,960,1020,1620,2280,3000,3780,4620,5520,],[1,1,2,3,4,5,6,7,8,]],空间扩展: [[1,1,1,2,2,2,3,3,3,],[420,480,510,1080,1140,1200,1890,1980,2070,],[1,1,1,2,2,2,3,3,3,]],守护之韧: [[1,1,2,2,3,4,5,6,7,8,],[420,450,960,1020,1620,2280,3000,3780,4620,5520,],[1,1,2,3,4,5,6,7,8,]],锋锐恒久: [[1,1,2,2,3,4,5,6,7,8,],[420,450,960,1020,1620,2280,3000,3780,4620,5520,],[1,1,2,3,4,5,6,7,8,]],生机: [[1,1,1,2,2,2,3,3,4,4,],[420,450,480,1020,1080,1140,1800,1890,2640,2760,],[1,1,1,2,2,2,3,3,4,]],商贾之道: [[1,2,3,4,5,6,7,8,9,10,],[420,900,1440,2040,2700,3420,4200,5040,5940,6900,],[1,1,2,3,4,5,6,7,8,]],};
flags.digLevel = {1: {1:[[6],[9],[-1],[-1],[-1]],2:[[5],[7],[9],[-1],[-1]],3:[[4],[6],[8],[-1],[-1]],4:[[3],[5],[7],[10],[-1]],5:[[2],[4],[6],[9],[12]],6:[[2],[3],[5],[8],[10]],7:[[1],[2],[4],[-1],[-1]]},2: {1:[[5],[8],[-1]],2:[[5],[7],[10]],3:[[4],[6],[9]],4:[[3],[5],[8]],5:[[2],[4],[7]],6:[[2],[3],[6]],7:[[1],[2],[4]]},3: {1:[[4],[6]],2:[[4],[5]],3:[[3],[4]],4:[[3],[3]],5:[[2],[2]],6:[[2],[2]],7:[[1],[1]]},4: [1],5: [6],6: [-1],};
flags.quality = {I511: 1, I512: 1, I513: 1, I514: 1, I515: 1, I516: 1, I517: 1, I518: 1, I519: 1, I520: 1, I521: 1, I522: 1, I523: 1, I524: 1, I525: 1, I526: 1, I527: 1, I528: 1, I529: 1, I530: 1, I531: 1, I532: 1, I533: 1, I534: 1, I535: 1, I536: 1, I537: 1, I538: 1, I539: 1, I540: 1, I541: 1, I542: 1, I543: 1, I544: 1, I545: 1, I546: 1, I547: 1, I548: 1, I549: 1, I550: 1, I551: 1, I552: 1, I553: 1, I554: 1, I555: 1, I556: 1, I557: 1, I558: 1, I559: 1, I560: 1, I561: 1, I562: 1, I563: 1, I564: 1, I565: 1, I566: 1, I567: 1, I568: 1, I569: 3, I570: 3, I571: 3, I572: 3, I573: 3, I574: 3, I575: 3, I576: 3, I577: 3, I578: 3, I579: 3, I580: 3, I581: 3, I582: 3, I583: 3, I584: 3, I585: 3, I586: 3, I587: 3, I588: 3, I589: 3, I590: 3, I591: 3, I592: 3, I593: 3, I594: 3, I595: 3, I596: 3, I597: 3, I598: 3, I599: 3, I600: 3, I601: 3, I602: 3, I603: 3, I604: 3, I605: 3, I606: 3, I607: 3, I608: 3, I609: 3, I610: 3, I611: 3, I612: 3, I613: 3, I614: 3, I615: 1, I616: 1, I617: 3, I618: 3, I619: 3, I620: 2, I621: 1, I622: 1, I623: 1, I624: 1, I625: 1, I626: 1, I627: 1, I628: 1, I629: 3, I630: 4, I631: 1, I632: 1, I633: 1, I634: 1, I635: 1, I636: 1, I637: 1, I638: 1, I639: 1, I640: 1, I641: 1, I642: 1, I643: 1, I644: 1, I645: 1, I646: 1, I647: 1, I648: 1, I649: 1, I650: 1, I651: 1, I652: 1, I653: 1, I654: 1, I655: 1, I656: 1, I657: 1, I658: 1, I659: 1, I660: 1, I661: 1, I662: 1, I663: 1, I664: 1, I665: 1, I666: 1, I667: 1, I668: 1, I669: 1, I670: 1, I671: 1, I672: 1, I673: 1, I674: 1, I675: 1, I676: 1, I677: 1, I678: 1, I679: 1, I680: 1, I681: 1, I682: 1, I683: 1, I684: 1, I685: 1, I686: 1, I687: 1, I688: 1, I689: 1, I690: 1, I691: 1, I692: 1, I693: 1, I694: 1, I695: 1, I696: 1, I697: 1, I698: 1, I699: 1, I700: 1, I701: 1, I702: 1, I703: 1, I704: 1, I705: 1, I706: 1, I707: 1, I708: 1, I709: 2, I710: 1, I711: 1, I712: 1, I713: 1, I714: 1, I715: 1, I716: 1, }
flags.structure = {水井:[[897,0,897],[0,0,0],[897,0,897],], 村庄小屋:[[360,360,360,360,360,],[360,414,424,419,360,],[360,0,0,0,360,],[360,415,0,420,360,],[360,360,371,360,360,],], 村庄农田:[[360,360,360,360,360,],[360,918,0,918,360,],[360,919,0,918,360,],[360,920,0,918,360,],[360,360,360,360,360,],], 村庄铁匠铺:[[916,360,360,360,360,360,360,916,],[360,0,0,0,0,0,0,360,],[360,0,420,0,0,0,0,360,],[916,916,916,916,360,0,0,360,],[916,0,0,916,360,0,0,360,],[916,916,916,415,360,371,371,360,],], 雪屋:[[373,342,342,342,342,342,375,],[342,342,342,342,342,342,342,],[342,342,414,0,419,342,342,],[342,342,0,0,0,342,342,],[342,342,424,0,415,342,342,],[372,342,342,0,342,342,372,],[0, 0,342,371,342, 0,0,],], 前哨站:[[0,916,362,362,362,0,362,362,362,916,0,],[916,362,424,0,362,362,362,0,424,362,916,],[362,0,362,0,0,0,0,0,362,0,362,],[362, 0, 0, 0, 0, 0, 0, 0, 0, 0,362,],[362,362,0,0,916,916,916,0,0,362,362,],[0,362,0,0,916,420,916,0,0,362,0,],[362,362,0,0,916,916,916,0,0,362,362,],[362,0,0,0,0,0,0,0,0,0,362,],[362,0,362,0,0,0,0,0,362,0,362,],[916,362,424,0,362,362,362,0,424,362,916,],[0,916,362,362,362,0,362,362,362,916,0,],], 沉船:[[0,0,0,0,365,365,365,365,365,365,365,365,365,365,365,365,365,365,0,0,0,0,],[0,365,365,365,365,365,367,367,367,367,367,365,367,367,367,367,367,367,365,365,365,365,0,0,0,0,0,],[365,365,365,365,365,365,367,362,362,362,367,367,367,362,360,420,362,367,367,367,367,367,365,365,365,0,0,],[365,365,365,365,365,365,367,360,362,360,362,360,362,362,362,362,360,367,367,367,367,367,367,367,367,367,367,],[365,365,365,365,365,365,367,360,420,362,367,367,367,360,360,362,362,367,367,367,367,367,365,365,365,0,0,],[0,365,365,365,365,365,367,367,367,367,367,365,367,367,367,367,367,367,365,365,365,365,0,0,0,0,0,],[0,0,0,0,365,365,365,365,365,365,365,365,365,365,365,365,365,365,0,0,0,0,],], 废墟:[[],], 岩浆池:[[],], 废弃传送门:[[],], 沙漠神殿:[[0,0,0,0,0,897,897,897,897,897,897,897,897,897,897,897,897,897,897,897,897,897,0,0,0,0,0],[0,0,0,0,0,897,897,897,897,897,897,897,897,897,897,897,897,897,897,897,897,897,0,0,0,0,0],[0,0,0,0,0,897,897,0,0,0,0,0,0,0,0,0,0,0,0,0,897,897,0,0,0,0,0],[0,0,0,0,0,897,897, 0,897,897,897,897,897, 897,897,897,897,897,897,0,897,897,0,0,0,0,0 ],[0,0,0,0,0,897,897,0,897,0,0,0,0,0,0,0,0,0,897,0,897,897,0,0,0,0,0 ],[0,0,0,0,0,897,897,0,897, 0,897,897,897, 928,897,897,897,0,897,0,897,897,0,0,0,0,0 ],[0,0,0,0,0,897,897,0,897,0,897,0,0,0,0,0,897,0,897,0,897,897,0,0,0,0,0 ],[0,0,0,0,0,897,897,0,897,0,897,0,897,928,897,0,897,0,897,0,897,897,0,0,0,0,0 ],[0,0,0,0,0,897,897,0,928,0,897,0,928,89,928,0,897,0,928,0,897,897,0,0,0,0, ],[0,0,897,897,897,897,897,0,897,0,897,0,897,928,897,0,897,0,897,0,897,897,897,897,897,0,0 ],[0,0,897,897,897,897,897,0,897,0,897,0,0,0,0,0,897,0,897,0,897,897,897,897,897,0,0 ],[0,897,897,897,897,897,897,0,897,0,897,897,897,928,897,897,897,0,897,0,897,897,897,897,897,897,0 ],[897,897,925,925,925,897,897,0,897,0,0,0,0,0,0,0,0,0,897,0,897,897,925,925,925,897,897 ],[897,897,925,897,925,897,897,0,897,897,897,897,897,897,897,897,897,897,897,0,897,897,925,897,925,897,897 ],[897,897,897,925,897,897,897,0,0,0,0,0,0,0,0,0,0,0,0,0,897,897,897,925,897,897,897 ],[897,897,925,897,925,897,897,897,897,897,897,897,925,928,925,897,897,897,897,897,897,897,925,897,925,897,897 ],[897,897,897,925,897,897,897,897,897,897,897,897,897,928,897,897,897,897,897,897,897,897,897,925,897,897,897 ],[897,897,897,925,897,897,897,0,0,0,0,897,0,0,0,897,0,0,0,0,897,897,897,925,897,897,897 ],[897,897,897,897,897,897,897,0,0,0,0,0,0,0,0,0,0,0,0,0,897,897,897,897,897,897,897],], 丛林神庙:[[0,0,926,0,926,0,926,0,926,0,926,0,926,],[926,923,923,923,923,923,926,926,926,923,923,923,923,923,926,],[926,923,926,926,926,926,926,926,926,926,926,926,926,923,926,],[0,923,926,926,923,923,923,927,923,923,926,923,926,923,0,],[926,923,926,926,923,0,926,0,923,926,926,923,926,923,926,],[926,923,926,923,923,926,923,926,923,923,923,923,926,923,926,],[0,923,926,927,0,926,923,926,0,926,0,927,926,923,0,],[926,923,926,923,926,923,923,923,923,926,923,923,926,923,926,],[926,923,926,923,926,926,926,926,926,926,0,923
flags.structurebg = {水井:[[0,0,0],[0,348,0],[0,0,0],], 村庄小屋:[[365,365,365,365,365,],[365,365,365,365,365,],[365,365,365,365,365,],[365,365,365,365,365,],[365,365,365,365,365,],], 村庄农田:[[0,0,0,0,0,],[0,426,348,426,0,],[0,426,348,426,0,],[0,426,348,426,0,],[0,0,0,0,0,],], 村庄铁匠铺:[[365,365,365,365,365,365,365,365,],[365,365,365,365,365,365,365,365,],[365,365,365,365,365,365,365,365,],[0,0,0,0,0,365,365,365,],[0,910,910,0,0,365,365,365,],[0,0,0,0,0,0,0,0,],], 雪屋:[[0,0,0,0,0,0,0,],[0,0,0,0,0,0,0,],[0,0,898,898,898,0,0,],[0,0,898,898,898,0,0,],[0,0,898,898,898,0,0,],[0,0,898,898,898,0,0,],[0,0,0,0,0,0,0,],], 前哨站:[[0,0,0,0,0,0,0,0,0,0,0,],[0,366,366,366,366,366,366,366,366,366,0,],[0,366,366,366,366,366,366,366,366,366,0,],[0,366,366,366,366,366,366,366,366,366,0,],[0,366,366,366,366,366,366,366,366,366,0,],[0,366,366,366,366,366,366,366,366,366,0,],[0,366,366,366,366,366,366,366,366,366,0,],[0,366,366,366,366,366,366,366,366,366,0,],[0,366,366,366,366,366,366,366,366,366,0,],[0,366,366,366,366,366,366,366,366,366,0,],[0,0,0,0,0,0,0,0,0,0,0,],], 岩浆池:[[],], 废弃传送门:[[],], }
flags.chestloot = {蘑菇宝箱:[[12,18], ["I682", [1,3], 100], ["I683", [1,3], 100], ["I523", [1,2], 50], ["I524", [1,2], 50], ["I525", [1,2], 50], ["I526", [1,2], 50], ["I530", [1,2], 50], ["I531", [1,2], 50], ["I532", [1,2], 20], ["I620", [1,1], 10], ["I630", [1,1], 10], ], 平原村庄宝箱:[[6,12], ["I626", [1,3], 100], ["I628", [1,3], 100], ["I623", [1,3], 100], ["I640", [1,2], 50], ["I642", [1,2], 50], ["I544", [1,2], 30], ["I676", [1,3], 100], ["I673", [1,3], 50], ["I671", [2,5], 50], ["I533", [1,2], 100], ], 沙漠村庄宝箱:[[6,12], ["I625", [1,3], 50], ["I637", [1,2], 100], ["I626", [1,3], 50], ["I627", [1,3], 50], ["I646", [1,2], 50], ["I672", [2,4], 50], ["I673", [1,2], 50], ["I533", [1,3], 100], ], 针叶林村庄宝箱:[[6,12], ["I551", [1,3], 50], ["I546", [1,2], 50], ["I626", [1,3], 100], ["I623", [1,3], 100], ["I634", [1,2], 100], ["I644", [1,2], 50], ["I533", [1,2], 100], ["I669", [3,7], 30], ], 铁匠铺宝箱:[[8,12], ["I626", [1,3], 200], ["I628", [1,2], 200], ["I581", [1,1], 5], ["I602", [1,1], 5], ["I603", [1,1], 5], ["I604", [1,1], 5], ["I605", [1,1], 5], ["I519", [1,2], 100], ["I527", [1,2], 200], ["I532", [1,3], 5], ], 前哨站宝箱:[[22,30], ["I549", [2,5], 100], ["I550", [2,5], 100], ["I551", [2,5], 100], ["I552", [2,5], 100], ["I553", [2,5], 100], ["I625", [3,6], 50], ["I623", [3,6], 50], ["I627", [3,6], 50], ["I614", [1,1], 20], ["I615", [8,16], 100], ["I675", [2,4], 50], ["I533", [2,4], 300], ["I717", [1,1], 30], ], 沙漠神殿宝箱:[[22,30], ["I513", [2,5], 200], ["I514", [2,5], 200], ["I696", [2,3], 200], ["I675", [2,3], 200], ["I667", [2,3], 200], ["I668", [2,3], 200], ["I527", [2,4], 100], ["I669", [5,10], 200], ["I533", [1,2], 100], ["I532", [1,2], 30], ["I629", [1,1], 15], ["I630", [1,1], 5], ], 丛林神庙宝箱:[[22,30], ["I667", [2,4], 100], ["I696", [2,4], 100], ["I681", [1,3], 100], ["I674", [2,4], 100], ["I524", [1,4], 200], ["I530", [4,8], 300], ["I532", [1,2], 30], ["I533", [1,4], 150], ["I630", [1,1], 10], ], 海底神殿宝箱:[[18,27], ["I648", [2,4], 100], ["I650", [2,4], 100], ["I539", [1,2], 100], ["I534", [1,3], 100], ["I532", [1,3], 100], ["I629", [1,1], 20], ["I630", [1,1], 10], ], 沉船宝箱:[[12,24], ["I623", [1,2], 50], ["I625", [2,3], 50], ["I627", [1,2], 50], ["I696", [1,2], 50], ["I671", [1,2], 50], ["I668", [1,2], 50], ["I677", [1,3], 50], ["I673", [1,2], 50], ["I657", [1,1], 5], ["I706", [1,2], 50], ["I523", [1,2], 50], ["I524", [1,2], 40], ["I526", [1,2], 10], ["I531", [1,6], 40], ["I533", [1,4], 40], ["I717", [1,1], 10], ], 陆地废墟宝箱:[[6,10], ["I625", [1,3], 100], ["I696", [1,2], 100], ["I677", [1,3], 100], ["I673", [1,2], 100], ["I675", [1,3], 100], ["I668", [1,3], 100], ["I706", [1,2], 50], ["I523", [1,2], 50], ["I669", [4,8], 50], ["I524", [1,2], 50], ["I525", [1,2], 50], ], 海底废墟宝箱:[[6,12], ["I648", [1,3], 100], ["I650", [1,3], 100], ["I625", [1,3], 100], ["I653", [1,1], 20], ["I671", [1,3], 100], ["I523", [1,2], 50], ["I669", [4,8], 50], ["I524", [1,2], 50], ["I525", [1,2], 50], ], 废弃传送门宝箱:[[4,8], ["I674", [1,6], 400], ["I606", [1,1], 10], ["I607", [1,1], 10], ["I608", [1,1], 10], ["I609", [1,1], 10], ["I572", [1,1], 20], ["I577", [1,1], 20], ["I582", [1,1], 20], ["I587", [1,1], 20], ["I592", [1,1], 20], ["I669", [1,8], 400], ["I633", [1,2], 50], ["I632", [1,2], 50], ["I629", [1,1], 10], ["I630", [1,1], 5], ], 初始奖励箱:[[15,18], ["I544", [1,3], 100], ["I548", [1,3], 100], ["I545", [1,3], 100], ["I549", [1,3], 100], ["I550", [1,3], 100], ["I554", [1,9], 100], ["I555", [1,9], 100], ["I628", [1,4], 100], ["I634", [1,4], 100], ["I574", [1,1], 10], ["I579", [1,1], 10], ["I584", [1,1], 10], ["I569", [1,1], 10], ["I617", [1,1], 10], ["I594", [1,1], 10], ["I595", [1,1], 10], ["I596", [1,1], 10], ["I597", [1,1], 10], ], }
flags.enchantlist1 = {木剑: ["经验修补", "耐久", "锋利", "海洋杀手", "天空杀手", "无视防御", "横扫之刃", "抢夺", ],石剑: ["经验修补", "耐久", "锋利", "海洋杀手", "天空杀手", "无视防御", "横扫之刃", "抢夺", ],铁剑: ["经验修补", "耐久", "锋利", "海洋杀手", "天空杀手", "无视防御", "横扫之刃", "抢夺", ],金剑: ["经验修补", "耐久", "锋利", "海洋杀手", "天空杀手", "无视防御", "横扫之刃", "抢夺", ],钻石剑: ["经验修补", "耐久", "锋利", "海洋杀手", "天空杀手", "无视防御", "横扫之刃", "抢夺", ],木斧: ["经验修补", "耐久", "效率", ],石斧: ["经验修补", "耐久", "效率", ],铁斧: ["经验修补", "耐久", "效率", ],金斧: ["经验修补", "耐久", "效率", ],钻石斧: ["经验修补", "耐久", "效率", ],木镐: ["经验修补", "耐久", "时运", "效率", ],石镐: ["经验修补", "耐久", "时运", "效率", ],铁镐: ["经验修补", "耐久", "时运", "效率", ],金镐: ["经验修补", "耐久", "时运", "效率", ],钻石镐: ["经验修补", "耐久", "时运", "效率", ],木锹: ["经验修补", "耐久", "效率", ],石锹: ["经验修补", "耐久", "效率", ],铁锹: ["经验修补", "耐久", "效率", ],金锹: ["经验修补", "耐久", "效率", ],钻石锹: ["经验修补", "耐久", "效率", ],木锄: ["经验修补", "耐久", ],石锄: ["经验修补", "耐久", ],铁锄: ["经验修补", "耐久", ],金锄: ["经验修补", "耐久", ],钻石锄: ["经验修补", "耐久", ],: ["经验修补", "耐久", "力量", "暴击", "真实伤害", "轻巧", "射程", ],钓鱼竿: ["经验修补", "耐久", ],皮革帽子: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", "水下呼吸", ],铜头盔: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", "水下呼吸", ],铁头盔: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", "水下呼吸", ],金头盔: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", "水下呼吸", ],钻石头盔: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", "水下呼吸", ],皮革胸甲: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", "水下速掘", ],铜胸甲: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", "水下速掘", ],铁胸甲: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", "水下速掘", ],金胸甲: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", "水下速掘", ],钻石胸甲: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", "水下速掘", ],皮革护腿: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", ],铜护腿: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", ],铁护腿: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", ],金护腿: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", ],钻石护腿: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", ],皮革靴子: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", "凌波", ],铜靴子: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", "凌波", ],铁靴子: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", "凌波", ],金靴子: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", "凌波", ],钻石靴子: ["经验修补", "耐久", "保护", "爆炸保护", "弹射物保护", "荆棘", "韧性", "凌波", ],木盾: ["经验修补", "耐久", ],铜盾: [
flags.enchantlist2 = {木剑: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],石剑: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],铁剑: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],金剑: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],钻石剑: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],木斧: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],石斧: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],铁斧: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],金斧: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],钻石斧: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],木镐: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],石镐: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],铁镐: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],金镐: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],钻石镐: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],木锹: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],石锹: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],铁锹: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],金锹: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],钻石锹: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],木锄: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],石锄: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],铁锄: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],金锄: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],钻石锄: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],钓鱼竿: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],皮革帽子: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],铜头盔: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],铁头盔: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],金头盔: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],钻石头盔: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],皮革胸甲: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],铜胸甲: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],铁胸甲: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],金胸甲: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],钻石胸甲: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],皮革护腿: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],铜护腿: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],铁护腿: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],金护腿: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],钻石护腿: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],皮革靴子: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],铜靴子: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],铁靴子: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],金靴子: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],钻石靴子: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],木盾: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],铜盾: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],],钻石盾: [["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],["",0,0],]}
flags.enchantlv = {锋利: 5, 海洋杀手: 5, 天空杀手: 5, 无视防御: 2, 横扫之刃: 2, 力量: 3, 暴击: 1, 真实伤害: 1, 轻巧: 2, 射程: 1, 保护: 5, 爆炸保护: 3, 弹射物保护: 3, 荆棘: 2, 韧性: 1, 经验修补: 3, 耐久: 3, 时运: 3, 抢夺: 3, 效率: 5, 水下呼吸: 3, 水下速掘: 4, 凌波: 1, }
flags.enchantmutex = {锋利:["海洋杀手","天空杀手"], 海洋杀手:["锋利","天空杀手"], 天空杀手:["锋利","海洋杀手"], 无视防御:["横扫之刃"], 横扫之刃:["无视防御"], 暴击:["真实伤害"], 真实伤害:["暴击"], 保护:["爆炸保护","弹射物保护"], 爆炸保护:["保护","弹射物保护"], 弹射物保护:["保护","爆炸保护"]}
flags.task1 = {1:["砍伐树木",50,[1,"橡木原木","I549",5]],2:["砍伐树木",95,[1,"橡木原木","I549",9]],3:["砍伐树木",190,[1,"橡木原木","I549",28]],4:["杀怪",50,[2,"经验","exp",100]],5:["杀怪",100,[2,"经验","exp",300]],6:["开采铁矿",50,[1,"粗铁","I524",5]],7:["开采铁矿",100,[1,"粗铁","I524",15]],8:["开采金矿",50,[1,"粗金","I526",4]],9:["开采金矿",100,[1,"粗金","I526",12]],10:["开采红石矿",50,[1,"红石","I530",10]],11:["开采红石矿",100,[1,"红石","I530",25]],12:["开采钻石矿",10,[1,"钻石","I532",1]],13:["开采钻石矿",20,[1,"钻石","I532",2]],14:["收割小麦",55,[1,"面包","I626",6]],15:["收割小麦",110,[1,"面包","I626",13]],16:["收割小麦",220,[1,"面包","I626",38]],17:["收割马铃薯",50,[1,"烤马铃薯","I624",5]],18:["收割马铃薯",100,[1,"烤马铃薯","I624",10]],19:["收割马铃薯",200,[1,"烤马铃薯","I624",30]],20:["收割胡萝卜",100,[1,"金胡萝卜","I633",4]],21:["收割胡萝卜",200,[1,"金胡萝卜","I633",10]],22:["熔炉烧制",95,[1,"煤炭","I523",4]],23:["熔炉烧制",195,[1,"煤炭块","I535",1]],}
flags.achievement = {"Minecraft":["在物品栏中获得工作台",0,1,"历程类"],"石器时代":["在物品栏中获得圆石",0,1,"历程类"],"整装上阵":["在物品栏中获得任意铜质盔甲",0,1,"历程类"],"来硬的":["在物品栏中获得铁锭",0,1,"历程类"],"冰桶挑战":["在物品栏中获得黑曜石",0,1,"历程类"],"钻石!":["在物品栏中获得钻石",0,1,"历程类"],"钻石护体":["在物品栏中获得任意钻石盔甲",0,1,"历程类"],"甜蜜的梦":["在床上睡觉以改变你的重生点",0,1,"历程类"],"开荒垦地":["种下一颗种子",0,1,"历程类"],"冒险家":["打开一个战利品箱",0,1,"历程类"],"打发时间":["玩上100天约等于现实中40个小时",0,1,"历程类"],"伐木工":["累计砍伐50棵树",0,50,"收集类"],"伐伐木工":["累计砍伐200棵树",0,200,"收集类"],"伐伐伐木工":["累计砍伐1000棵树",0,1000,"收集类"],"伐伐伐伐木工":["累计砍伐5000棵树",0,5000,"收集类"],"熟能生巧":["累计合成50次",0,50,"收集类"],"能工巧匠":["累计合成200次",0,200,"收集类"],"巧夺天工":["累计合成1000次",0,1000,"收集类"],"匠心独运":["累计合成5000次",0,5000,"收集类"],"怪物猎人":["累计击杀1只敌怪",0,1,"收集类"],"怪物猎人Ⅱ":["累计击杀100只敌怪",0,100,"收集类"],"怪物猎人Ⅲ":["累计击杀500只敌怪",0,500,"收集类"],"怪物猎人Ⅳ":["累计击杀2000只敌怪",0,2000,"收集类"],"怪物猎人Ⅴ":["累计击杀10000只敌怪",0,10000,"收集类"],"白手起家":["累计获得100铜币",0,100,"收集类"],"小有积蓄":["累计获得1,000铜币",0,1000,"收集类"],"家财万贯":["累计获得10,000铜币",0,10000,"收集类"],"富甲一方":["累计获得100,000铜币",0,100000,"收集类"],"富可敌国":["累计获得1,000,000铜币",0,1000000,"收集类"],"走近科学":["累计升级科技1次",0,1,"收集类"],"走近科学第二集":["累计升级科技20次",0,20,"收集类"],"走近科学第三集":["累计升级科技100次",0,100,"收集类"],"走近科学第四集":["累计升级科技500次",0,500,"收集类"],"走近科学第五集":["累计升级科技1000次",0,1000,"收集类"],"于沙漠中绽放的玫瑰":["找到并采摘一株仙人掌花",0,1,"挑战类"],"均衡饮食":["尝遍天下食材,即便是对身体不好的",0,9999,"挑战类"],"赛博朋克街区":["升级到世界等级十",0,1,"挑战类"],"狂战士":["使基础攻击大于生命",0,1,"挑战类"],"漂流者":["连续吃上30个海带",0,30,"彩蛋类"],"粉丝团":["使场上同时存在15只敌怪",0,1,"彩蛋类"],"世界与你同在":["发现地球彩蛋",0,1,"彩蛋类"],"头号玩家":["通关二周目",0,1,"彩蛋类"],}
flags.cavelayer = {陶瓦洞穴:[[929,800],[403,60],[405,60],[404,20],[406,90],], 砂岩洞穴:[[928,500],[349,180],[403,70],[405,70],[404,25],[406,10],[407,120],[410,10],], 繁茂洞穴:[[921,400],[339,100],[349,100],[432,100],[431,100],[403,50],[405,60],[404,15],[406,5],[408,25],[410,5],], 水晶洞穴:[[302,300],[346,900],[407,50],[409,5],[411,100],], 深层洞穴:[[302,200],[346,400],[404,30],[406,30],[408,30],[407,120],[409,10],], 普通洞穴:[[346,500],[349,140],[403,100],[405,100],[404,20],[406,10],[408,20],[407,50],], }
flags.refenemy = {前期: {草地: {白天: [["E1",10],["E5",10],],夜晚: [["E9",10],["E21",10],["E25",10],["E33",10],["E37",2],],},雪林: {白天: [["E1",10],["E5",10],["E41",20],],夜晚: [["E9",10],["E21",10],["E25",10],["E33",10],["E37",2],["E41",10],],},沙漠: {白天: [["E13",10],["E37",2],],夜晚: [["E13",10],["E21",10],["E25",10],["E33",10],["E37",5],],},水下: {白天: [["E17",10],],夜晚: [["E17",10],],},蘑菇岛: {白天: [],夜晚: [],},其他: {白天: [["E1",10],["E5",10],],夜晚: [["E9",10],["E21",10],["E25",10],["E29",1],["E33",10],["E37",2],],},},中期: {草地: {白天: [["E1",10],["E5",10],["E9",10],["E25",2],],夜晚: [["E9",10],["E21",10],["E25",10],["E33",10],["E37",10],["E29",4],],},雪林: {白天: [["E1",10],["E5",10],["E41",20],["E9",10],["E25",2],],夜晚: [["E9",10],["E21",10],["E25",10],["E33",10],["E37",10],["E41",10],["E29",4],],},沙漠: {白天: [["E13",10],["E37",10],["E25",2],],夜晚: [["E13",10],["E21",10],["E25",10],["E33",10],["E37",10],["E29",4],],},水下: {白天: [["E17",10],],夜晚: [["E17",10],],},蘑菇岛: {白天: [["E1",10],["E5",10],],夜晚: [["E1",10],["E5",10],],},其他: {白天: [["E1",10],["E5",10],["E9",10],["E25",2],],夜晚: [["E9",10],["E21",10],["E25",10],["E29",4],["E33",10],["E37",10],],},},后期: {草地: {白天: [["E1",10],["E5",10],["E9",10],["E25",4],],夜晚: [["E9",10],["E21",10],["E25",10],["E33",10],["E37",10],["E29",4],["E53",6],],},雪林: {白天: [["E1",10],["E5",10],["E41",20],["E9",10],["E25",4],],夜晚: [["E9",10],["E21",10],["E25",10],["E33",10],["E37",10],["E41",10],["E29",4],["E53",6],],},沙漠: {白天: [["E13",10],["E37",10],["E25",4],],夜晚: [["E13",10],["E21",10],["E25",10],["E33",10],["E37",10],["E29",4],["E53",6],],},水下: {白天: [["E17",10],["E45",10],],夜晚: [["E17",10],["E45",10],],},蘑菇岛: {白天: [["E1",10],["E5",10],["E25",4],],夜晚: [["E1",10],["E5",10],["E25",10],["E53",6],],},其他: {白天: [["E1",10],["E5",10],["E9",10],["E25",4],],夜晚: [["E9",10],["E21",10],["E25",10],["E29",4],["E33",10],["E37",10],["E53",6],],},},};
flags.farmland1 = {
I492: [100, 100, 100, 100, 100, 100, 100, 100, 100, 0, "2种子->3种子", "3种子->3种子", "3种子->4种子", "4种子->4种子", "4种子->5种子", "5种子->5种子", "5种子->6种子", "6种子->7种子", "7种子->8种子", "已满级——8种子", "3小麦->4小麦", "4小麦->5小麦", "5小麦->6小麦", "6小麦->7小麦", "7小麦->8小麦", "8小麦->9小麦", "9小麦->10小麦", "10小麦->11小麦", "11小麦->12小麦", "已满级——12小麦", "200空间->200空间", "200空间->400空间", "400空间->400空间", "400空间->600空间", "600空间->600空间", "600空间->700空间", "700空间->800空间", "800空间->900空间", "900空间->1000空间", "已满级——1000空间", 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 200, 200, 400, 400, 600, 600, 700, 800, 900, 1000],
I508: [100, 100, 100, 100, 100, 100, 100, 100, 100, 0, "", "", "", "", "", "", "", "", "", "", "2胡萝卜->3胡萝卜", "3胡萝卜->3胡萝卜", "3胡萝卜->4胡萝卜", "4胡萝卜->4胡萝卜", "4胡萝卜->5胡萝卜", "5胡萝卜->5胡萝卜", "5胡萝卜->6胡萝卜", "6胡萝卜->7胡萝卜", "7胡萝卜->8胡萝卜", "已满级——8胡萝卜", "200空间->200空间", "200空间->400空间", "400空间->400空间", "400空间->600空间", "600空间->600空间", "600空间->700空间", "700空间->800空间", "800空间->900空间", "900空间->1000空间", "已满级——1000空间", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 200, 200, 400, 400, 600, 600, 700, 800, 900, 1000],
I507: [100, 100, 100, 100, 100, 100, 100, 100, 100, 0, "", "", "", "", "", "", "", "", "", "", "2马铃薯->3马铃薯", "3马铃薯->3马铃薯", "3马铃薯->4马铃薯", "4马铃薯->4马铃薯", "4马铃薯->5马铃薯", "5马铃薯->5马铃薯", "5马铃薯->6马铃薯", "6马铃薯->7马铃薯", "7马铃薯->8马铃薯", "已满级——8马铃薯", "200空间->200空间", "200空间->400空间", "400空间->400空间", "400空间->600空间", "600空间->600空间", "600空间->700空间", "700空间->800空间", "800空间->900空间", "900空间->1000空间", "已满级——1000空间", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 200, 200, 400, 400, 600, 600, 700, 800, 900, 1000],
};
if (flags.tip == undefined) flags.tip = [""];
if (flags.interface == undefined) flags.interface = "物品栏";
if (flags.bag == undefined) flags.bag = [["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0],];
if (flags.bagbp == undefined) flags.bagbp = [];
if (flags.cursor1 == undefined) flags.cursor1 = 1;
if (flags.cursor2 == undefined) flags.cursor2 = 0;
if (flags.curCache2 == undefined) flags.curCache2 = [0, 0];
if (flags.bagCache == undefined) flags.bagCache = 0;
if (flags.cursplit == undefined) flags.cursplit = 0;
if (flags.curdou == undefined) flags.curdou = 0;
if (flags.curlight == undefined) flags.curlight = [[0, 0], [0, 0]];
if (flags.curarr == undefined) flags.curarr = [];
if (flags.mingan == undefined) flags.mingan = 0;
if (flags.longleft == undefined) flags.longleft = 0;
if (flags.longright == undefined) flags.longright = 0;
if (flags.splitCache2 == undefined) flags.splitCache2 = 0;
if (flags.splitCache1 == undefined) flags.splitCache1 = {};
if (flags.weaDur == undefined) flags.weaDur = JSON.parse(JSON.stringify(flags.weapon));
if (flags.toolDur == undefined) flags.toolDur = JSON.parse(JSON.stringify(flags.tool));
if (flags.equDur == undefined) flags.equDur = JSON.parse(JSON.stringify(flags.equip));
if (flags.enchantlist3 == undefined) flags.enchantlist3 = JSON.parse(JSON.stringify(flags.enchantlist2));
if (flags.craftGuide1 == undefined) flags.craftGuide1 = Object.assign({}, flags.craftGuide11, /* flags.craftGuide12, flags.craftGuide13, flags.craftGuide14, flags.craftGuide15, flags.craftGuide16, flags.craftGuide17, flags.craftGuide18, flags.craftGuide19, flags.craftGuide1a*/);
if (flags.craftGuide2 == undefined) flags.craftGuide2 = Object.assign({}, flags.craftGuide21, /* flags.craftGuide22, flags.craftGuide23, flags.craftGuide24, flags.craftGuide25, flags.craftGuide26, flags.craftGuide27, flags.craftGuide28, flags.craftGuide29, flags.craftGuide2a*/);
if (flags.boxlist == undefined) flags.boxlist = {};
if (flags.furnacelist == undefined) flags.furnacelist = {};
if (flags.comlist1 == undefined) flags.comlist1 = [["", 0], ["", 0], ["", 0], ["", 0], ["", 0],];
if (flags.comlist2 == undefined) flags.comlist2 = [["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0],];
if (flags.time == undefined) flags.time = 480;
if (flags.timePeriod == undefined) flags.timePeriod = "";
if (flags.enemyold == undefined) flags.enemyold = {};
if (flags.enemylist == undefined) flags.enemylist = {};
if (flags.revive == undefined) flags.revive = ["zhu13", 30, 30, "", 0, 0];
if (flags.revivePo == undefined) flags.revivePo = ["", 0, 0];
if (flags.property == undefined) flags.property = {
atkSpeed: [84, 1, 0],
touchRange: [1, 2],
atkSea: 0,
atkFly: 0,
igdef1: 0,
igdef2: 0,
crit: 1,
reduceDa: 0,
reduceBoom: 0,
reduceBul: 0,
backDa: 0,
undead: 0,
exp: 0,
};
if (flags.playerAr == undefined) flags.playerAr = 0;
if (flags.tech == undefined) flags.tech = 0;
if (flags.tech1 == undefined) flags.tech1 = {
灵感: [1, 10],
领悟: [1, 11],
生命之力: [1, 11],
增幅: [1, 11],
坚定: [1, 11],
敏捷: [1, 11],
耐力: [1, 11],
空间扩展: [1, 10],
守护之韧: [1, 11],
锋锐恒久: [1, 11],
生机: [1, 11],
商贾之道: [1, 11],
};
if (flags.tpointnum == undefined) flags.tpointnum = 0;
if (flags.tpointsum == undefined) flags.tpointsum = 0;
if (flags.coppernum == undefined) flags.coppernum = 0;
if (flags.level == undefined) flags.level = [0, 0, 100];
if (flags.worldlevel == undefined) flags.worldlevel = 1;
if (flags.CustomKey == undefined) flags.CustomKey = 0;
if (flags.pagenumber == undefined) flags.pagenumber = 1;
if (flags.curKey == undefined) flags.curKey = 0;
if (flags.keylist == undefined) flags.keylist = [["向上移动", 87], ["向左移动", 65], ["向下移动", 83], ["向右移动", 68], ["打开背包", 69], ["打开设置", 80], ["打开大地图", 77], ["打开科技", 84], ["打开指南", -1], ["打开成就", -1], ["按住可快捷的转移物品", 16], ["打开自定义快捷键界面", 75], ["", -1], ["", -1], ["", -1], ["", -1], ["", -1], ["", -1]];
if (flags.transfer == undefined) flags.transfer = 0;
if (flags.dig == undefined) flags.dig = [0, 0, 0, 0, 0];
if (flags.box_xy == undefined) flags.box_xy = "";
if (flags.crops == undefined) flags.crops = {};
if (flags.farmland2 == undefined) flags.farmland2 = {};
if (flags.farmUI == undefined) flags.farmUI = 0;
if (flags.hunger == undefined) flags.hunger = [100, 100, 0, 10];
if (flags.worldlist == undefined) flags.worldlist = {
0: {
世界名称: "新的世界",
世界存档: [],
世界选项: ["默认", "开", "关", "中"],
游戏模式: "生存",
难度: "普通",
游戏规则: ["开", "开", "开", "开", "开", "开", "开", "开", "开"],
地形: {
平原: [1,],
森林: [1,],
丛林: [1,],
针叶林: [1,],
雪原: [1,],
沙漠: [1,],
恶地: [1,],
海洋: [1,],
丘陵: [1,],
蘑菇岛: [1,],
河流: [1,],
},
结构: {
水井: [1,],
废墟: [1,],
岩浆池: [1,],
废弃传送门: [1,],
雪屋: [1,],
前哨站: [1,],
村庄: [1,],
沉船: [1,],
沙漠神殿: [1,],
丛林神庙: [1,],
},
单一群系: ["随机",]
}
};
if (flags.worldDescribe == undefined) flags.worldDescribe = "";
if (flags.worldindex == undefined) flags.worldindex = 0;
if (flags.smeltcheck == undefined) flags.smeltcheck = 0;
if (flags.buff == undefined) flags.buff = {
生命恢复: 0,
中毒: 0,
凋零: 0,
};
if (flags.dying == undefined) flags.dying = 0;
if (flags.textalpha == undefined) flags.textalpha = [];
if (flags.digcold == undefined) flags.digcold = 0;
if (flags.rightstatus == undefined) flags.rightstatus = ["", ""];
if (flags.mapicon == undefined) flags.mapicon = { zhu: {}, dong: {}, };
if (flags.step == undefined) flags.step = 0;
if (flags.digvolume == undefined) flags.digvolume = 0;
if (flags.attrui == undefined) flags.attrui = 0;
if (flags.taskui == undefined) flags.taskui = 0;
if (flags.achiui == undefined) flags.achiui = 0;
if (flags.worldcur == undefined) flags.worldcur = 0;
if (flags.worldcur2 == undefined) flags.worldcur2 = 0;
if (flags.limit == undefined) flags.limit = 100;
if (flags.rand3 == undefined) flags.rand3 = core.plugin.LCGrand();
if (flags.createrate == undefined) flags.createrate = 1;
if (flags.extraDur == undefined) flags.extraDur = [0, 0];
if (flags.extraGrow == undefined) flags.extraGrow = 0;
if (flags.extraGrid == undefined) flags.extraGrid = 0;
if (flags.worldpage == undefined) flags.worldpage = 1;
if (flags.breathe == undefined) flags.breathe = [10, 10];
if (flags.lavaocc == undefined) flags.lavaocc = 0;
if (flags.breocc == undefined) flags.breocc = 0;
if (flags.dimension == undefined) flags.dimension = ["主世界", "地表"];
if (flags.eatcool == undefined) flags.eatcool = 0;
if (flags.mapview == undefined) flags.mapview = ["dong1", "dong2", "dong3", "dong4", "dong5", "dong6", "dong7", "dong8", "dong9",];
if (flags.sleep == undefined) flags.sleep = 0;
if (flags.nearstr == undefined) flags.nearstr = {};
if (flags.bombcenter == undefined) flags.bombcenter = [];
if (flags.discard == undefined) flags.discard = 0;
if (!core.getLocalStorage('world')) core.setLocalStorage('world', {});
if (!core.getLocalStorage('maplist')) core.setLocalStorage('maplist', {});
for (var bgm1 in core.material.bgms) {
core.material.bgms[bgm1].loop = false;
}
};
function myCallback() {
core.plugin.initVariable();
}
// 定义一个函数,用于判断条件并执行回调
var check = function (a, callback) {
if (a == true) {
callback(); // 当a为真时执行回调函数
}
else {
setTimeout(function () { check(core.isPlaying(), callback) }, 100);//否则每隔100ms检查一次
}
}
check(core.isPlaying(), myCallback);
},
"2-左键点击": function () {
// 获取元素
var myElement = document.getElementById('data');
var lastClickTime = 0; // 用于记录上次点击的时间
var delay = 200; // 双击间隔时间(毫秒)
// 鼠标按下
myElement.addEventListener('mousedown', function (e) {
// 获取鼠标双击的绝对坐标
var absX = e.clientX;
var absY = e.clientY;
// 获取元素的相对位置
var rect = myElement.getBoundingClientRect();
// 计算相对坐标
var rx = Math.ceil((absX - rect.left) * 416 / 415);
var ry = Math.ceil((absY - rect.top) * 416 / 415);
// 计算格子坐标
var mx = Math.ceil(rx / 32) - 1;
var my = Math.ceil(ry / 32) - 1;
// 检查是否为左键按下
if (e.button === 0) {
// 获取当前点击时间
var clickTime = new Date().getTime();
// 计算两次点击之间的时间差
var timeDiff = clickTime - lastClickTime;
// 更新最后点击时间
lastClickTime = clickTime;
// 如果两次点击的时间差小于设定的双击间隔时间,则认为是双击
if (timeDiff < delay) {
// 调用插件的方法来处理左键双击事件
core.plugin.ondblclicked(mx, my, rx, ry);
// 防止触发单击事件
e.preventDefault();
} else {
core.plugin.leftMouseDown(mx, my);
}
} else if (e.button === 2) {
core.plugin.rightMouseDown();
}
});
// 鼠标抬起
myElement.addEventListener('mouseup', function (e) {
// 获取鼠标点击的绝对坐标
var absX = e.clientX;
var absY = e.clientY;
// 获取元素的相对位置
var rect = myElement.getBoundingClientRect();
// 计算相对坐标
var rx = Math.ceil((absX - rect.left) * 416 / 415);
var ry = Math.ceil((absY - rect.top) * 416 / 415);
// 计算格子坐标
var mx = Math.ceil(rx / 32) - 1;
var my = Math.ceil(ry / 32) - 1;
//console.log((absY - rect.top))
if (e.button === 0) {
core.plugin.leftMouseUp();
core.plugin.onclicked(mx, my, rx, ry);
} else if (e.button === 2) {
core.plugin.rightMouseUp();
core.plugin.rightClick(mx, my, rx, ry);
}
});
// 主程序,当鼠标左键点击时进行判断
this.onclicked = function (mouse_x, mouse_y, px, py) {
//console.log("左键事件");
//console.log("左键坐标", mouse_x, mouse_y, px, py);
if (!window.core) return;
if (!core.isPlaying) return;
if (!core.isPlaying()) return;
var offsetx = Math.round(core.bigmap.offsetX / 32);
var offsety = Math.round(core.bigmap.offsetY / 32);
if (flags.interface == "物品栏") {
flags.box_xy = ((mouse_x + offsetx) * 1000 + (mouse_y + offsety)).toString().padStart(6, '0') + core.status.floorId;
}
if (mouse_x == 11 && mouse_y == 12 && core.status.hero.hp > 0 && flags.tech == 0) {
if (flags.interface == "物品栏") {
flags.interface = "背包";
} else {
if (flags.interface == "箱子" && flags.discard == 0) {
core.playSound("chestclosed.ogg");
}
flags.interface = "物品栏";
if (flags.discard == 1) {
delete flags.boxlist[flags.box_xy];
flags.discard = 0;
}
}
if (flags.interface == "物品栏") {
for (var i = 0; i < 4; i++) {
if (flags.comlist1[i][0]) {
core.addItem(flags.comlist1[i][0], flags.comlist1[i][1]);
flags.comlist1[i] = ["", 0];
}
}
for (var i = 0; i < 9; i++) {
if (flags.comlist2[i][0]) {
core.addItem(flags.comlist2[i][0], flags.comlist2[i][1]);
flags.comlist2[i] = ["", 0];
}
}
}
}
core.plugin.invenInter(mouse_x, mouse_y, offsetx, offsety);
flags.cursor2 = core.plugin.clickloc(mouse_x, mouse_y);
core.plugin.bagInter(mouse_x, mouse_y);
core.plugin.boxInter(mouse_x, mouse_y);
core.plugin.workInter(mouse_x, mouse_y);
core.plugin.furInter(mouse_x, mouse_y);
core.plugin.dieInter(mouse_x, mouse_y);
core.plugin.techInter(px, py);
core.plugin.keyInter(px, py);
core.plugin.attrInter(px, py);
core.plugin.taskInter(px, py);
core.plugin.achiInter(px, py);
//core.plugin.farmInter(mouse_x, mouse_y, px, py, offsetx, offsety);
core.plugin.mcjiemian();
flags.mingan = 0;
core.plugin.beibaocunchu();
if (flags.bag[0][0] != "" && flags.bag[0][1] > 0 && flags.interface != "物品栏" && flags.interface != "锁定") {
//core.ui._createUIEvent();
if (core.getContextByName("viscous") == null) {
core.createCanvas("viscous", 0, 0, 416, 416, 136);
} else {
core.clearMap('viscous');
}
core.drawIcon("viscous", flags.bag[0][0], px - 16, py - 16);
if (flags.bag[0][1] > 0 && flags.bag[0][1] < 10) {
core.ui.fillText("viscous", flags.bag[0][1].toString(), px - 16 + 20, py - 16 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[0][1] >= 10) {
core.ui.fillText("viscous", flags.bag[0][1].toString(), px - 16 + 12, py - 16 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else {
core.deleteCanvas('viscous');
//core.clearMap('viscous');
}
};
// 主程序,当鼠标左键双击时进行判断
this.ondblclicked = function (mouse_x, mouse_y, px, py) {
if (flags.interface != "锁定" && flags.interface != "物品栏") {
flags.curdou = 1;
flags.cursor2 = core.plugin.clickloc(mouse_x, mouse_y);
core.plugin.bagInter(mouse_x, mouse_y);
core.plugin.workInter(mouse_x, mouse_y);
core.plugin.mcjiemian();
core.plugin.beibaocunchu();
if (flags.bag[0][0] != "") {
//core.ui._createUIEvent();
if (core.getContextByName("viscous") == null) {
core.createCanvas("viscous", 0, 0, 416, 416, 136);
} else {
core.clearMap('viscous');
}
core.drawIcon("viscous", flags.bag[0][0], px - 16, py - 16);
if (flags.bag[0][1] > 0 && flags.bag[0][1] < 10) {
core.ui.fillText("viscous", flags.bag[0][1].toString(), px - 16 + 20, py - 16 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[0][1] >= 10) {
core.ui.fillText("viscous", flags.bag[0][1].toString(), px - 16 + 12, py - 16 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else {
core.deleteCanvas('viscous');
core.clearMap('viscous');
}
}
};
// 物品栏界面点击事件
this.invenInter = function (mouse_x, mouse_y, offsetx, offsety) {
if (flags.interface == "物品栏" && core.status.hero.hp > 0) {
for (var i = 2; i < 11; i++) {
if (mouse_x == i && mouse_y == 12) {
flags.cursor1 = i - 1;
break;
}
}
if (!(mouse_x == 2 && mouse_y == 12) &&
!(mouse_x == 3 && mouse_y == 12) &&
!(mouse_x == 4 && mouse_y == 12) &&
!(mouse_x == 5 && mouse_y == 12) &&
!(mouse_x == 6 && mouse_y == 12) &&
!(mouse_x == 7 && mouse_y == 12) &&
!(mouse_x == 8 && mouse_y == 12) &&
!(mouse_x == 9 && mouse_y == 12) &&
!(mouse_x == 10 && mouse_y == 12) &&
!(mouse_x == 11 && mouse_y == 12)) {
core.plugin.applyItem();
core.plugin.battleDamage(mouse_x, mouse_y, offsetx, offsety);
}
}
} //主手栏为道具时,点击任意位置使用
this.applyItem = function () {
var id = flags.bag[flags.cursor1][0];
if (id == "fly") return;
if (core.items.items[id]) {
if ((core.items.items[id].cls == "constants" || core.items.items[id].cls == "tools") &&
("useItemEvent" in core.items.items[id] || "useItemEffect" in core.items.items[id]) &&
flags.eatcool == 0) {
if (core.material.items[id].text == undefined) {
core.useItem(id);
} else if (core.material.items[id].text.slice(0, 2) != "食用" || flags.hunger[1] - flags.hunger[0] >= 5) {
core.useItem(id);
}
}
}
} //根据玩家攻速对攻击范围内的敌怪造成伤害
this.battleDamage = function (mouse_x, mouse_y, offsetx, offsety) {
if (flags.property.atkSpeed[2]) return;
var x = mouse_x + offsetx;
var y = mouse_y + offsety;
var hx = core.status.hero.loc.x;
var hy = core.status.hero.loc.y;
var ra = 1;
var clickar = 1;
if (y <= hy && Math.abs(x - hx) <= Math.abs(y - hy)) {
clickar = 1;
//core.drawAnimate("atk_u", hx - offsetx, hy - offsety, true);
} else if (x >= hx && Math.abs(x - hx) >= Math.abs(y - hy)) {
clickar = 2;
//core.drawAnimate("atk_r", hx - offsetx, hy - offsety, true);
} else if (y >= hy && Math.abs(x - hx) <= Math.abs(y - hy)) {
clickar = 3;
//core.drawAnimate("atk_d", hx - offsetx, hy - offsety, true);
} else if (x <= hx && Math.abs(x - hx) >= Math.abs(y - hy)) {
clickar = 4;
//core.drawAnimate("atk_l", hx - offsetx, hy - offsety, true);
}
if (core.getBlockCls(x, y) == "enemys" ||
core.getBlockCls(x, y) == "enemy48") {
if (Math.abs(hx - x) <= flags.property.touchRange[0] && Math.abs(hy - y) <= flags.property.touchRange[0]) {
if (y <= hy && Math.abs(x - hx) <= Math.abs(y - hy)) {
core.plugin.makehurt(x, y, 1);
} else if (x >= hx && Math.abs(x - hx) >= Math.abs(y - hy)) {
core.plugin.makehurt(x, y, 2);
} else if (y >= hy && Math.abs(x - hx) <= Math.abs(y - hy)) {
core.plugin.makehurt(x, y, 3);
} else if (x <= hx && Math.abs(x - hx) >= Math.abs(y - hy)) {
core.plugin.makehurt(x, y, 4);
}
return;
}
}
if (core.getEquip(0) in flags.weapon) {
do {
for (var i = -ra; i <= ra; i++) {
for (var j = -ra; j <= ra; j++) {
if (core.getBlockCls(hx + i, hy + j) == "enemys" ||
core.getBlockCls(hx + i, hy + j) == "enemy48") {
switch (clickar) {
case 1:
if (hy + j <= hy && Math.abs(hx + i - hx) <= Math.abs(hy + j - hy)) {
core.plugin.makehurt(hx + i, hy + j, clickar);
return;
}
break;
case 2:
if (hx + i >= hx && Math.abs(hx + i - hx) >= Math.abs(hy + j - hy)) {
core.plugin.makehurt(hx + i, hy + j, clickar);
return;
}
break;
case 3:
if (hy + j >= hy && Math.abs(hx + i - hx) <= Math.abs(hy + j - hy)) {
core.plugin.makehurt(hx + i, hy + j, clickar);
return;
}
break;
case 4:
if (hx + i <= hx && Math.abs(hx + i - hx) >= Math.abs(hy + j - hy)) {
core.plugin.makehurt(hx + i, hy + j, clickar);
return;
}
break;
}
}
}
}
ra += 1;
} while (ra <= flags.property.touchRange[0]);
}
core.plugin.digBlock(mouse_x, mouse_y, offsetx, offsety);
} //在玩家触碰范围内挖掘方块,前景->事件->背景
this.digBlock = function (mouse_x, mouse_y, offsetx, offsety) {
if (flags.digcold == 1) return;
if (core.getBgNumber(mouse_x + offsetx, mouse_y + offsety) != 0 || core.getBlockCls(mouse_x + offsetx, mouse_y + offsety) == "terrains" || core.getFgNumber(mouse_x + offsetx, mouse_y + offsety) != 0) {
var lx, yd;
if (core.getFgNumber(mouse_x + offsetx, mouse_y + offsety) != 0) {
lx = core.getBlockInfo(core.getFgNumber(mouse_x + offsetx, mouse_y + offsety)).blocktype;
yd = core.getBlockInfo(core.getFgNumber(mouse_x + offsetx, mouse_y + offsety)).hardness;
} else if (core.getBlockCls(mouse_x + offsetx, mouse_y + offsety) == "terrains") {
lx = core.getBlockInfo(core.getBlockId(mouse_x + offsetx, mouse_y + offsety)).blocktype;
yd = core.getBlockInfo(core.getBlockId(mouse_x + offsetx, mouse_y + offsety)).hardness;
} else if (core.getBgNumber(mouse_x + offsetx, mouse_y + offsety) != 0) {
lx = core.getBlockInfo(core.getBgNumber(mouse_x + offsetx, mouse_y + offsety)).blocktype;
yd = core.getBlockInfo(core.getBgNumber(mouse_x + offsetx, mouse_y + offsety)).hardness;
}
for (var i = -flags.property.touchRange[1]; i <= flags.property.touchRange[1]; i++) {
for (var j = -flags.property.touchRange[1]; j <= flags.property.touchRange[1]; j++) {
if (mouse_x + offsetx == core.status.hero.loc.x + i && mouse_y + offsety == core.status.hero.loc.y + j) {
var dig1 = 0;
for (var to in flags.tool) {
if (core.getEquip(0) == to) {
if (lx == 1 || lx == 2 || lx == 3) {
if (lx == flags.tool[to][2]) {
flags.dig[0] = flags.digLevel[lx][flags.tool[to][1]][yd - 1][0];
dig1 = 1;
}
} else if (lx == 4 || lx == 5 || lx == 6) {
flags.dig[0] = flags.digLevel[lx][0];
dig1 = 1;
}
break;
}
}
if (dig1 == 0) {
if (lx == 1 || lx == 2 || lx == 3) {
flags.dig[0] = flags.digLevel[lx][1][yd - 1][0];
} else if (lx == 4 || lx == 5 || lx == 6) {
flags.dig[0] = flags.digLevel[lx][0];
}
}
for (var cr in flags.cropslist) {
if (core.getBlockNumber(mouse_x + offsetx, mouse_y + offsety) == flags.cropslist[cr][1]) {
delete flags.crops[flags.box_xy];
}
}
var d2 = flags.dig[2];
var d3 = flags.dig[3];
flags.dig[2] = core.status.hero.loc.x + i;
flags.dig[3] = core.status.hero.loc.y + j;
if (d2 == flags.dig[2] && d3 == flags.dig[3]) {
flags.dig[1] += 1;
} else {
flags.dig[1] = 1;
}
flags.dig[0] -= flags.dig[1];
flags.dig[4] = 2000;
function getnumber(x, y) {
if (core.getFgNumber(x, y) != 0) {
return core.getFgNumber(x, y);
} else if (core.getBlockCls(x, y) == "terrains") {
return core.getBlockNumber(x, y);
} else if (core.getBgNumber(x, y) != 0) {
return core.getBgNumber(x, y);
}
}
if (flags.dig[0] > 0 && (flags.digvolume == 2 || flags.dig[1] == 1)) {
flags.digvolume = 0;
core.plugin.digsound(getnumber(flags.dig[2], flags.dig[3]));
} else {
flags.digvolume += 1;
}
flags.rightstatus = ["图块", getnumber(flags.dig[2], flags.dig[3])];
if (flags.dig[0] == 0) {
flags.dig = [0, 0, 0, 0, 0];
var number;
function gitem(number) {
if (flags.wfk[number][0] && flags.wfk[number][0][2] > core.rand2(100)) {
core.addItem(flags.wfk[number][0][0], flags.wfk[number][0][1]);
//core.playSound("pop.ogg");
if (flags.wfk[number][0][0] == "I705") {
flags.level[1] += flags.wfk[number][0][1];
core.plugin.jingyandengji();
}
}
if (flags.wfk[number][1] && flags.wfk[number][1][2] > core.rand2(100)) {
core.addItem(flags.wfk[number][1][0], flags.wfk[number][1][1]);
//core.playSound("pop.ogg");
if (flags.wfk[number][1][0] == "I705") {
flags.level[1] += flags.wfk[number][1][1];
core.plugin.jingyandengji();
}
}
if (flags.wfk[number][2] && flags.wfk[number][2][2] > core.rand2(100)) {
core.addItem(flags.wfk[number][2][0], flags.wfk[number][2][1]);
//core.playSound("pop.ogg");
if (flags.wfk[number][1][0] == "I705") {
flags.level[1] += flags.wfk[number][1][1];
core.plugin.jingyandengji();
}
}
}
if (core.getFgNumber(mouse_x + offsetx, mouse_y + offsety) != 0) {
number = core.getFgNumber(mouse_x + offsetx, mouse_y + offsety);
gitem(number);
if (number == "433") {
var rand1 = core.rand2(3);
var sound;
switch (rand1) {
case 0:
sound = "glass1.ogg";
break;
case 1:
sound = "glass2.ogg";
break;
case 2:
sound = "glass3.ogg";
break;
}
core.playSound(sound);
} else {
core.plugin.putsound(number);
}
core.setBgFgBlock('fg', 0, mouse_x + offsetx, mouse_y + offsety);
} else if (core.getBlockCls(mouse_x + offsetx, mouse_y + offsety) == "terrains") {
number = core.getBlockNumber(mouse_x + offsetx, mouse_y + offsety);
gitem(number);
if (number == "433") {
var rand1 = core.rand2(3);
var sound;
switch (rand1) {
case 0:
sound = "glass1.ogg";
break;
case 1:
sound = "glass2.ogg";
break;
case 2:
sound = "glass3.ogg";
break;
}
core.playSound(sound);
} else {
core.plugin.putsound(number);
}
core.removeBlock(core.status.hero.loc.x + i, core.status.hero.loc.y + j);
} else if (core.getBgNumber(mouse_x + offsetx, mouse_y + offsety) != 0) {
number = core.getBgNumber(mouse_x + offsetx, mouse_y + offsety);
gitem(number);
if (number == "433") {
var rand1 = core.rand2(3);
var sound;
switch (rand1) {
case 0:
sound = "glass1.ogg";
break;
case 1:
sound = "glass2.ogg";
break;
case 2:
sound = "glass3.ogg";
break;
}
core.playSound(sound);
} else {
core.plugin.putsound(number);
}
core.setBgFgBlock('bg', 0, mouse_x + offsetx, mouse_y + offsety);
}
core.plugin.cunchushuju(mouse_x + offsetx, mouse_y + offsety, core.status.floorId);
core.plugin.reduceDur("wea");
core.plugin.reduceDur("tool");
core.plugin.baoshidu();
flags.digcold = 1;
setTimeout(function () {
flags.digcold = 0;
}, 200);
} else if (flags.dig[0] < 0) {
flags.dig[0] = 0;
flags.dig[1] = 0;
}
core.plugin.wajuejindu();
}
}
}
} else if (flags.worldlevel >= 2 && core.getBgNumber(mouse_x + offsetx, mouse_y + offsety) == 0 || core.getBgNumber(mouse_x + offsetx, mouse_y + offsety) == 300) {
if (mouse_x + offsetx != core.status.hero.loc.x || mouse_y + offsety != core.status.hero.loc.y) return;
function godown(floor) {
core.changeFloor(floor, void 0, { x: core.status.hero.loc.x, y: core.status.hero.loc.y, direction: 'down' }, 500,);
flags.dimension = ["主世界", "洞穴"];
}
switch (core.status.floorId) {
case "zhu7":
godown("dong1");
break;
case "zhu8":
godown("dong2");
break;
case "zhu9":
godown("dong3");
break;
case "zhu12":
godown("dong4");
break;
case "zhu13":
godown("dong5");
break;
case "zhu14":
godown("dong6");
break;
case "zhu17":
godown("dong7");
break;
case "zhu18":
godown("dong8");
break;
case "zhu19":
godown("dong9");
break;
}
}
} //挖掘后检查存储类方块还在不在
this.cunchushuju = function (x, y, floor) {
delete flags.boxlist[flags.box_xy];
delete flags.furnacelist[flags.box_xy];
delete flags.crops[flags.box_xy];
// //检测箱子还在不在,不在了就删掉对应箱子数据
// if (core.getBlockId(x, y, floor) != "T420") {
// delete flags.boxlist[flags.box_xy];
// }
// //检测熔炉还在不在,不在了就删掉对应熔炉数据
// if (core.getBlockId(x, y, floor) != "T415") {
// delete flags.furnacelist[flags.box_xy];
// }
// //删除生长列表数据
} //显示挖掘进度圆圈
this.wajuejindu = function () {
if (core.getContextByName("dig") == null) {
core.createCanvas("dig", 0, 0, 416, 416, 61);
} else {
core.clearMap('dig');
}
if (flags.dig[2] != null && flags.dig[3] != null && flags.dig[4] > 0 && flags.interface == "物品栏") {
core.fillArc("dig", flags.dig[2] * 32 + 16 - core.bigmap.offsetX, flags.dig[3] * 32 + 16 - core.bigmap.offsetY, 6, 1.5 * Math.PI, (flags.dig[1] / (flags.dig[0] + flags.dig[1])) * 2 * Math.PI - (0.5 * Math.PI), "#9dfd8b");
core.strokeArc("dig", flags.dig[2] * 32 + 16 - core.bigmap.offsetX, flags.dig[3] * 32 + 16 - core.bigmap.offsetY, 8, 0, 2 * Math.PI, "#2ff49d", 1);
}
if (flags.dig[4] <= 0) {
flags.dig = [0, 0, 0, 0, 0];
core.deleteCanvas("dig");
}
} //背包界面点击事件
this.bagInter = function (mouse_x, mouse_y) {
if (flags.interface == "背包") {
function replace(type) {
core.playSound("armour.ogg");
if (flags.bag[0][0] && core.material.items[flags.bag[0][0]].cls == "equips" && core.getEquipTypeById(flags.bag[0][0]) == type) {
if (core.getEquip(type)) {
if (core.getEquip(type) == flags.bag[0][0]) return;
for (var i = 1; i < 37; i++) {
if (!flags.bag[i][0] || (flags.bag[i][0] == core.getEquip(type) && flags.bag[i][1] < 64)) {
core.unloadEquip(type);
}
}
}
flags.bag[0][1] -= 1;
core.addItem(flags.bag[0][0], 1);
core.loadEquip(flags.bag[0][0]);
if (flags.bag[0][1] <= 0) {
flags.bag[0] = ["", 0];
//core.deleteCanvas('viscous');
core.clearMap('viscous');
}
} else {
if (core.getEquip(type)) {
for (var i = 1; i < 37; i++) {
if (!flags.bag[i][0] || (flags.bag[i][0] == core.getEquip(type) && flags.bag[i][1] < 64)) {
core.unloadEquip(type);
}
}
}
}
}
if (mouse_x == 6 && mouse_y == 6) replace(1);
else if (mouse_x == 2 && mouse_y == 3) replace(2);
else if (mouse_x == 2 && mouse_y == 4) replace(3);
else if (mouse_x == 2 && mouse_y == 5) replace(4);
else if (mouse_x == 2 && mouse_y == 6) replace(5);
if (mouse_x == 10 && mouse_y == 4) {
flags.curdou = 0;
}
if (flags.transfer == 1) {
trans: for (var mx = 2; mx < 11; mx++) {
if ((mouse_x == mx && mouse_y == 12) ||
(mouse_x == mx && mouse_y == 8) ||
(mouse_x == mx && mouse_y == 9) ||
(mouse_x == mx && mouse_y == 10)) {
}
if (mouse_x == mx && mouse_y == 12) {
core.plugin.transfer(flags.bag[mx - 1], flags.bag, 10, 37, 0);
break trans;
} else if ((mouse_x == mx && mouse_y == 8) ||
(mouse_x == mx && mouse_y == 9) ||
(mouse_x == mx && mouse_y == 10)) {
var c = mx - 1 + (mouse_y - 7) * 9
core.plugin.transfer(flags.bag[c], flags.bag, 1, 10, 0);
break trans;
} else if ((mouse_x == 7 && mouse_y == 3) ||
(mouse_x == 8 && mouse_y == 3) ||
(mouse_x == 7 && mouse_y == 4) ||
(mouse_x == 8 && mouse_y == 4)) {
var c = mouse_x - 7 + (mouse_y - 3) * 2;
core.plugin.transfer(flags.comlist1[c], flags.bag, 1, 37, 1, 1);
break trans;
} else if (mouse_x == 10 && mouse_y == 4) {
for (var n = 0; n < 64; n++) {
if (flags.comlist1[4][0] != "" && flags.comlist1[4][1] != 0) {
for (var i = 0; i < 4; i++) {
if (flags.comlist1[i][0] && flags.comlist1[i][1] <= 0) {
flags.comlist1[4] = ["", 0];
break trans;
}
}
core.addItem(flags.comlist1[4][0], flags.comlist1[4][1]);
for (var i = 0; i < 4; i++) {
if (flags.comlist1[i][1] > 0) {
flags.comlist1[i][1] -= 1;
}
}
} else {
flags.comlist1[4] = ["", 0];
break trans;
}
}
}
}
}
if (flags.comlist1[4][0] != "" && flags.comlist1[4][1] != 0) {
if (mouse_x == 10 && mouse_y == 4) {
if (flags.bag[0][0] == "" || (flags.bag[0][0] == flags.comlist1[4][0] && flags.bag[0][1] != 64)) {
flags.bag[0][0] = flags.comlist1[4][0];
flags.bag[0][1] += flags.comlist1[4][1];
} else {
core.addItem(flags.comlist1[4][0], flags.comlist1[4][1]);
}
for (var i = 0; i < 4; i++) {
if (flags.comlist1[i][1] > 0) {
flags.comlist1[i][1] -= 1;
}
}
flags.cursplit = 0;
}
}
}
} //箱子界面点击事件
this.boxInter = function (mouse_x, mouse_y) {
if (flags.interface == "箱子") {
if (flags.transfer == 1) {
var grid = 27;
switch (flags.extraGrid) {
case 0:
grid = 27;
break;
case 3:
grid = 30;
break;
case 6:
grid = 33;
break;
case 9:
grid = 36;
break;
case 12:
grid = 39;
break;
case 15:
grid = 42;
break;
case 18:
grid = 45;
break;
case 21:
grid = 48;
break;
case 24:
grid = 51;
break;
case 27:
grid = 54;
break;
}
trans: for (var mx = 2; mx < 11; mx++) {
if ((mouse_x == mx && mouse_y == 12) || (mouse_x == mx && mouse_y == 8) || (mouse_x == mx && mouse_y == 9) || (mouse_x == mx && mouse_y == 10)) {
var cc;
if (mouse_y == 12) cc = mx - 1;
else cc = mx - 1 + (mouse_y - 7) * 9;
core.plugin.transfer(flags.bag[cc], flags.boxlist[flags.box_xy], 0, grid, 1, -1);
break trans;
} else if ((mouse_x == mx && mouse_y == 1) || (mouse_x == mx && mouse_y == 2) || (mouse_x == mx && mouse_y == 3) || (mouse_x == mx && mouse_y == 4) || (mouse_x == mx && mouse_y == 5) || (mouse_x == mx && mouse_y == 6)) {
if ((mouse_x == mx && mouse_y == 1) || (mouse_x == mx && mouse_y == 2) || (mouse_x == mx && mouse_y == 3)) {
if (grid < 27) break trans;
} else if ((mouse_x == 2 && mouse_y == 4) || (mouse_x == 3 && mouse_y == 4) || (mouse_x == 4 && mouse_y == 4)) {
if (grid < 30) break trans;
} else if ((mouse_x == 5 && mouse_y == 4) || (mouse_x == 6 && mouse_y == 4) || (mouse_x == 7 && mouse_y == 4)) {
if (grid < 33) break trans;
} else if ((mouse_x == 8 && mouse_y == 4) || (mouse_x == 9 && mouse_y == 4) || (mouse_x == 10 && mouse_y == 4)) {
if (grid < 36) break trans;
} else if ((mouse_x == 2 && mouse_y == 5) || (mouse_x == 3 && mouse_y == 5) || (mouse_x == 4 && mouse_y == 5)) {
if (grid < 39) break trans;
} else if ((mouse_x == 5 && mouse_y == 5) || (mouse_x == 6 && mouse_y == 5) || (mouse_x == 7 && mouse_y == 5)) {
if (grid < 42) break trans;
} else if ((mouse_x == 8 && mouse_y == 5) || (mouse_x == 9 && mouse_y == 5) || (mouse_x == 10 && mouse_y == 5)) {
if (grid < 45) break trans;
} else if ((mouse_x == 2 && mouse_y == 6) || (mouse_x == 3 && mouse_y == 6) || (mouse_x == 4 && mouse_y == 6)) {
if (grid < 48) break trans;
} else if ((mouse_x == 5 && mouse_y == 6) || (mouse_x == 6 && mouse_y == 6) || (mouse_x == 7 && mouse_y == 6)) {
if (grid < 51) break trans;
} else if ((mouse_x == 8 && mouse_y == 6) || (mouse_x == 9 && mouse_y == 6) || (mouse_x == 10 && mouse_y == 6)) {
if (grid < 54) break trans;
}
var cc = mx - 2 + (mouse_y - 1) * 9;
core.plugin.transfer(flags.boxlist[flags.box_xy][cc], flags.bag, 1, 37, 1, 1);
break trans;
}
}
}
}
} //工作台界面点击事件
this.workInter = function (mouse_x, mouse_y) {
if (flags.interface == "工作台") {
if (mouse_x == 9 && mouse_y == 5) {
flags.curdou = 0;
}
if (flags.transfer == 1) {
trans: for (var mx = 2; mx < 11; mx++) {
if ((mouse_x == mx && mouse_y == 12) || (mouse_x == mx && mouse_y == 8) || (mouse_x == mx && mouse_y == 9) || (mouse_x == mx && mouse_y == 10)) {
var cc;
if (mouse_y == 12) {
cc = mx - 1;
} else {
cc = mx - 1 + (mouse_y - 7) * 9;
}
core.plugin.transfer(flags.bag[cc], flags.comlist2, 4, 5, 1, -1);
core.plugin.transfer(flags.bag[cc], flags.comlist2, 0, 9, 1, -1);
break trans;
} else if (mouse_x >= 4 && mouse_x <= 6 && mouse_y >= 4 && mouse_y <= 6) {
var cc = (mouse_x - 4) + (mouse_y - 4) * 3;
core.plugin.transfer(flags.comlist2[cc], flags.bag, 1, 37, 1, 1);
break trans;
} else if (mouse_x == 9 && mouse_y == 5) {
for (var num = 0; num < 64; num++) {
if (flags.comlist2[9][0] != "" && flags.comlist2[9][1] != 0) {
for (var i = 0; i < 9; i++) {
if (flags.comlist2[i][0] && flags.comlist2[i][1] <= 0) {
flags.comlist2[9] = ["", 0];
break trans;
}
}
core.addItem(flags.comlist2[9][0], flags.comlist2[9][1]);
for (var i = 0; i < 9; i++) {
if (flags.comlist2[i][1] > 0) {
flags.comlist2[i][1] -= 1;
}
}
} else {
flags.comlist2[9] = ["", 0];
break trans;
}
}
}
}
}
if (flags.comlist2[9][0] != "" && flags.comlist2[9][1] != 0) {
if (mouse_x == 9 && mouse_y == 5) {
if (flags.bag[0][0] == "" || (flags.bag[0][0] == flags.comlist2[9][0] && flags.bag[0][1] != 64)) {
flags.bag[0][0] = flags.comlist2[9][0];
flags.bag[0][1] += flags.comlist2[9][1];
} else {
core.addItem(flags.comlist2[9][0], flags.comlist2[9][1]);
}
for (var i = 0; i < 9; i++) {
if (flags.comlist2[i][1] > 0) {
flags.comlist2[i][1] -= 1;
}
}
flags.cursplit = 0;
}
}
}
} //熔炉界面点击事件
this.furInter = function (mouse_x, mouse_y) {
if (flags.interface == "熔炉") {
if (flags.transfer == 1) {
trans: for (var mx = 2; mx < 11; mx++) {
if ((mouse_x == mx && mouse_y == 12) || (mouse_x == mx && mouse_y == 8) || (mouse_x == mx && mouse_y == 9) || (mouse_x == mx && mouse_y == 10)) {
var cc;
if (mouse_y == 12) {
cc = mx - 1;
} else {
cc = mx - 1 + (mouse_y - 7) * 9;
}
for (var fm in flags.furGuide) {
if (flags.bag[cc][0] == fm) {
core.plugin.transfer(flags.bag[cc], flags.furnacelist[flags.box_xy], 1, 2, 1, -1);
break trans;
}
}
for (var ff in flags.fuelGuide) {
if (flags.bag[cc][0] == ff) {
core.plugin.transfer(flags.bag[cc], flags.furnacelist[flags.box_xy], 0, 1, 1, -1);
break trans;
}
}
} else if (mouse_x == 5 && mouse_y == 6) {
core.plugin.transfer(flags.furnacelist[flags.box_xy][0], flags.bag, 1, 37, 1, 1);
break trans;
} else if (mouse_x == 5 && mouse_y == 4) {
core.plugin.transfer(flags.furnacelist[flags.box_xy][1], flags.bag, 1, 37, 1, 1);
break trans;
} else if (mouse_x == 8 && mouse_y == 5) {
if (flags.furnacelist[flags.box_xy][2][0] != "" && flags.furnacelist[flags.box_xy][2][1] != 0) {
core.addItem(flags.furnacelist[flags.box_xy][2][0], flags.furnacelist[flags.box_xy][2][1]);
flags.furnacelist[flags.box_xy][2] = ["", 0];
} else {
break trans;
}
}
}
}
if (flags.furnacelist[flags.box_xy][2][0] != "" && flags.furnacelist[flags.box_xy][2][1] != 0 &&
(flags.bag[0][0] == "" ||
(flags.bag[0][0] == flags.furnacelist[flags.box_xy][2][0] && flags.bag[0][1] != 64))) {
if (mouse_x == 8 && mouse_y == 5) {
flags.bag[0][0] = flags.furnacelist[flags.box_xy][2][0];
flags.bag[0][1] += flags.furnacelist[flags.box_xy][2][1];
flags.furnacelist[flags.box_xy][2] = ["", 0];
}
}
if (flags.smeltcheck == 0) core.plugin.ronglujiance();
}
} //死亡界面点击事件
this.dieInter = function (mouse_x, mouse_y) {
if (core.status.hero.hp <= 0) {
if ((mouse_x == 4 && mouse_y == 7) || (mouse_x == 5 && mouse_y == 7) || (mouse_x == 6 && mouse_y == 7) || (mouse_x == 7 && mouse_y == 7) || (mouse_x == 8 && mouse_y == 7)) {
core.deleteCanvas("die");
for (var num = 0; num < 11; num++) {
if (flags.revive[3] && flags.revive[4] && flags.revive[5]) {
var rn = core.rand2(9) + 1;
var n = 0;
place: for (var i = -1; i <= 1; i++) {
for (var j = -1; j <= 1; j++) {
n += 1;
if (n == rn) {
flags.revivePo[0] = flags.revive[3];
flags.revivePo[1] = flags.revive[4] + i;
flags.revivePo[2] = flags.revive[5] + j;
break place;
}
}
}
} else {
var rn = core.rand2(49) + 1;
var n = 0;
place: for (var i = -3; i <= 3; i++) {
for (var j = -3; j <= 3; j++) {
n += 1;
if (n == rn) {
flags.revivePo[0] = flags.revive[0];
flags.revivePo[1] = flags.revive[1] + i;
flags.revivePo[2] = flags.revive[2] + j;
break place;
}
}
}
}
if (flags.revivePo[1] > 0 &&
flags.revivePo[1] < core.bigmap.width - 1 &&
flags.revivePo[2] > 0 &&
flags.revivePo[2] < core.bigmap.height - 1) {
core.plugin.jiazaitu("jz5.png", 1000);
flags.interface = "锁定";
core.setHeroLoc("x", flags.revivePo[1]);
core.setHeroLoc("y", flags.revivePo[2]);
core.changeFloor(flags.revivePo[0]);
break;
} else if (num == 10) {
core.plugin.jiazaitu("jz5.png", 1000);
flags.interface = "锁定";
flags.revive[3] = "";
flags.revive[4] = 0;
flags.revive[5] = 0;
core.setHeroLoc("x", flags.revive[1]);
core.setHeroLoc("y", flags.revive[2]);
core.changeFloor(flags.revive[0]);
}
}
flags.revivePo = ["", 0, 0];
core.status.hero.hp = core.status.hero.hpmax;
flags.interface = "物品栏";
} else if ((mouse_x == 4 && mouse_y == 9) || (mouse_x == 5 && mouse_y == 9) || (mouse_x == 6 && mouse_y == 9) || (mouse_x == 7 && mouse_y == 9) || (mouse_x == 8 && mouse_y == 9)) {
core.doSL(flags.worldlist["0"]["世界存档"][0], "save");
setTimeout(function () {
core.restart();
}, 100);
}
}
} //科技界面点击事件
this.techInter = function (px, py) {
if (px >= 350 && py >= 386 && flags.tech == 1) { //退出
//core.playSound("确定");
flags.tip[0] = "";
flags.tech = 0;
flags.interface = "物品栏";
return;
}
if (px >= 323 && px <= 392 && py >= 332 && py <= 379 && flags.tech >= 2) { //从小界面返回
//core.playSound("确定");
flags.tech = 1;
core.plugin.techUI();
return;
}
if (flags.tech == -1) { //从说明返回
flags.tech = 1;
core.plugin.techUI();
return;
} else if (px >= 368 && px <= 395 && py >= 9 && py <= 36 && flags.tech == 1) { //进入说明
flags.tech = -1;
core.plugin.techUI();
return;
}
if (px >= 255 && px <= 322 && py >= 332 && py <= 379 && flags.tech >= 2) { //升级
var num = 2;
for (var te in flags.tech1) {
if (flags.tech == num) {
if (flags.worldlevel < flags.tech3[te][2][flags.tech1[te][0] - 1]) {
core.playSound("确定");
flags.tip[0] = "需求世界等级未达到";
core.ui.drawStatusBar();
} else if (flags.tech1[te][0] < flags.tech1[te][1] && flags.tpointnum >= flags.tech3[te][0][flags.tech1[te][0] - 1] && flags.coppernum >= flags.tech3[te][1][flags.tech1[te][0] - 1]) {
core.playSound("levelup.ogg");
flags.tpointsum += flags.tech3[te][0][flags.tech1[te][0] - 1];
flags.tpointnum -= flags.tech3[te][0][flags.tech1[te][0] - 1];
flags.coppernum -= flags.tech3[te][1][flags.tech1[te][0] - 1];
flags.tech1[te][0] += 1;
core.plugin.upgradeTech(te, flags.tech1[te][0]);
flags.tip[0] = "升级成功";
core.ui.drawStatusBar();
} else {
core.playSound("确定");
flags.tip[0] = "科技点或钱币数量不足";
core.ui.drawStatusBar();
}
break;
} else {
num += 1;
}
}
core.plugin.techUI();
return;
}
if (flags.tech == 1) { //进入小界面
if (px >= 15 && px <= 212 && py >= 57 && py <= 114) {
//core.playSound("确定");
flags.tech = 2;
} else if (px >= 213 && px <= 415 && py >= 57 && py <= 114) {
//core.playSound("确定");
flags.tech = 3;
} else if (px >= 15 && px <= 212 && py >= 115 && py <= 171) {
//core.playSound("确定");
flags.tech = 4;
} else if (px >= 213 && px <= 415 && py >= 115 && py <= 171) {
//core.playSound("确定");
flags.tech = 5;
} else if (px >= 15 && px <= 212 && py >= 172 && py <= 228) {
//core.playSound("确定");
flags.tech = 6;
} else if (px >= 213 && px <= 415 && py >= 172 && py <= 228) {
//core.playSound("确定");
flags.tech = 7;
} else if (px >= 15 && px <= 212 && py >= 229 && py <= 285) {
//core.playSound("确定");
flags.tech = 8;
} else if (px >= 213 && px <= 415 && py >= 229 && py <= 285) {
//core.playSound("确定");
flags.tech = 9;
} else if (px >= 15 && px <= 212 && py >= 286 && py <= 342) {
//core.playSound("确定");
flags.tech = 10;
} else if (px >= 213 && px <= 415 && py >= 286 && py <= 342) {
//core.playSound("确定");
flags.tech = 11;
} else if (px >= 15 && px <= 212 && py >= 343 && py <= 399) {
//core.playSound("确定");
flags.tech = 12;
} else if (px >= 213 && px <= 415 && py >= 343 && py <= 385) {
//core.playSound("确定");
flags.tech = 13;
} else if (px >= 14 && px <= 155 && py >= 7 && py <= 43) {
if (flags.level[0] >= 5 && flags.tpointnum < 10) {
core.playSound("orb.ogg");
flags.level[0] -= 5;
flags.tpointnum += 1;
} else if (flags.level[0] < 5) {
core.playSound("确定");
flags.tip[0] = "至少需要5个等级才能兑换科技点";
core.ui.drawStatusBar();
} else if (flags.tpointnum >= 10) {
core.playSound("确定");
flags.tip[0] = "科技点已达上限";
core.ui.drawStatusBar();
}
}
core.plugin.techUI();
return;
}
} //升级科技实际效果
this.upgradeTech = function (name, lv) {
switch (name) {
case "灵感":
switch (lv) {
case 2:
flags.craftGuide1 = Object.assign({}, flags.craftGuide11, flags.craftGuide12);
flags.craftGuide2 = Object.assign({}, flags.craftGuide21, flags.craftGuide22);
break;
case 3:
flags.craftGuide1 = Object.assign({}, flags.craftGuide11, flags.craftGuide12, flags.craftGuide13);
flags.craftGuide2 = Object.assign({}, flags.craftGuide21, flags.craftGuide22, flags.craftGuide23);
break;
case 4:
flags.craftGuide1 = Object.assign({}, flags.craftGuide11, flags.craftGuide12, flags.craftGuide13, flags.craftGuide14);
flags.craftGuide2 = Object.assign({}, flags.craftGuide21, flags.craftGuide22, flags.craftGuide23, flags.craftGuide24);
break;
case 5:
flags.craftGuide1 = Object.assign({}, flags.craftGuide11, flags.craftGuide12, flags.craftGuide13, flags.craftGuide14, flags.craftGuide15);
flags.craftGuide2 = Object.assign({}, flags.craftGuide21, flags.craftGuide22, flags.craftGuide23, flags.craftGuide24, flags.craftGuide25);
break;
case 6:
flags.craftGuide1 = Object.assign({}, flags.craftGuide11, flags.craftGuide12, flags.craftGuide13, flags.craftGuide14, flags.craftGuide15, flags.craftGuide16);
flags.craftGuide2 = Object.assign({}, flags.craftGuide21, flags.craftGuide22, flags.craftGuide23, flags.craftGuide24, flags.craftGuide25, flags.craftGuide26);
break;
case 7:
flags.craftGuide1 = Object.assign({}, flags.craftGuide11, flags.craftGuide12, flags.craftGuide13, flags.craftGuide14, flags.craftGuide15, flags.craftGuide16, flags.craftGuide17);
flags.craftGuide2 = Object.assign({}, flags.craftGuide21, flags.craftGuide22, flags.craftGuide23, flags.craftGuide24, flags.craftGuide25, flags.craftGuide26, flags.craftGuide27);
break;
case 8:
flags.craftGuide1 = Object.assign({}, flags.craftGuide11, flags.craftGuide12, flags.craftGuide13, flags.craftGuide14, flags.craftGuide15, flags.craftGuide16, flags.craftGuide17, flags.craftGuide18);
flags.craftGuide2 = Object.assign({}, flags.craftGuide21, flags.craftGuide22, flags.craftGuide23, flags.craftGuide24, flags.craftGuide25, flags.craftGuide26, flags.craftGuide27, flags.craftGuide28);
break;
case 9:
flags.craftGuide1 = Object.assign({}, flags.craftGuide11, flags.craftGuide12, flags.craftGuide13, flags.craftGuide14, flags.craftGuide15, flags.craftGuide16, flags.craftGuide17, flags.craftGuide18, flags.craftGuide19);
flags.craftGuide2 = Object.assign({}, flags.craftGuide21, flags.craftGuide22, flags.craftGuide23, flags.craftGuide24, flags.craftGuide25, flags.craftGuide26, flags.craftGuide27, flags.craftGuide28, flags.craftGuide29);
break;
case 10:
flags.craftGuide1 = Object.assign({}, flags.craftGuide11, flags.craftGuide12, flags.craftGuide13, flags.craftGuide14, flags.craftGuide15, flags.craftGuide16, flags.craftGuide17, flags.craftGuide18, flags.craftGuide19, flags.craftGuide1a);
flags.craftGuide2 = Object.assign({}, flags.craftGuide21, flags.craftGuide22, flags.craftGuide23, flags.craftGuide24, flags.craftGuide25, flags.craftGuide26, flags.craftGuide27, flags.craftGuide28, flags.craftGuide29, flags.craftGuide2a);
break;
}
break;
case "领悟":
switch (lv) {
case 2:
flags.property.exp += 1;
break;
case 3:
flags.property.exp += 1;
break;
case 4:
flags.property.exp += 1;
break;
case 5:
flags.property.exp += 1;
break;
case 6:
flags.property.exp += 1;
break;
case 7:
flags.property.exp += 1;
break;
case 8:
flags.property.exp += 1;
break;
case 9:
flags.property.exp += 1;
break;
case 10:
flags.property.exp += 1;
break;
case 11:
flags.property.exp += 1;
break;
}
break;
case "生命之力":
switch (lv) {
case 2:
core.status.hero.hpmax += 4;
break;
case 3:
core.status.hero.hpmax += 4;
break;
case 4:
core.status.hero.hpmax += 4;
break;
case 5:
core.status.hero.hpmax += 6;
break;
case 6:
core.status.hero.hpmax += 6;
break;
case 7:
core.status.hero.hpmax += 6;
break;
case 8:
core.status.hero.hpmax += 6;
break;
case 9:
core.status.hero.hpmax += 8;
break;
case 10:
core.status.hero.hpmax += 8;
break;
case 11:
core.status.hero.hpmax += 8;
break;
}
break;
case "增幅":
switch (lv) {
case 2:
core.status.hero.atk += 1;
break;
case 3:
core.status.hero.atk += 1;
break;
case 4:
core.status.hero.atk += 2;
break;
case 5:
core.status.hero.atk += 2;
break;
case 6:
core.status.hero.atk += 3;
break;
case 7:
core.status.hero.atk += 3;
break;
case 8:
core.status.hero.atk += 4;
break;
case 9:
core.status.hero.atk += 4;
break;
case 10:
core.status.hero.atk += 4;
break;
case 11:
core.status.hero.atk += 4;
break;
}
break;
case "坚定":
switch (lv) {
case 2:
core.status.hero.def += 1;
break;
case 3:
core.status.hero.def += 1;
break;
case 4:
core.status.hero.def += 1;
break;
case 5:
core.status.hero.def += 1;
break;
case 6:
core.status.hero.def += 1;
break;
case 7:
core.status.hero.def += 1;
break;
case 8:
core.status.hero.def += 1;
break;
case 9:
core.status.hero.def += 1;
break;
case 10:
core.status.hero.def += 1;
break;
case 11:
core.status.hero.def += 1;
break;
}
break;
case "敏捷":
switch (lv) {
case 2:
flags.property.atkSpeed[0] += 1;
break;
case 3:
flags.property.atkSpeed[0] += 1;
break;
case 4:
flags.property.atkSpeed[0] += 1;
break;
case 5:
flags.property.atkSpeed[0] += 1;
break;
case 6:
flags.property.atkSpeed[0] += 1;
break;
case 7:
flags.property.atkSpeed[0] += 1;
break;
case 8:
flags.property.atkSpeed[0] += 1;
break;
case 9:
flags.property.atkSpeed[0] += 1;
break;
case 10:
flags.property.atkSpeed[0] += 1;
break;
case 11:
flags.property.atkSpeed[0] += 1;
break;
}
break;
case "耐力":
switch (lv) {
case 2:
flags.hunger[1] += 10;
break;
case 3:
flags.hunger[1] += 10;
break;
case 4:
flags.hunger[1] += 10;
break;
case 5:
flags.hunger[1] += 10;
break;
case 6:
flags.hunger[1] += 10;
break;
case 7:
flags.hunger[1] += 10;
break;
case 8:
flags.hunger[1] += 10;
break;
case 9:
flags.hunger[1] += 10;
break;
case 10:
flags.hunger[1] += 10;
break;
case 11:
flags.hunger[1] += 10;
break;
}
break;
case "空间扩展":
switch (lv) {
case 2:
flags.extraGrid += 3;
break;
case 3:
flags.extraGrid += 3;
break;
case 4:
flags.extraGrid += 3;
break;
case 5:
flags.extraGrid += 3;
break;
case 6:
flags.extraGrid += 3;
break;
case 7:
flags.extraGrid += 3;
break;
case 8:
flags.extraGrid += 3;
break;
case 9:
flags.extraGrid += 3;
break;
case 10:
flags.extraGrid += 3;
break;
}
break;
case "守护之韧":
switch (lv) {
case 2:
flags.extraDur[0] += 5;
break;
case 3:
flags.extraDur[0] += 5;
break;
case 4:
flags.extraDur[0] += 5;
break;
case 5:
flags.extraDur[0] += 5;
break;
case 6:
flags.extraDur[0] += 10;
break;
case 7:
flags.extraDur[0] += 10;
break;
case 8:
flags.extraDur[0] += 10;
break;
case 9:
flags.extraDur[0] += 15;
break;
case 10:
flags.extraDur[0] += 15;
break;
case 11:
flags.extraDur[0] += 20;
break;
}
break;
case "锋锐恒久":
switch (lv) {
case 2:
flags.extraDur[1] += 5;
break;
case 3:
flags.extraDur[1] += 5;
break;
case 4:
flags.extraDur[1] += 5;
break;
case 5:
flags.extraDur[1] += 5;
break;
case 6:
flags.extraDur[1] += 10;
break;
case 7:
flags.extraDur[1] += 10;
break;
case 8:
flags.extraDur[1] += 10;
break;
case 9:
flags.extraDur[1] += 15;
break;
case 10:
flags.extraDur[1] += 15;
break;
case 11:
flags.extraDur[1] += 20;
break;
}
break;
case "生机":
switch (lv) {
case 2:
flags.extraGrow += 1;
break;
case 3:
flags.extraGrow += 1;
break;
case 4:
flags.extraGrow += 1;
break;
case 5:
flags.extraGrow += 1;
break;
case 6:
flags.extraGrow += 1;
break;
case 7:
flags.extraGrow += 1;
break;
case 8:
flags.extraGrow += 1;
break;
case 9:
flags.extraGrow += 1;
break;
case 10:
flags.extraGrow += 1;
break;
case 11:
flags.extraGrow += 1;
break;
}
break;
case "商贾之道": //未做
switch (lv) {
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
case 8:
break;
case 9:
break;
case 10:
break;
case 11:
break;
}
break;
}
} //自定义按键界面点击事件
this.keyInter = function (px, py) {
if (flags.CustomKey == 1) {
if (px >= 344 && py >= 370) {
//core.playSound("确定");
flags.tip[0] = "";
flags.CustomKey = 0;
flags.interface = "物品栏";
return;
} else if (px >= 87 && px <= 204 && py >= 366 && py <= 406) {
//core.playSound("确定");
if (flags.pagenumber >= 2) {
flags.pagenumber -= 1;
} else {
flags.tip[0] = "已经是第一页了";
core.ui.drawStatusBar();
}
} else if (px >= 234 && px <= 340 && py >= 366 && py <= 406) {
//core.playSound("确定");
if (flags.pagenumber <= 2) {
flags.pagenumber += 1;
} else {
flags.tip[0] = "已经是第一页了";
core.ui.drawStatusBar();
}
} else if (px >= 272 && px <= 372 && py >= 82 && py <= 112) {
//core.playSound("确定");
flags.curKey = 1 + (flags.pagenumber - 1) * 6;
flags.tip[0] = "请按下你希望设置的按键";
core.ui.drawStatusBar();
} else if (px >= 272 && px <= 372 && py >= 128 && py <= 158) {
//core.playSound("确定");
flags.curKey = 2 + (flags.pagenumber - 1) * 6;
flags.tip[0] = "请按下你希望设置的按键";
core.ui.drawStatusBar();
} else if (px >= 272 && px <= 372 && py >= 174 && py <= 204) {
//core.playSound("确定");
flags.curKey = 3 + (flags.pagenumber - 1) * 6;
flags.tip[0] = "请按下你希望设置的按键";
core.ui.drawStatusBar();
} else if (px >= 272 && px <= 372 && py >= 220 && py <= 250) {
//core.playSound("确定");
flags.curKey = 4 + (flags.pagenumber - 1) * 6;
flags.tip[0] = "请按下你希望设置的按键";
core.ui.drawStatusBar();
} else if (px >= 272 && px <= 372 && py >= 266 && py <= 296) {
//core.playSound("确定");
flags.curKey = 5 + (flags.pagenumber - 1) * 6;
flags.tip[0] = "请按下你希望设置的按键";
core.ui.drawStatusBar();
} else if (px >= 272 && px <= 372 && py >= 312 && py <= 342) {
//core.playSound("确定");
flags.curKey = 6 + (flags.pagenumber - 1) * 6;
flags.tip[0] = "请按下你希望设置的按键";
core.ui.drawStatusBar();
}
core.plugin.zidingyianjian();
}
} //属性界面点击事件
this.attrInter = function (px, py) {
if (flags.attrui == 1) {
if (px >= 74 && px <= 343 && py >= 42 && py <= 377) {
if (px >= 266 && px <= 342 && py >= 339 && py <= 376) {
flags.tip[0] = "";
flags.attrui = 0;
flags.interface = "物品栏";
return;
} else if (px >= 87 && px <= 199 && py >= 107 && py <= 127) {
flags.tip[0] = "1颗心等于2生命饱食度>\r[#61fff3]90%\r时会缓慢恢复生命";
core.ui.drawStatusBar();
} else if (px >= 87 && px <= 217 && py >= 128 && py <= 148) {
flags.tip[0] = "各项操作会消耗饱食度饱食度为0则\r[#61fff3]消耗生命\r可通过\r[#61fff3]饮食\r回复饱食度";
core.ui.drawStatusBar();
} else if (px >= 87 && px <= 212 && py >= 149 && py <= 169) {
flags.tip[0] = "不同武器有着不同的攻速,攻速条未满时会在\r[#61fff3]物品栏左侧\r显示出来";
core.ui.drawStatusBar();
} else if (px >= 225 && px <= 317 && py >= 107 && py <= 127) {
flags.tip[0] = "可以与5X5范围内的方块进行交互";
core.ui.drawStatusBar();
} else if (px >= 225 && px <= 317 && py >= 128 && py <= 148) {
flags.tip[0] = "可以对" + (flags.property.touchRange[0] * 2 + 1) + "X" + (flags.property.touchRange[0] * 2 + 1) + "范围内的生物进行攻击";
core.ui.drawStatusBar();
} else if (px >= 225 && px <= 317 && py >= 149 && py <= 169) {
flags.tip[0] = "击杀敌怪时的额外经验加成";
core.ui.drawStatusBar();
} else if (px >= 87 && px <= 152 && py >= 189 && py <= 208) {
flags.tip[0] = "核心属性,直接影响着击杀生物的次数";
core.ui.drawStatusBar();
} else if (px >= 87 && px <= 179 && py >= 209 && py <= 228) {
flags.tip[0] = "仅在面对\r[#61fff3]海洋生物\r时造成更多伤害";
core.ui.drawStatusBar();
} else if (px >= 87 && px <= 179 && py >= 229 && py <= 248) {
flags.tip[0] = "仅在面对\r[#61fff3]飞行生物\r时造成更多伤害";
core.ui.drawStatusBar();
} else if (px >= 87 && px <= 179 && py >= 249 && py <= 268) {
flags.tip[0] = "小于1时对生物造成百分比攻击力的伤害大于1时对生物造成固定数值的额外伤害";
core.ui.drawStatusBar();
} else if (px >= 87 && px <= 179 && py >= 269 && py <= 288) {
flags.tip[0] = "对目标3X3范围的\r[#61fff3]其他生物\r造成额外伤害该伤害无视防御";
core.ui.drawStatusBar();
} else if (px >= 87 && px <= 152 && py >= 289 && py <= 308) {
flags.tip[0] = "根据暴击系数造成伤害";
core.ui.drawStatusBar();
} else if (px >= 225 && px <= 294 && py >= 189 && py <= 208) {
flags.tip[0] = "抵挡\r[#61fff3]物理伤害\r对走位良好的玩家可能不是必需的";
core.ui.drawStatusBar();
} else if (px >= 225 && px <= 294 && py >= 209 && py <= 228) {
flags.tip[0] = "对即将到来的\r[#61fff3]物理伤害\r进行一定系数的减免";
core.ui.drawStatusBar();
} else if (px >= 225 && px <= 322 && py >= 229 && py <= 248) {
flags.tip[0] = "仅对\r[#61fff3]爆炸\r进行一定系数的伤害减免";
core.ui.drawStatusBar();
} else if (px >= 225 && px <= 332 && py >= 249 && py <= 268) {
flags.tip[0] = "仅对\r[#61fff3]远程物理伤害\r进行一定系数的减免";
core.ui.drawStatusBar();
} else if (px >= 225 && px <= 294 && py >= 269 && py <= 288) {
flags.tip[0] = "受到伤害时,对目标反弹一定伤害";
core.ui.drawStatusBar();
} else if (px >= 225 && px <= 294 && py >= 289 && py <= 308) {
flags.tip[0] = "无敌期间免疫物理伤害和魔法伤害";
core.ui.drawStatusBar();
}
} else {
flags.tip[0] = "";
flags.attrui = 0;
flags.interface = "物品栏";
return;
}
core.plugin.attrshow();
}
} //委托界面点击事件
this.taskInter = function (px, py) {
if (flags.taskui == 1) {
if (px >= 12 && px <= 405 && py >= 41 && py <= 388) {
if (px >= 321 && px <= 405 && py >= 347 && py <= 388) {
flags.tip[0] = "";
flags.taskui = 0;
flags.interface = "物品栏";
return;
} else if (px >= 287 && px <= 402 && py >= 49 && py <= 94) {
flags.tip[0] = "每天0点收获1委托点刷新消耗1点直接领奖消耗5点无上限";
core.ui.drawStatusBar();
} else if (px >= 321 && px <= 388 && py >= 109 && py <= 144) {
flags.tip[0] = "刷新1";
core.ui.drawStatusBar();
} else if (px >= 321 && px <= 388 && py >= 145 && py <= 178) {
flags.tip[0] = "领取1";
core.ui.drawStatusBar();
} else if (px >= 321 && px <= 388 && py >= 193 && py <= 226) {
flags.tip[0] = "刷新2";
core.ui.drawStatusBar();
} else if (px >= 321 && px <= 388 && py >= 127 && py <= 261) {
flags.tip[0] = "领取2";
core.ui.drawStatusBar();
} else if (px >= 321 && px <= 388 && py >= 275 && py <= 310) {
flags.tip[0] = "刷新3";
core.ui.drawStatusBar();
} else if (px >= 321 && px <= 388 && py >= 311 && py <= 346) {
flags.tip[0] = "领取3";
core.ui.drawStatusBar();
}
} else {
flags.tip[0] = "";
flags.taskui = 0;
flags.interface = "物品栏";
return;
}
core.plugin.taskshow();
}
} //成就界面点击事件
this.achiInter = function (px, py) {
if (flags.achiui == 1) {
if (px >= 317 && px <= 416 && py >= 369 && py <= 416) {
flags.tip[0] = "";
flags.achiui = 0;
flags.interface = "物品栏";
return;
} else if (px >= 23 && px <= 104 && py >= 71 && py <= 94) {
flags.tip[0] = "历程类";
core.ui.drawStatusBar();
} else if (px >= 23 && px <= 104 && py >= 95 && py <= 122) {
flags.tip[0] = "收集类";
core.ui.drawStatusBar();
} else if (px >= 23 && px <= 104 && py >= 123 && py <= 149) {
flags.tip[0] = "挑战类";
core.ui.drawStatusBar();
} else if (px >= 23 && px <= 104 && py >= 150 && py <= 174) {
flags.tip[0] = "彩蛋类";
core.ui.drawStatusBar();
} else if (px >= 18 && px <= 109 && py >= 330 && py <= 375) {
flags.tip[0] = "提交成绩";
core.ui.drawStatusBar();
} else if (px >= 282 && px <= 333 && py >= 45 && py <= 67) {
flags.tip[0] = "上一页";
core.ui.drawStatusBar();
} else if (px >= 348 && px <= 403 && py >= 45 && py <= 67) {
flags.tip[0] = "下一页";
core.ui.drawStatusBar();
}
core.plugin.achishow();
}
} //自动农场界面点击事件
this.farmInter = function (px, py) {
if (flags.farmUI == 1) {
if (px >= 288 && px <= 336 && py >= 292 && py <= 316) {
flags.farmUI = 0;
} else if (px >= 224 && px <= 272 && py >= 292 && py <= 316) {
var farmc = flags.farmland1[flags.farmland2[flags.box_xy][0]][flags.farmland2[flags.box_xy][1] - 1];
if (flags.coppernum >= farmc && flags.farmland2[flags.box_xy][1] < 10) {
flags.coppernum -= farmc;
flags.farmland2[flags.box_xy][1] += 1;
core.plugin.zidongnongtian();
} else {
flags.tip[0] = "铜币不足或已满级";
core.ui.drawStatusBar();
}
} else if (px >= 120 && px <= 168 && py >= 292 && py <= 316) {
if (flags.cropslist[flags.farmland2[flags.box_xy][0]][3] != "") {
core.addItem(flags.cropslist[flags.farmland2[flags.box_xy][0]][3], flags.farmland2[flags.box_xy][2]);
}
if (flags.cropslist[flags.farmland2[flags.box_xy][0]][5] != "") {
core.addItem(flags.cropslist[flags.farmland2[flags.box_xy][0]][5], flags.farmland2[flags.box_xy][3]);
}
flags.farmland2[flags.box_xy][2] = 0;
flags.farmland2[flags.box_xy][3] = 0;
core.plugin.zidongnongtian();
}
}
} //MC界面点击光标位置
this.clickloc = function (x, y) {
if (flags.interface == "背包") {
for (var i = 2; i < 11; i++) {
if (x == i && y == 12) {
return i - 1;
} else if (x == i && y == 8) {
return i + 8;
} else if (x == i && y == 9) {
return i + 17;
} else if (x == i && y == 10) {
return i + 26;
}
}
if (x == 7 && y == 3) {
return 37;
} else if (x == 8 && y == 3) {
return 38;
} else if (x == 7 && y == 4) {
return 39;
} else if (x == 8 && y == 4) {
return 40;
}
} else if (flags.interface == "箱子") {
for (var i = 2; i < 11; i++) {
if (x == i && y == 12) {
return i - 1;
} else if (x == i && y == 8) {
return i + 8;
} else if (x == i && y == 9) {
return i + 17;
} else if (x == i && y == 10) {
return i + 26;
} else if (x == i && y == 1) {
return i + 35;
} else if (x == i && y == 2) {
return i + 44;
} else if (x == i && y == 3) {
return i + 53;
} else if (x == i && y == 4) {
return i + 62;
} else if (x == i && y == 5) {
return i + 71;
} else if (x == i && y == 6) {
return i + 80;
}
}
} else if (flags.interface == "工作台") {
for (var i = 2; i < 11; i++) {
if (x == i && y == 12) {
return i - 1;
} else if (x == i && y == 8) {
return i + 8;
} else if (x == i && y == 9) {
return i + 17;
} else if (x == i && y == 10) {
return i + 26;
}
}
if (x == 4 && y == 4) {
return 37;
} else if (x == 5 && y == 4) {
return 38;
} else if (x == 6 && y == 4) {
return 39;
} else if (x == 4 && y == 5) {
return 40;
} else if (x == 5 && y == 5) {
return 41;
} else if (x == 6 && y == 5) {
return 42;
} else if (x == 4 && y == 6) {
return 43;
} else if (x == 5 && y == 6) {
return 44;
} else if (x == 6 && y == 6) {
return 45;
}
} else if (flags.interface == "熔炉") {
for (var i = 2; i < 11; i++) {
if (x == i && y == 12) {
return i - 1;
} else if (x == i && y == 8) {
return i + 8;
} else if (x == i && y == 9) {
return i + 17;
} else if (x == i && y == 10) {
return i + 26;
}
}
if (x == 5 && y == 6) {
return 37;
} else if (x == 5 && y == 4) {
return 38;
}
}
} //按住shift快速转移物品
this.transfer = function (b1, b2, n1, n2, changeNum, isget) {
for (var i = 1; i < 6; i++) {
if (flags.interface == "背包" &&
b1[0] &&
core.material.items[b1[0]].cls == "equips" &&
core.getEquipTypeById(b1[0]) == i &&
!core.getEquip(i) &&
core.canEquip(b1[0])) {
b1[1] -= 1;
core.loadEquip(b1[0]);
core.playSound("armour.ogg");
flags.cursor2 = 0;
flags.curCache2 = [0, 0];
return;
}
}
for (var cur = n1; cur < n2; cur++) {
if (b1[0] && (b2[cur][0] == null || b2[cur][0] == "")) {
if (changeNum) core.addItem(b1[0], isget * b1[1]);
flags.bagCache = b2[cur][0];
b2[cur][0] = b1[0];
b1[0] = flags.bagCache;
var cn = b2[cur][1];
b2[cur][1] = b1[1];
b1[1] = cn;
if (b1[0] && changeNum) {
core.addItem(b1[0], -isget * b1[1]);
}
break;
} else if (b1[0] && b2[cur][0] == b1[0] && b2[cur][1] < 64) {
if (changeNum) core.addItem(b1[0], isget * b1[1]);
b2[cur][1] += b1[1];
b1[1] = 0;
if (b2[cur][1] > 64) {
if (changeNum) core.addItem(b1[0], -isget * (b1[1] + b2[cur][1] - 64));
b1[1] += b2[cur][1] - 64;
b2[cur][1] = 64;
core.plugin.transfer(b1, b2, n1, n2, changeNum, isget);
}
break;
}
}
flags.cursor2 = 0;
flags.curCache2 = [0, 0];
core.drawMC();
} //放方块音效播放
this.putsound = function (number) {
var rand1;
var sound = "";
var type = core.getBlockInfo(number).blocktype;
if (type == 1 || type == 6) {
rand1 = core.rand2(4);
switch (rand1) {
case 0:
sound = "stone1.ogg";
break;
case 1:
sound = "stone2.ogg";
break;
case 2:
sound = "stone3.ogg";
break;
case 3:
sound = "stone4.ogg";
break;
}
} else if (type == 2 || type == 5) {
rand1 = core.rand2(4);
switch (rand1) {
case 0:
sound = "wood1.ogg";
break;
case 1:
sound = "wood2.ogg";
break;
case 2:
sound = "wood3.ogg";
break;
case 3:
sound = "wood4.ogg";
break;
}
} else if (type == 3 || type == 4) {
switch (number) {
case 349:
rand1 = core.rand2(4);
switch (rand1) {
case 0:
sound = "gravel1.ogg";
break;
case 1:
sound = "gravel2.ogg";
break;
case 2:
sound = "gravel3.ogg";
break;
case 3:
sound = "gravel4.ogg";
break;
}
break;
case 343:
case 344:
rand1 = core.rand2(4);
switch (rand1) {
case 0:
sound = "sand1.ogg";
break;
case 1:
sound = "sand2.ogg";
break;
case 2:
sound = "sand3.ogg";
break;
case 3:
sound = "sand4.ogg";
break;
}
break;
case 342:
rand1 = core.rand2(4);
switch (rand1) {
case 0:
sound = "snow1.ogg";
break;
case 1:
sound = "snow2.ogg";
break;
case 2:
sound = "snow3.ogg";
break;
case 3:
sound = "snow4.ogg";
break;
}
break;
default:/*case 305 || 339 || 340 || 341 || 347 || 426 || 921:*/
rand1 = core.rand2(4);
switch (rand1) {
case 0:
sound = "grass1.ogg";
break;
case 1:
sound = "grass2.ogg";
break;
case 2:
sound = "grass3.ogg";
break;
case 3:
sound = "grass4.ogg";
break;
}
break;
}
}
core.playSound(sound);
} //挖方块音效播放
this.digsound = function (number) {
var sound = "";
var type = core.getBlockInfo(number).blocktype;
if (type == 1 || type == 6) {
sound = "dig_stone.ogg";
} else if (type == 2 || type == 5) {
sound = "dig_wood.ogg";
} else if (type == 3 || type == 4) {
switch (number) {
case 343:
case 344:
sound = "dig_sand.ogg";
break;
case 342:
sound = "dig_snow.ogg";
break;
default:
sound = "dig_grass.ogg";
break;
}
}
core.playSound(sound);
}
},
"3-右键点击": function () {
var myElement = document.getElementById('data');
myElement.addEventListener('contextmenu', function (e) {
//关闭右键菜单
event.preventDefault();
});
//主程序,当鼠标右键点击时进行判断
this.rightClick = function (mouse_x, mouse_y, px, py) {
//console.log("右键事件");
//console.log("右键坐标", mouse_x, mouse_y, px, py);
var offsetx = Math.round(core.bigmap.offsetX / 32);
var offsety = Math.round(core.bigmap.offsetY / 32);
if (flags.interface == "物品栏") {
flags.box_xy = ((mouse_x + offsetx) * 1000 + (mouse_y + offsety)).toString().padStart(6, '0') + core.status.floorId;
}
var sczz = 0;
for (var cr in flags.cropslist) {
if (flags.bag[flags.cursor1][0] == cr) {
sczz = 1;
break;
}
}
flags.cursplit = core.plugin.clickloc(mouse_x, mouse_y);
core.plugin.interUI(mouse_x, mouse_y, offsetx, offsety, sczz);
if (!flags.longleft) {
core.plugin.mcjiemian();
core.plugin.beibaocunchu();
}
flags.mingan = 0;
if (flags.bag[0][0] != "" && flags.interface != "物品栏" && flags.interface != "锁定") {
//core.ui._createUIEvent();
if (core.getContextByName("viscous") == null) {
core.createCanvas("viscous", 0, 0, 416, 416, 136);
} else {
core.clearMap('viscous');
}
core.drawIcon("viscous", flags.bag[0][0], px - 16, py - 16);
if (flags.bag[0][1] > 0 && flags.bag[0][1] < 10) {
core.ui.fillText("viscous", flags.bag[0][1].toString(), px - 16 + 20, py - 16 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[0][1] >= 10) {
core.ui.fillText("viscous", flags.bag[0][1].toString(), px - 16 + 12, py - 16 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else {
core.deleteCanvas('viscous');
core.clearMap('viscous');
}
if (core.getBlockCls(mouse_x + offsetx, mouse_y + offsety) == 'enemys' ||
core.getBlockCls(mouse_x + offsetx, mouse_y + offsety) == 'enemy48') {
var eid = ((mouse_x + offsetx) * 1000 + mouse_y + offsety).toString().padStart(6, '0') + core.status.floorId;
flags.rightstatus = ["敌怪", eid];
extend.update();
} else if (core.getFgNumber(mouse_x + offsetx, mouse_y + offsety)) {
flags.rightstatus = ["图块", core.getFgNumber(mouse_x + offsetx, mouse_y + offsety)];
extend.update();
} else if (core.getBlockCls(mouse_x + offsetx, mouse_y + offsety) == 'terrains') {
var cropid = ((mouse_x + offsetx) * 1000 + mouse_y + offsety).toString().padStart(6, '0') + core.status.floorId;
if (cropid in flags.crops) {
flags.rightstatus = ["图块", core.getMapNumber(mouse_x + offsetx, mouse_y + offsety), cropid];
} else {
flags.rightstatus = ["图块", core.getMapNumber(mouse_x + offsetx, mouse_y + offsety)];
}
extend.update();
} else if (core.getBgNumber(mouse_x + offsetx, mouse_y + offsety)) {
flags.rightstatus = ["图块", core.getBgNumber(mouse_x + offsetx, mouse_y + offsety)];
extend.update();
} else {
flags.rightstatus = ["", ""];
extend.update();
}
};
//右键打开交互界面
this.interUI = function (mouse_x, mouse_y, offsetx, offsety, sczz) {
for (var i = -flags.property.touchRange[1]; i <= flags.property.touchRange[1]; i++) {
for (var j = -flags.property.touchRange[1]; j <= flags.property.touchRange[1]; j++) {
if (mouse_x + offsetx == core.status.hero.loc.x + i && mouse_y + offsety == core.status.hero.loc.y + j) {
if (flags.interface == "物品栏") {
if (core.getBlockId(mouse_x + offsetx, mouse_y + offsety) == "T420" ||
core.getBlockId(mouse_x + offsetx, mouse_y + offsety) == "T425") {
if (!flags.boxlist[flags.box_xy]) flags.boxlist[flags.box_xy] = [["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0],];
flags.interface = "箱子";
flags.cursplit = 0;
if (core.getBlockId(mouse_x + offsetx, mouse_y + offsety) == "T420") {
core.playSound("chestopen.ogg");
}
if (core.getBlockId(mouse_x + offsetx, mouse_y + offsety) == "T425") {
flags.discard = 1;
}
return;
} else if (core.getBlockId(mouse_x + offsetx, mouse_y + offsety) == "T414") {
flags.interface = "工作台";
flags.cursplit = 0;
return;
} else if (core.getBlockId(mouse_x + offsetx, mouse_y + offsety) == "T415") {
if (!flags.furnacelist[flags.box_xy]) {
flags.furnacelist[flags.box_xy] = [["", 0], ["", 0], ["", 0]];
flags.furnacelist[flags.box_xy][3] = [-1, 0];
}
flags.interface = "熔炉";
flags.cursplit = 0;
return;
} else if (core.getBlockId(mouse_x + offsetx, mouse_y + offsety) == "T309") {
if (!flags.farmland2[flags.box_xy]) {
flags.farmland2[flags.box_xy] = ["I492", 1];
flags.crops[flags.box_xy] = ["I492", 0, flags.cropslist["I492"][0], 1];
}
core.plugin.zidongnongtian();
flags.cursplit = 0;
return;
} else if (core.getBlockId(mouse_x + offsetx, mouse_y + offsety) == "T310") {
if (!flags.farmland2[flags.box_xy]) {
flags.farmland2[flags.box_xy] = ["I507", 1];
flags.crops[flags.box_xy] = ["I507", 0, flags.cropslist["I507"][0], 1];
}
core.plugin.zidongnongtian();
flags.cursplit = 0;
return;
} else if (core.getBlockId(mouse_x + offsetx, mouse_y + offsety) == "T312") {
if (!flags.farmland2[flags.box_xy]) {
flags.farmland2[flags.box_xy] = ["I508", 1];
flags.crops[flags.box_xy] = ["I508", 0, flags.cropslist["I508"][0], 1];
}
core.plugin.zidongnongtian();
flags.cursplit = 0;
return;
} else if (core.getBlockId(mouse_x + offsetx, mouse_y + offsety) == "T419") {
core.plugin.chongshengdian(mouse_x + offsetx, mouse_y + offsety, core.status.floorId);
if (flags.timePeriod == "夜晚") {
flags.sleep = 0;
flags.interface = "锁定";
core.lockControl();
function sleep(time) {
setTimeout(function () {
time -= 100;
if (time <= 0) {
if ((flags.time >= 1200 && flags.time < 1440) ||
(flags.time >= 0 && flags.time < 240)) {
flags.time = 240;
}
core.plugin.drawLight('fg2', 1 - Math.abs(time / 1500), [[0, 0, 0]], 1);
if (time <= -1500) {
flags.interface = "物品栏";
core.unlockControl();
return;
}
sleep(time);
} else if (time <= 500) {
core.plugin.drawLight('fg2', 1, [[0, 0, 0]], 1);
sleep(time);
} else {
core.plugin.drawLight('fg2', 1 - Math.abs((time - 500) / 2500), [[0, 0, 0]], 1);
sleep(time);
}
}, 100);
}
sleep(3000);
}
return;
}
} else {
return;
}
}
}
}
core.plugin.plant(mouse_x, mouse_y, offsetx, offsety, sczz);
core.plugin.putBlock(mouse_x, mouse_y, offsetx, offsety, sczz);
} //主手栏为种子时,点击触碰范围内的耕地背景块放置幼苗
this.plant = function (mouse_x, mouse_y, offsetx, offsety, sczz) {
var offsetx = Math.round(core.bigmap.offsetX / 32);
var offsety = Math.round(core.bigmap.offsetY / 32);
if (sczz == 1) {
plant: for (var i = -flags.property.touchRange[1]; i <= flags.property.touchRange[1]; i++) {
for (var j = -flags.property.touchRange[1]; j <= flags.property.touchRange[1]; j++) {
if (mouse_x + offsetx == core.status.hero.loc.x + i &&
mouse_y + offsety == core.status.hero.loc.y + j &&
!core.getMapNumber(mouse_x + offsetx, mouse_y + offsety)) {
for (var cr in flags.cropslist) {
if (flags.bag[flags.cursor1][0] == cr) {
if (core.getBgNumber(mouse_x + offsetx, mouse_y + offsety) == flags.cropslist[cr][2][0] ||
core.getBgNumber(mouse_x + offsetx, mouse_y + offsety) == flags.cropslist[cr][2][1] ||
core.getBgNumber(mouse_x + offsetx, mouse_y + offsety) == flags.cropslist[cr][2][2] ||
core.getBgNumber(mouse_x + offsetx, mouse_y + offsety) == flags.cropslist[cr][2][3] ||
core.getBgNumber(mouse_x + offsetx, mouse_y + offsety) == flags.cropslist[cr][2][4]) {
core.playSound("grass2.ogg");
flags.bag[flags.cursor1][1] -= 1;
core.addItem(flags.bag[flags.cursor1][0], -1);
core.setBlock(flags.cropslist[cr][1][0], mouse_x + offsetx, mouse_y + offsety);
flags.crops[flags.box_xy] = [cr, 0, flags.cropslist[cr][0]];
core.plugin.plantgrow(flags.box_xy);
core.plugin.baoshidu();
core.plugin.beibaocunchu();
}
break plant;
}
}
}
}
}
}
} //在玩家触碰范围内放置方块,背景->事件->前景
this.putBlock = function (mouse_x, mouse_y, offsetx, offsety, sczz) {
var offsetx = Math.round(core.bigmap.offsetX / 32);
var offsety = Math.round(core.bigmap.offsetY / 32);
if (sczz == 0) {
var bg = core.getBgNumber(mouse_x + offsetx, mouse_y + offsety);
var bc = core.getMapNumber(mouse_x + offsetx, mouse_y + offsety);
var fg = core.getFgNumber(mouse_x + offsetx, mouse_y + offsety);
put: for (var i = -flags.property.touchRange[1]; i <= flags.property.touchRange[1]; i++) {
for (var j = -flags.property.touchRange[1]; j <= flags.property.touchRange[1]; j++) {
if (mouse_x + offsetx == core.status.hero.loc.x + i && mouse_y + offsety == core.status.hero.loc.y + j) {
if (bg != 0 && bc != 0 && fg != 0) {
if (mouse_x + offsetx != core.status.hero.loc.x || mouse_y + offsety != core.status.hero.loc.y) return;
function godown(floor) {
core.changeFloor(floor, void 0, { x: core.status.hero.loc.x, y: core.status.hero.loc.y, direction: 'down' }, 500,);
flags.dimension = ["主世界", "地表"];
}
switch (core.status.floorId) {
case "dong1":
godown("zhu7");
break;
case "dong2":
godown("zhu8");
break;
case "dong3":
godown("zhu9");
break;
case "dong4":
godown("zhu12");
break;
case "dong5":
godown("zhu13");
break;
case "dong6":
godown("zhu14");
break;
case "dong7":
godown("zhu17");
break;
case "dong8":
godown("zhu18");
break;
case "dong9":
godown("zhu19");
break;
}
break put;
}
for (var b in flags.ffk) {
if (b == flags.bag[flags.cursor1][0]) {
switch (flags.ffk[b][2][0]) {
case 0:
if (bg == 0 && flags.ffk[b][1][0] == 1) {
core.plugin.putsound(flags.ffk[b][0][0]);
core.setBgFgBlock('bg', flags.ffk[b][0][0], mouse_x + offsetx, mouse_y + offsety);
flags.bag[flags.cursor1][1] -= 1;
core.addItem(flags.bag[flags.cursor1][0], -1);
core.plugin.baoshidu();
} else if (bg != 0 && bc == 0 && flags.ffk[b][1][1] == 1) {
core.plugin.putsound(flags.ffk[b][0][0]);
core.setBlock(flags.ffk[b][0][0], mouse_x + offsetx, mouse_y + offsety);
flags.bag[flags.cursor1][1] -= 1;
core.addItem(flags.bag[flags.cursor1][0], -1);
core.plugin.baoshidu();
} else if (bg != 0 && bc != 0 && fg == 0 && flags.ffk[b][1][2] == 1) {
core.plugin.putsound(flags.ffk[b][0][0]);
core.setBgFgBlock('fg', flags.ffk[b][0][0], mouse_x + offsetx, mouse_y + offsety);
flags.bag[flags.cursor1][1] -= 1;
core.addItem(flags.bag[flags.cursor1][0], -1);
core.plugin.baoshidu();
}
break;
case 1:
if (bc == 0 && (
bg == flags.ffk[b][2][1] ||
bg == flags.ffk[b][2][2] ||
bg == flags.ffk[b][2][3] ||
bg == flags.ffk[b][2][4] ||
bg == flags.ffk[b][2][5] ||
bg == flags.ffk[b][2][6] ||
bg == flags.ffk[b][2][7] ||
bg == flags.ffk[b][2][8] ||
bg == flags.ffk[b][2][9])) {
core.plugin.putsound(flags.ffk[b][0][0]);
core.setBlock(flags.ffk[b][0][0], mouse_x + offsetx, mouse_y + offsety);
flags.bag[flags.cursor1][1] -= 1;
core.addItem(flags.bag[flags.cursor1][0], -1);
core.plugin.baoshidu();
}
break;
case 2:
if (fg == 0 && (
bc == flags.ffk[b][2][1] ||
bc == flags.ffk[b][2][2] ||
bc == flags.ffk[b][2][3] ||
bc == flags.ffk[b][2][4] ||
bc == flags.ffk[b][2][5] ||
bc == flags.ffk[b][2][6] ||
bc == flags.ffk[b][2][7] ||
bc == flags.ffk[b][2][8] ||
bc == flags.ffk[b][2][9])) {
core.plugin.putsound(flags.ffk[b][0][0]);
core.setBgFgBlock('fg', flags.ffk[b][0][0], mouse_x + offsetx, mouse_y + offsety);
flags.bag[flags.cursor1][1] -= 1;
core.addItem(flags.bag[flags.cursor1][0], -1);
core.plugin.baoshidu();
}
break;
case 3:
if (bc == 0 && (
fg == flags.ffk[b][2][1] ||
fg == flags.ffk[b][2][2] ||
fg == flags.ffk[b][2][3] ||
fg == flags.ffk[b][2][4] ||
fg == flags.ffk[b][2][5] ||
fg == flags.ffk[b][2][6] ||
fg == flags.ffk[b][2][7] ||
fg == flags.ffk[b][2][8] ||
fg == flags.ffk[b][2][9])) {
core.plugin.putsound(flags.ffk[b][0][0]);
core.setBlock(flags.ffk[b][0][0], mouse_x + offsetx, mouse_y + offsety);
flags.bag[flags.cursor1][1] -= 1;
core.addItem(flags.bag[flags.cursor1][0], -1);
core.plugin.baoshidu();
}
break;
case 4:
break;
case 5: //305,339,340,341,921
if (bc == 0 && fg == 0 && (
bg == 305 ||
bg == 339 ||
bg == 340 ||
bg == 341 ||
bg == 921)) {
core.plugin.putsound(flags.ffk[b][0][0]);
core.setBgFgBlock('bg', flags.ffk[b][0][0], mouse_x + offsetx, mouse_y + offsety);
flags.dig = [0, 0, 0, 0, 0];
core.plugin.reduceDur("tool");
core.plugin.baoshidu();
}
break;
case 6:
if (bg == 0 && flags.ffk[b][1][0] == 1) {
function change1(x, y) {
if (core.getBgNumber(x, y) == 305) {
return 305;
} else if (core.getBgNumber(x, y) == 339) {
return 339
} else if (core.getBgNumber(x, y) == 340) {
return 340;
} else if (core.getBgNumber(x, y) == 341) {
return 341;
} else {
return 0;
}
}
function change2(x, y) {
if (change1(x, y - 1) != 0) {
core.plugin.putsound(change1(x, y - 1));
core.setBgFgBlock('bg', change1(x, y - 1), x, y);
} else if (change1(x, y + 1) != 0) {
core.plugin.putsound(change1(x, y + 1));
core.setBgFgBlock('bg', change1(x, y + 1), x, y);
} else if (change1(x - 1, y) != 0) {
core.plugin.putsound(change1(x - 1, y));
core.setBgFgBlock('bg', change1(x - 1, y), x, y);
} else if (change1(x + 1, y) != 0) {
core.plugin.putsound(change1(x + 1, y));
core.setBgFgBlock('bg', change1(x + 1, y), x, y);
} else {
core.plugin.putsound(921);
core.setBgFgBlock('bg', 921, x, y);
}
}
change2(mouse_x + offsetx, mouse_y + offsety);
flags.bag[flags.cursor1][1] -= 1;
core.addItem(flags.bag[flags.cursor1][0], -1);
core.plugin.baoshidu();
} else if (bc == 0 && flags.ffk[b][1][1] == 1) {
core.plugin.putsound(flags.ffk[b][0][0]);
core.setBlock(flags.ffk[b][0][0], mouse_x + offsetx, mouse_y + offsety);
flags.bag[flags.cursor1][1] -= 1;
core.addItem(flags.bag[flags.cursor1][0], -1);
core.plugin.baoshidu();
} else if (fg == 0 && flags.ffk[b][1][2] == 1) {
core.plugin.putsound(flags.ffk[b][0][0]);
core.setBgFgBlock('fg', flags.ffk[b][0][0], mouse_x + offsetx, mouse_y + offsety);
flags.bag[flags.cursor1][1] -= 1;
core.addItem(flags.bag[flags.cursor1][0], -1);
core.plugin.baoshidu();
}
break;
case 7:
if (bg == 0 && flags.ffk[b][1][0] == 1) {
if (core.getBgNumber(mouse_x + offsetx, mouse_y + offsety - 1) == 345) {
core.plugin.putsound(345);
core.setBgFgBlock('bg', 345, mouse_x + offsetx, mouse_y + offsety);
} else {
core.plugin.putsound(348);
core.setBgFgBlock('bg', 348, mouse_x + offsetx, mouse_y + offsety);
}
flags.bag[flags.cursor1][1] -= 1;
core.addItem(flags.bag[flags.cursor1][0], -1);
flags.bag[flags.cursor1] = ["I654", 1];
core.addItem(flags.bag[flags.cursor1][0], 1);
core.plugin.baoshidu();
} else if (fg == 0 && flags.ffk[b][1][2] == 1) {
core.plugin.putsound(flags.ffk[b][0][0]);
core.setBgFgBlock('fg', flags.ffk[b][0][0], mouse_x + offsetx, mouse_y + offsety);
flags.bag[flags.cursor1][1] -= 1;
core.addItem(flags.bag[flags.cursor1][0], -1);
flags.bag[flags.cursor1] = ["I654", 1];
core.addItem(flags.bag[flags.cursor1][0], 1);
core.plugin.baoshidu();
}
break;
case 8:
if (bg == 0 && flags.ffk[b][1][1] == 1) {
if (core.getBgNumber(mouse_x + offsetx, mouse_y + offsety - 1) == 305 ||
core.getBgNumber(mouse_x + offsetx, mouse_y + offsety - 1) == 339 ||
core.getBgNumber(mouse_x + offsetx, mouse_y + offsety - 1) == 340 ||
core.getBgNumber(mouse_x + offsetx, mouse_y + offsety - 1) == 341) {
core.plugin.putsound(372);
core.setBlock(372, mouse_x + offsetx, mouse_y + offsety);
} else if (core.getBgNumber(mouse_x + offsetx, mouse_y + offsety - 1) == 345 ||
core.getBgNumber(mouse_x + offsetx, mouse_y + offsety - 1) == 348) {
core.plugin.putsound(393);
core.setBlock(393, mouse_x + offsetx, mouse_y + offsety);
}
flags.bag[flags.cursor1][1] -= 1;
core.addItem(flags.bag[flags.cursor1][0], -1);
core.plugin.baoshidu();
}
break;
default:
break;
}
break put;
}
}
}
}
}
}
}
},
"4-鼠标长按": function () {
this.leftMouseDown = function (mouse_x, mouse_y) {
//console.log('左键按下');
flags.longleft = 1;
}
this.leftMouseUp = function () {
//console.log('左键松开');
flags.longleft = 0;
flags.curarr = [];
flags.bagbp = [];
flags.splitCache1 = 0;
flags.splitCache2 = {};
if (flags.bag[0][0] == "" || flags.bag[0][1] <= 0) {
flags.bag[0] = ["", 0];
core.deleteCanvas('viscous');
//core.clearMap('viscous');
}
}
this.rightMouseDown = function () {
//console.log('右键按下');
if (flags.longleft) return;
flags.longright = 1;
}
this.rightMouseUp = function () {
//console.log('右键松开');
if (flags.longleft) return;
flags.longright = 0;
flags.curarr = [];
flags.bagbp = [];
}
},
"5-鼠标移动": function () {
//注册一个鼠标移动行为函数
core.registerAction(
'onmove',
'onmoved',
function (mouse_x, mouse_y, px, py) {
core.plugin.onmoved(mouse_x, mouse_y, px, py);
return false;
},
100
);
//主程序,当鼠标移动时进行判断
this.onmoved = function (mouse_x, mouse_y, px, py) {
if (!window.core) return;
if (!core.isPlaying) return;
if (!flags.bag) return;
if (flags.interface != "锁定" && flags.interface != "物品栏") {
function durDisplay(b1) {
if (b1[0] != "") {
if (core.material.items[b1[0]].cls == "equips") {
if (b1[0] in flags.weapon) {
core.plugin.equipInfo(flags.weapon, flags.weaDur, b1[0], mouse_x, mouse_y);
} else if (b1[0] in flags.tool) {
core.plugin.equipInfo(flags.tool, flags.toolDur, b1[0], mouse_x, mouse_y);
} else if (b1[0] in flags.equip) {
core.plugin.equipInfo(flags.equip, flags.equDur, b1[0], mouse_x, mouse_y);
}
core.deleteCanvas("itemtext");
//core.clearMap('itemtext');
} else {
core.plugin.itemText(b1[0], mouse_x, mouse_y);
core.deleteCanvas("durable");
//core.clearMap('durable');
}
} else {
//core.deleteCanvas("durable");
core.clearMap('durable');
//core.deleteCanvas("itemtext");
core.clearMap('itemtext');
}
}
var xianshi = 0;
for (var mx = 2; mx < 11; mx++) {
if ((mouse_x == mx && mouse_y == 12) ||
(mouse_x == mx && mouse_y == 8) ||
(mouse_x == mx && mouse_y == 9) ||
(mouse_x == mx && mouse_y == 10)) {
var cc;
if (mouse_y == 12) cc = mx - 1;
else cc = mx - 1 + (mouse_y - 7) * 9;
durDisplay(flags.bag[cc]);
xianshi = 1;
break;
}
}
if (xianshi == 0) {
if (flags.interface == "背包") {
if (mouse_x == 2 && mouse_y == 3 && core.getEquip(2)) {
core.plugin.equipInfo(flags.equip, flags.equDur, core.getEquip(2), mouse_x, mouse_y);
xianshi = 1;
}
else if (mouse_x == 2 && mouse_y == 4 && core.getEquip(3)) {
core.plugin.equipInfo(flags.equip, flags.equDur, core.getEquip(3), mouse_x, mouse_y);
xianshi = 1;
}
else if (mouse_x == 2 && mouse_y == 5 && core.getEquip(4)) {
core.plugin.equipInfo(flags.equip, flags.equDur, core.getEquip(4), mouse_x, mouse_y);
xianshi = 1;
}
else if (mouse_x == 2 && mouse_y == 6 && core.getEquip(5)) {
core.plugin.equipInfo(flags.equip, flags.equDur, core.getEquip(5), mouse_x, mouse_y);
xianshi = 1;
}
else if (mouse_x == 6 && mouse_y == 6 && core.getEquip(1)) {
core.plugin.equipInfo(flags.equip, flags.equDur, core.getEquip(1), mouse_x, mouse_y);
xianshi = 1;
}
else if ((mouse_x == 7 && mouse_y == 3) ||
(mouse_x == 7 && mouse_y == 4) ||
(mouse_x == 8 && mouse_y == 3) ||
(mouse_x == 8 && mouse_y == 4)) {
var cc = mouse_x - 7 + (mouse_y - 3) * 2;
durDisplay(flags.comlist1[cc]);
xianshi = 1;
} else if (mouse_x == 10 && mouse_y == 4) {
durDisplay(flags.comlist1[4]);
xianshi = 1;
}
} else if (flags.interface == "箱子") {
for (var mx = 2; mx < 11; mx++) {
if ((mouse_x == mx && mouse_y == 1) ||
(mouse_x == mx && mouse_y == 2) ||
(mouse_x == mx && mouse_y == 3) ||
(mouse_x == mx && mouse_y == 4) ||
(mouse_x == mx && mouse_y == 5) ||
(mouse_x == mx && mouse_y == 6)) {
var cc = mx - 2 + (mouse_y - 1) * 9;
durDisplay(flags.boxlist[flags.box_xy][cc]);
xianshi = 1;
break;
}
}
} else if (flags.interface == "工作台") {
if (mouse_x >= 4 && mouse_x <= 6 && mouse_y >= 4 && mouse_y <= 6) {
var cc = (mouse_x - 4) + (mouse_y - 4) * 3;
durDisplay(flags.comlist2[cc]);
xianshi = 1;
} else if (mouse_x == 9 && mouse_y == 5) {
durDisplay(flags.comlist2[9]);
xianshi = 1;
}
} else if (flags.interface == "熔炉") {
if (mouse_x == 5 && mouse_y == 4) {
durDisplay(flags.furnacelist[flags.box_xy][1]);
xianshi = 1;
}
else if (mouse_x == 5 && mouse_y == 6) {
durDisplay(flags.furnacelist[flags.box_xy][0]);
xianshi = 1;
}
else if (mouse_x == 8 && mouse_y == 5) {
durDisplay(flags.furnacelist[flags.box_xy][2]);
xianshi = 1;
}
}
}
if (xianshi == 0) {
//core.deleteCanvas("durable");
core.clearMap('durable');
//core.deleteCanvas("itemtext");
core.clearMap('itemtext');
}
if (flags.bag != undefined && flags.bag[0][0] != "") {
if (flags.longleft || flags.bag[0][1] > 0) {
//core.ui._createUIEvent();
if (core.getContextByName("viscous") == null) {
core.createCanvas("viscous", 0, 0, 416, 416, 136);
} else {
core.clearMap('viscous');
}
core.drawIcon("viscous", flags.bag[0][0], px - 16, py - 16);
if (flags.bag[0][1] > 0 && flags.bag[0][1] < 10) {
core.ui.fillText("viscous", flags.bag[0][1].toString(), px - 16 + 20, py - 16 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[0][1] >= 10) {
core.ui.fillText("viscous", flags.bag[0][1].toString(), px - 16 + 12, py - 16 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
}
core.plugin.highLight(mouse_x, mouse_y);
if (flags.transfer && flags.longleft) {
core.plugin.bagInter(mouse_x, mouse_y);
core.plugin.boxInter(mouse_x, mouse_y);
core.plugin.workInter(mouse_x, mouse_y);
core.plugin.furInter(mouse_x, mouse_y);
}
}
}
this.equipInfo = function (list, dur, id, mouse_x, mouse_y) {
if (flags.longleft || flags.longright) return;
var a = (mouse_x - 1) * 32;
var b1 = (mouse_y - 4) * 32;
var b2 = (mouse_y + 1) * 32;
var font1 = ui.prototype._buildFont(12, false);
var font2 = ui.prototype._buildFont(10, false);
var font3 = ui.prototype._buildFont(9, false);
var color1 = "#BBFFFF";
var color2 = "#a3fabf";
var color3 = "white";
//自适应
if (mouse_y <= 3) b1 = b2;
//创建画布
if (core.getContextByName("durable") == null) {
core.createCanvas("durable", 0, 0, 416, 416, 140);
} else {
core.clearMap('durable');
}
//绘制显示框
core.fillRoundRect("durable", a, b1, 96, 128, 5, [54, 54, 54, 0.9]);
core.strokeRoundRect("durable", a, b1, 96, 128, 5, [255, 255, 255, 1], 2);
//绘制文本
core.ui.fillText("durable", core.material.items[id].name, a + 4, b1 + 14, color1, font1, 96);
core.ui.fillText("durable", "耐久:" + dur[id][0] + "/" + list[id][0], a + 8, b1 + 26, color2, font2, 96);
// core.ui.fillText("durable", "亡灵杀手5", a + 4, b1 + 84, color3, font3, 96);
// core.ui.fillText("durable", "亡灵杀手5", a + 4, b1 + 96, color3, font3, 96);
// core.ui.fillText("durable", "亡灵杀手5", a + 4, b1 + 108, color3, font3, 96);
// core.ui.fillText("durable", "亡灵杀手5", a + 50, b1 + 84, color3, font3, 96);
// core.ui.fillText("durable", "亡灵杀手5", a + 50, b1 + 96, color3, font3, 96);
// core.ui.fillText("durable", "亡灵杀手5", a + 50, b1 + 108, color3, font3, 96);
if (list == flags.weapon) {
core.ui.fillText("durable", "装备时:", a + 4, b1 + 44, color3, font1, 96);
core.ui.fillText("durable", "攻击:" + "+" + list[id][1], a + 8, b1 + 58, color2, font2, 96);
//core.ui.fillText("durable", "攻速:" + list[id][2], a + 8, b1 + 70, color2, font2, 96);
} else if (list == flags.equip) {
core.ui.fillText("durable", "装备时:", a + 4, b1 + 44, color3, font1, 96);
core.ui.fillText("durable", "防御:" + "+" + list[id][1], a + 8, b1 + 58, color2, font2, 96);
}
}
this.highLight = function (mouse_x, mouse_y) {
var h = 0;
if (flags.interface == "背包") {
for (var i = 2; i < 11; i++) {
if ((mouse_x == i && mouse_y == 12) ||
(mouse_x == i && mouse_y == 8) ||
(mouse_x == i && mouse_y == 9) ||
(mouse_x == i && mouse_y == 10)) {
flags.curlight[0] = [mouse_x, mouse_y];
h = 1;
}
}
if ((mouse_x == 2 && mouse_y == 3) ||
(mouse_x == 2 && mouse_y == 4) ||
(mouse_x == 2 && mouse_y == 5) ||
(mouse_x == 2 && mouse_y == 6) ||
(mouse_x == 6 && mouse_y == 6) ||
(mouse_x == 7 && mouse_y == 3) ||
(mouse_x == 8 && mouse_y == 3) ||
(mouse_x == 7 && mouse_y == 4) ||
(mouse_x == 8 && mouse_y == 4) ||
(mouse_x == 10 && mouse_y == 4)) {
flags.curlight[0] = [mouse_x, mouse_y];
h = 1;
}
} else if (flags.interface == "箱子") {
for (var i = 2; i < 11; i++) {
if ((mouse_x == i && mouse_y == 12) ||
(mouse_x == i && mouse_y == 8) ||
(mouse_x == i && mouse_y == 9) ||
(mouse_x == i && mouse_y == 10) ||
(mouse_x == i && mouse_y == 1) ||
(mouse_x == i && mouse_y == 2) ||
(mouse_x == i && mouse_y == 3) ||
(mouse_x == i && mouse_y == 4) ||
(mouse_x == i && mouse_y == 5) ||
(mouse_x == i && mouse_y == 6)) {
flags.curlight[0] = [mouse_x, mouse_y];
h = 1;
}
}
} else if (flags.interface == "工作台") {
for (var i = 2; i < 11; i++) {
if ((mouse_x == i && mouse_y == 12) ||
(mouse_x == i && mouse_y == 8) ||
(mouse_x == i && mouse_y == 9) ||
(mouse_x == i && mouse_y == 10)) {
flags.curlight[0] = [mouse_x, mouse_y];
h = 1;
}
}
if ((mouse_x == 4 && mouse_y == 4) ||
(mouse_x == 5 && mouse_y == 4) ||
(mouse_x == 6 && mouse_y == 4) ||
(mouse_x == 4 && mouse_y == 5) ||
(mouse_x == 5 && mouse_y == 5) ||
(mouse_x == 6 && mouse_y == 5) ||
(mouse_x == 4 && mouse_y == 6) ||
(mouse_x == 5 && mouse_y == 6) ||
(mouse_x == 6 && mouse_y == 6) ||
(mouse_x == 9 && mouse_y == 5)) {
flags.curlight[0] = [mouse_x, mouse_y];
h = 1;
}
} else if (flags.interface == "熔炉") {
for (var i = 2; i < 11; i++) {
if ((mouse_x == i && mouse_y == 12) ||
(mouse_x == i && mouse_y == 8) ||
(mouse_x == i && mouse_y == 9) ||
(mouse_x == i && mouse_y == 10)) {
flags.curlight[0] = [mouse_x, mouse_y];
h = 1;
}
}
if ((mouse_x == 5 && mouse_y == 6) ||
(mouse_x == 5 && mouse_y == 4) ||
(mouse_x == 8 && mouse_y == 5)) {
flags.curlight[0] = [mouse_x, mouse_y];
h = 1;
}
}
if (flags.curlight != undefined && flags.curlight[0][0] != 0) {
if (flags.curlight[0][0] != flags.curlight[1][0] || flags.curlight[0][1] != flags.curlight[1][1]) {
if ((flags.longleft == 0 && flags.longright == 0) || flags.bag[0][0] == "") {
if (core.getContextByName("curlight") == null) {
core.createCanvas("curlight", 0, 0, 416, 416, 127);
} else {
core.clearMap('curlight');
}
} else {
if (!flags.curarr.length) {
var c = flags.curlight[0];
flags.curlight[0] = flags.curlight[1];
core.plugin.mcjiemian();
flags.curlight[0] = c;
flags.mingan = 1;
}
core.plugin.mcjiemian();
}
core.setAlpha("curlight", 0.4);
flags.curlight[1] = flags.curlight[0];
core.ui.fillRect("curlight", flags.curlight[0][0] * 32 + 3, flags.curlight[0][1] * 32 + 3, 25, 25, "white");
} else if (h == 0 && flags.longleft == 0 && flags.longright == 0) {
if (core.getContextByName("curlight") == null) {
core.createCanvas("curlight", 0, 0, 416, 416, 127);
} else {
core.clearMap('curlight');
}
flags.curlight = [[0, 0], [0, 0]];
}
} else {
flags.curlight = [[0, 0], [0, 0]];
core.deleteCanvas("curlight");
//core.clearMap('curlight');
}
}
this.itemText = function (id, mouse_x, mouse_y) {
if (flags.bag[0][0] != "" || flags.longleft || flags.longright) return;
var cname = "itemtext";
var text = core.material.items[id].text;
var length;
if (text == null) length = 1;
else length = text.length;
var a = (mouse_x - 1) * 32;
var b1 = (mouse_y - 1) * 32 - (Math.ceil(length / 8) - 1) * 12;
var b2 = (mouse_y + 1) * 32;
var font1 = ui.prototype._buildFont(12, false);
var font2 = ui.prototype._buildFont(10, false);
var color = "white";
var color1 = "white"; //白色
var color2 = "#eff683"; //黄色
var color3 = "#BBFFFF"; //天青色
var color4 = "#f872e4"; //品红色
var color5 = "#a3fabf"; //绿色
var height = 32;
if (flags.interface == "箱子") {
var grid = 27;
var tip = 0;
switch (flags.extraGrid) {
case 0:
grid = 27;
break;
case 3:
grid = 30;
break;
case 6:
grid = 33;
break;
case 9:
grid = 36;
break;
case 12:
grid = 39;
break;
case 15:
grid = 42;
break;
case 18:
grid = 45;
break;
case 21:
grid = 48;
break;
case 24:
grid = 51;
break;
case 27:
grid = 54;
break;
}
if ((mouse_y == 1) || (mouse_y == 2) || (mouse_y == 3)) {
if (grid < 27) tip = 1;
} else if ((mouse_x == 2 && mouse_y == 4) || (mouse_x == 3 && mouse_y == 4) || (mouse_x == 4 && mouse_y == 4)) {
if (grid < 30) tip = 1;
} else if ((mouse_x == 5 && mouse_y == 4) || (mouse_x == 6 && mouse_y == 4) || (mouse_x == 7 && mouse_y == 4)) {
if (grid < 33) tip = 1;
} else if ((mouse_x == 8 && mouse_y == 4) || (mouse_x == 9 && mouse_y == 4) || (mouse_x == 10 && mouse_y == 4)) {
if (grid < 36) tip = 1;
} else if ((mouse_x == 2 && mouse_y == 5) || (mouse_x == 3 && mouse_y == 5) || (mouse_x == 4 && mouse_y == 5)) {
if (grid < 39) tip = 1;
} else if ((mouse_x == 5 && mouse_y == 5) || (mouse_x == 6 && mouse_y == 5) || (mouse_x == 7 && mouse_y == 5)) {
if (grid < 42) tip = 1;
} else if ((mouse_x == 8 && mouse_y == 5) || (mouse_x == 9 && mouse_y == 5) || (mouse_x == 10 && mouse_y == 5)) {
if (grid < 45) tip = 1;
} else if ((mouse_x == 2 && mouse_y == 6) || (mouse_x == 3 && mouse_y == 6) || (mouse_x == 4 && mouse_y == 6)) {
if (grid < 48) tip = 1;
} else if ((mouse_x == 5 && mouse_y == 6) || (mouse_x == 6 && mouse_y == 6) || (mouse_x == 7 && mouse_y == 6)) {
if (grid < 51) tip = 1;
} else if ((mouse_x == 8 && mouse_y == 6) || (mouse_x == 9 && mouse_y == 6) || (mouse_x == 10 && mouse_y == 6)) {
if (grid < 54) tip = 1;
}
if (tip == 1) {
text = "无法使用该空间,请升级 空间扩展科技";
color5 = "#ec3727";
length = text.length;
b1 = (mouse_y - 1) * 32 - (Math.ceil(length / 8) - 1) * 12;
}
}
//自适应
height = Math.max((Math.ceil(length / 8) - 1) * 12 + 32, 32);
if (mouse_y <= 3) b1 = b2;
if (flags.quality[id] == 1) color = color1;
else if (flags.quality[id] == 2) color = color2;
else if (flags.quality[id] == 3) color = color3;
else if (flags.quality[id] == 4) color = color4;
//创建画布
if (core.getContextByName(cname) == null) {
core.createCanvas(cname, 0, 0, 416, 416, 140);
} else {
core.clearMap(cname);
}
//绘制显示框
core.fillRoundRect(cname, a, b1, 96, height, 5, [54, 54, 54, 0.9]);
core.strokeRoundRect(cname, a, b1, 96, height, 5, [255, 255, 255, 1], 2);
//绘制文本
core.ui.fillText(cname, core.material.items[id].name, a + 4, b1 + 14, color, font1, 96);
for (var i = 0; i <= Math.ceil(length / 8); i++) {
if (text != null) core.ui.fillText(cname, text.substr(i * 8, 8), a + 8, b1 + 26 + (i * 12), color5, font2, 96);
}
}
},
"6-滚轮滑动": function () {
//注册一个滚轮行为函数
core.registerAction(
'onmousewheel',
'onmousewheeled',
function (direct) {
core.plugin.onmousewheeled(direct);
return false;
},
100
);
function alpha1(time) {
setTimeout(function () {
if (time > 0) {
time -= 50;
alpha1(time);
} else {
//function alpha() {
var a = 10;
var alp = setInterval(function () {
if (a < 0) {
flags.textalpha = [];
clearInterval(alp);
} else {
a -= 1;
core.setOpacity("itemname", a / 10);
}
}, 50);
}
}, 50);
}
//主程序,当鼠标滚轮上下滑动时进行判断
this.onmousewheeled = function (direct) {
if (!window.core) return;
if (!core.isPlaying) return;
if (!core.isPlaying()) return;
core.plugin.mcjiemian();
if (flags.interface == "物品栏" && core.status.hero.hp > 0) {
if (direct == 1) {
flags.cursor1 -= 1;
if (flags.cursor1 < 1) {
flags.cursor1 = 9;
}
} else if (direct == -1) {
flags.cursor1 += 1;
if (flags.cursor1 > 9) {
flags.cursor1 = 1;
}
}
if (flags.bag[flags.cursor1][0] != "") {
var arr = flags.textalpha;
arr.push(flags.cursor1);
var cur = flags.textalpha[flags.textalpha.length - 1];
var leng = flags.textalpha.length;
core.clearMap('itemname');
core.setOpacity("itemname", 1);
core.setTextAlign("itemname", "center");
core.fillText("itemname", core.material.items[flags.bag[flags.cursor1][0]].name, 208, 330, "white", ui.prototype._buildFont(12, false), 96);
if (leng < 2) alpha1(1500);
}
}
core.plugin.drawMC();
core.plugin.invMC();
};
},
"7-按键按下": function () {
//注册一个按下按键行为函数
core.registerAction(
'keyDown',
'keyDowned',
function (keyCode) {
core.plugin.keyDowned(keyCode);
return false;
},
100
);
//主程序,当按键按下时进行判断
this.keyDowned = function (keyCode) {
//console.log(core.plugin.keyc(keyCode))
if (core.status.hero.hp > 0 && !core.getContextByName("jzt")) {
if (flags.curKey) {
if (keyCode == 27) {
flags.keylist[flags.curKey - 1][1] = -1;
flags.curKey = 0;
} else {
for (var i = 0; i < flags.keylist.length; i++) {
if (flags.keylist[i][1] == keyCode) {
core.playSound("确定");
flags.tip[0] = "该按键已经被设置!";
core.ui.drawStatusBar();
flags.curKey = 0;
break;
}
}
}
if (flags.curKey) {
core.playSound("orb.ogg");
flags.tip[0] = "设置成功!";
core.ui.drawStatusBar();
flags.keylist[flags.curKey - 1][1] = keyCode;
flags.curKey = 0;
}
core.plugin.zidingyianjian();
}
if (flags.interface == "物品栏" &&
flags.tech == 0 &&
flags.CustomKey == 0 &&
flags.attrui == 0 &&
flags.taskui == 0 &&
flags.achiui == 0 &&
flags.farmUI == 0 &&
!core.status.lockControl) {
if (keyCode == flags.keylist[0][1]) {
core.moveHero('up');
}
if (keyCode == flags.keylist[1][1]) {
core.moveHero('left');
}
if (keyCode == flags.keylist[2][1]) {
core.moveHero('down');
}
if (keyCode == flags.keylist[3][1]) {
core.moveHero('right');
}
}
if (keyCode == flags.keylist[4][1]) {
if (flags.interface == "物品栏") {
flags.interface = "背包";
} else if (flags.interface == "背包" ||
flags.interface == "箱子" ||
flags.interface == "工作台" ||
flags.interface == "熔炉"
) {
if (flags.interface == "箱子" && flags.discard == 0) {
core.playSound("chestclosed.ogg");
}
flags.interface = "物品栏";
if (flags.discard == 1) {
delete flags.boxlist[flags.box_xy];
flags.discard = 0;
}
}
if (flags.interface == "物品栏") {
for (var i = 0; i < 4; i++) {
if (flags.comlist1[i][0]) {
core.addItem(flags.comlist1[i][0], flags.comlist1[i][1]);
flags.comlist1[i] = ["", 0];
}
}
for (var i = 0; i < 9; i++) {
if (flags.comlist2[i][0]) {
core.addItem(flags.comlist2[i][0], flags.comlist2[i][1]);
flags.comlist2[i] = ["", 0];
}
}
core.deleteCanvas('viscous');
core.deleteCanvas("curlight");
core.deleteCanvas("durable");
core.deleteCanvas("itemtext");
}
core.plugin.mcjiemian();
core.plugin.beibaocunchu();
}
if (keyCode == flags.keylist[5][1]) {
if (core.status.event.id == 'settings') {
core.closePanel();
core.playSound('取消');
flags.interface = "物品栏";
} else if (flags.interface == "物品栏" && flags.tech == 0 && flags.CustomKey == 0 && core.status.event.id == null) {
core.clearUI();
core.openSettings();
flags.interface = "锁定";
core.lockControl();
}
}
if (keyCode == flags.keylist[6][1]) {
if (core.status.event.id == 'viewMaps') {
core.closePanel();
core.drawMap();
core.playSound('取消');
flags.interface = "物品栏";
} else if (flags.interface == "物品栏" && flags.tech == 0 && flags.CustomKey == 0 && core.status.event.id == null) {
flags.interface = "锁定";
ui.prototype._drawViewMaps(core.floorIds.indexOf(core.status.floorId));
}
}
if (keyCode == flags.keylist[7][1]) {
if (flags.interface == "物品栏" && flags.tech == 0 && flags.CustomKey == 0 && core.status.event.id == null) {
flags.tech = 1;
core.plugin.techUI();
} else if (flags.tech != 0) {
flags.tech = 0;
flags.interface = "物品栏";
core.clearMap('uievent');
core.plugin.mcjiemian();
}
}
if (keyCode == flags.keylist[8][1]) {
}
if (keyCode == flags.keylist[9][1]) {
}
if (keyCode == flags.keylist[10][1]) {
flags.transfer = 1;
}
if (keyCode == flags.keylist[11][1]) {
if (flags.interface == "物品栏" && flags.tech == 0 && flags.CustomKey == 0 && core.status.event.id == null) {
flags.CustomKey = 1;
core.plugin.zidingyianjian();
} else {
flags.CustomKey = 0;
flags.interface = "物品栏";
core.clearMap('uievent');
core.plugin.mcjiemian();
}
}
}
};
//keycode对应的按键字符串显示
this.keyc = function (k) {
if (k == 65) {
return "A";
} else if (k == 66) {
return "B";
} else if (k == 67) {
return "C";
} else if (k == 68) {
return "D";
} else if (k == 69) {
return "E";
} else if (k == 70) {
return "F";
} else if (k == 71) {
return "G";
} else if (k == 72) {
return "H";
} else if (k == 73) {
return "I";
} else if (k == 74) {
return "J";
} else if (k == 75) {
return "K";
} else if (k == 76) {
return "L";
} else if (k == 77) {
return "M";
} else if (k == 78) {
return "N";
} else if (k == 79) {
return "O";
} else if (k == 80) {
return "P";
} else if (k == 81) {
return "Q";
} else if (k == 82) {
return "R";
} else if (k == 83) {
return "S";
} else if (k == 84) {
return "T";
} else if (k == 85) {
return "U";
} else if (k == 86) {
return "V";
} else if (k == 87) {
return "W";
} else if (k == 88) {
return "X";
} else if (k == 89) {
return "Y";
} else if (k == 90) {
return "Z";
} else if (k == 48) {
return "0";
} else if (k == 49) {
return "1";
} else if (k == 50) {
return "2";
} else if (k == 51) {
return "3";
} else if (k == 52) {
return "4";
} else if (k == 53) {
return "5";
} else if (k == 54) {
return "6";
} else if (k == 55) {
return "7";
} else if (k == 56) {
return "8";
} else if (k == 57) {
return "9";
} else if (k == 8) {
return "BackSpace";
} else if (k == 9) {
return "Tab";
} else if (k == 12) {
return "Clear";
} else if (k == 13) {
return "Enter";
} else if (k == 16) {
return "Shift";
} else if (k == 17) {
return "Control";
} else if (k == 18) {
return "Alt";
} else if (k == 20) {
return "CapeLock";
} else if (k == 27) {
return "Esc";
} else if (k == 32) {
return "Space";
} else if (k == 33) {
return "PageUp";
} else if (k == 34) {
return "PageDown";
} else if (k == 35) {
return "End";
} else if (k == 36) {
return "Home";
} else if (k == 37) {
return "⬅️";
} else if (k == 38) {
return "⬆️";
} else if (k == 39) {
return "➡️";
} else if (k == 40) {
return "⬇️";
} else if (k == 45) {
return "Insert";
} else if (k == 46) {
return "Delete";
} else if (k == 144) {
return "NumLock";
} else if (k == 186) {
return ";";
} else if (k == 187) {
return "=";
} else if (k == 188) {
return ",";
} else if (k == 189) {
return "-";
} else if (k == 190) {
return ".";
} else if (k == 191) {
return "/";
} else if (k == 192) {
return "`";
} else if (k == 219) {
return "[";
} else if (k == 220) {
return "|";
} else if (k == 221) {
return "]";
} else if (k == 222) {
return "'";
} else if (k == -1) {
return "";
} else {
return "未知";
}
}
},
"8-按键松开": function () {
//注册一个松开按键行为函数
core.registerAction(
'keyUp',
'keyUped',
function (keyCode) {
core.plugin.keyUped(keyCode);
return false;
},
100
);
//主程序,当松开某个键时进行判断
this.keyUped = function (keyCode) {
//console.log(keyCode)
if (keyCode == flags.keylist[10][1]) {
flags.transfer = 0;
}
}
},
"9-MC界面绘制": function () {
this.mcjiemian = function () {
core.plugin.lockMC();
core.plugin.drawMC();
core.plugin.invMC();
core.plugin.bagMC();
core.plugin.boxMC();
core.plugin.workMC();
core.plugin.furMC();
core.plugin.comMC();
};
//打开任何界面都先锁定用户控制;科技、自定义按键等界面返回时,对物品栏解封
this.lockMC = function () {
if (flags.interface == "物品栏") {
flags.cursor2 = 0;
flags.curCache2 = [0, 0];
flags.curKey = 0;
flags.pagenumber = 1;
flags.discard = 0;
core.unlockControl();
} else {
for (var eq in flags.weapon) {
if (core.getEquip(0) == eq) {
flags.property.atkSpeed[0] -= flags.weapon[eq][2];
flags.property.touchRange[0] -= flags.weapon[eq][3];
}
}
core.unloadEquip(0);
core.lockControl();
}
//科技、自定义按键界面返回时,对物品栏解封
if (flags.tech == 0 &&
flags.CustomKey == 0 &&
flags.attrui == 0 &&
flags.taskui == 0 &&
flags.achiui == 0 &&
core.status.event.id == null &&
flags.farmUI == 0 &&
flags.sleep != 0) {
if (flags.interface == "锁定") {
core.deleteCanvas('uievent');
core.deleteCanvas('mcui');
flags.interface = "物品栏";
}
} else if (core.status.event.id != null) {
//core.stopAutomaticRoute();
flags.interface = "锁定";
}
};//各个界面的显示与切换;绘制图标和数量
this.drawMC = function () {
if (flags.interface == "物品栏") {
//core.ui._createUIEvent();
if (core.getContextByName("mcui") == null) {
core.createCanvas("mcui", 0, 0, 416, 416, 126);
} else {
core.clearMap('mcui');
}
if (core.getContextByName("inventory") == null) {
core.createCanvas("inventory", 0, 0, 416, 416, 127);
} else {
core.clearMap('inventory');
}
if (core.getContextByName("itemname") == null) {
core.createCanvas("itemname", 0, 0, 416, 416, 125);
} else {
//core.clearMap('itemname');
}
if (core.getContextByName("uievent") == null) {
core.createCanvas("uievent", 0, 0, 416, 416, 130);
} else {
core.clearMap('uievent');
//core.createCanvas("uievent", 0, 0, 416, 416, 130);
}
core.drawImage("mcui", "inventory.png", 0, 0, 416, 416);
core.setAlpha("uievent", 0.8);
//检测到物品栏界面有物品时,绘制图标和数量
for (var i = 1; i < 10; i++) {
if ((flags.bag[i][0] && flags.bag[i][1] > 0 && core.hasItem(flags.bag[i][0])) || (core.getEquip(0) == flags.bag[i][0] && flags.bag[i][0] != null)) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i + 1) + 2, 384 + 2, 28, 28);
if (flags.bag[i][1] >= 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i + 1) + 20, 384 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i + 1) + 12, 384 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
if (flags.bag[i][0] && !core.hasItem(flags.bag[i][0]) && core.getEquip(0) != flags.bag[i][0] || flags.bag[i][1] <= 0) {
flags.bag[i] = ["", 0];
}
}
core.setAlpha("uievent", 1);
core.plugin.hpBar(3);
core.plugin.expBar();
core.plugin.hungerBar();
} else if (flags.interface == "背包") {
if (core.getContextByName("mcui") == null) {
core.createCanvas("mcui", 0, 0, 416, 416, 126);
} else {
core.clearMap('mcui');
}
core.drawImage("mcui", "bag.png", 0, 0, 416, 416);
core.drawImage("mcui", "heropic1.png", 98, 98, 92, 124);
if (core.getContextByName("uievent") == null) {
core.createCanvas("uievent", 0, 0, 416, 416, 130);
} else {
core.clearMap('uievent');
core.createCanvas("uievent", 0, 0, 416, 416, 130);
}
//检测到背包界面有物品时,绘制图标和数量
for (var i = 1; i < 37; i++) {
if ((flags.bag[i][0] && flags.bag[i][1] > 0 && core.hasItem(flags.bag[i][0])) || (core.getEquip(0) == flags.bag[i][0] && flags.bag[i][0] != null)) {
if (i >= 1 && i < 10) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i + 1) + 2, 384 + 2, 28, 28);
if (flags.bag[i][1] > 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i + 1) + 20, 384 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i + 1) + 12, 384 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 10 && i < 19) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i - 8) + 2, 256 + 2, 28, 28);
if (flags.bag[i][1] > 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 8) + 20, 256 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 8) + 12, 256 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 19 && i < 28) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i - 17) + 2, 288 + 2, 28, 28);
if (flags.bag[i][1] > 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 17) + 20, 288 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 17) + 12, 288 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 28 && i < 37) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i - 26) + 2, 320 + 2, 28, 28);
if (flags.bag[i][1] > 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 26) + 20, 320 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 26) + 12, 320 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
}
if (flags.bag[i][0] && !core.hasItem(flags.bag[i][0]) && core.getEquip(0) != flags.bag[i][0] || flags.bag[i][1] <= 0) {
flags.bag[i] = ["", 0];
}
}
//绘制已穿戴装备及耐久条
for (var j in flags.equip) {
var ceil = Math.ceil((flags.equDur[j][0] / flags.equip[j][0]) * 26);
if (core.getEquip(1) == j) {
core.drawIcon("uievent", core.getEquip(1), 192 + 2, 192 + 2, 28, 28);
core.fillRect("uievent", 195, 217, 26, 3, "#2b2b2b");
core.fillRect("uievent", 195, 217, ceil, 3, "#00bf29");
} else if (core.getEquip(2) == j) {
core.drawIcon("uievent", core.getEquip(2), 64 + 2, 96 + 2, 28, 28);
core.fillRect("uievent", 67, 121, 26, 3, "#2b2b2b");
core.fillRect("uievent", 67, 121, ceil, 3, "#00bf29");
} else if (core.getEquip(3) == j) {
core.drawIcon("uievent", core.getEquip(3), 64 + 2, 128 + 2, 28, 28);
core.fillRect("uievent", 67, 153, 26, 3, "#2b2b2b");
core.fillRect("uievent", 67, 153, ceil, 3, "#00bf29");
} else if (core.getEquip(4) == j) {
core.drawIcon("uievent", core.getEquip(4), 64 + 2, 160 + 2, 28, 28);
core.fillRect("uievent", 67, 185, 26, 3, "#2b2b2b");
core.fillRect("uievent", 67, 185, ceil, 3, "#00bf29");
} else if (core.getEquip(5) == j) {
core.drawIcon("uievent", core.getEquip(5), 64 + 2, 192 + 2, 28, 28);
core.fillRect("uievent", 67, 217, 26, 3, "#2b2b2b");
core.fillRect("uievent", 67, 217, ceil, 3, "#00bf29");
}
}
//绘制2X2合成栏的物品的图标和数量
var com = flags.comlist1;
if (com[0][0]) {
core.drawIcon("uievent", com[0][0], 224 + 2, 96 + 2, 28, 28);
if (com[0][1] >= 0 && com[0][1] < 10) {
core.ui.fillText("uievent", com[0][1].toString(), 224 + 20, 96 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (com[0][1] >= 10) {
core.ui.fillText("uievent", com[0][1].toString(), 224 + 12, 96 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
if (com[1][0]) {
core.drawIcon("uievent", com[1][0], 256 + 2, 96 + 2, 28, 28);
if (com[1][1] >= 0 && com[1][1] < 10) {
core.ui.fillText("uievent", com[1][1].toString(), 256 + 20, 96 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (com[1][1] >= 10) {
core.ui.fillText("uievent", com[1][1].toString(), 256 + 12, 96 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
if (com[2][0]) {
core.drawIcon("uievent", com[2][0], 224 + 2, 128 + 2, 28, 28);
if (com[2][1] >= 0 && com[2][1] < 10) {
core.ui.fillText("uievent", com[2][1].toString(), 224 + 20, 128 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (com[2][1] >= 10) {
core.ui.fillText("uievent", com[2][1].toString(), 224 + 12, 128 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
if (com[3][0]) {
core.drawIcon("uievent", com[3][0], 256 + 2, 128 + 2, 28, 28);
if (com[3][1] >= 0 && com[3][1] < 10) {
core.ui.fillText("uievent", com[3][1].toString(), 256 + 20, 128 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (com[3][1] >= 10) {
core.ui.fillText("uievent", com[3][1].toString(), 256 + 12, 128 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
for (var j = 0; j < 4; j++) {
if (com[j][0] && com[j][1] <= 0) {
com[j] = ["", 0];
}
}
} else if (flags.interface == "箱子") {
if (core.getContextByName("mcui") == null) {
core.createCanvas("mcui", 0, 0, 416, 416, 126);
} else {
core.clearMap('mcui');
}
var pic = "box1.png";
switch (flags.extraGrid) {
case 0:
pic = "box1.png";
break;
case 3:
pic = "box2.png";
break;
case 6:
pic = "box3.png";
break;
case 9:
pic = "box4.png";
break;
case 12:
pic = "box5.png";
break;
case 15:
pic = "box6.png";
break;
case 18:
pic = "box7.png";
break;
case 21:
pic = "box8.png";
break;
case 24:
pic = "box9.png";
break;
case 27:
pic = "box10.png";
break;
}
core.drawImage("mcui", pic, 0, 0, 416, 416);
if (core.getContextByName("uievnet") == null) {
core.createCanvas("uievent", 0, 0, 416, 416, 130);
} else {
core.clearMap('uievent');
}
if (flags.discard == 0) {
core.fillText("uievent", "箱子", 56, 26, "black", ui.prototype._buildFont(14, false), 64);
} else if (flags.discard == 1) {
core.fillText("uievent", "垃圾桶", 56, 26, "black", ui.prototype._buildFont(14, false), 64);
}
//检测到箱子界面有物品时,绘制图标和数量
for (var i = 1; i < 91; i++) {
if (i < 37 /*&& (flags.bag[i][0] && flags.bag[i][1] > 0 && core.hasItem(flags.bag[i][0])) || (core.getEquip(0) == flags.bag[i][0] && flags.bag[i][0] != null)*/) {
if (i >= 1 && i < 10) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i + 1) + 2, 384 + 2, 28, 28);
if (flags.bag[i][1] > 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i + 1) + 20, 384 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i + 1) + 12, 384 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 10 && i < 19) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i - 8) + 2, 256 + 2, 28, 28);
if (flags.bag[i][1] > 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 8) + 20, 256 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 8) + 12, 256 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 19 && i < 28) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i - 17) + 2, 288 + 2, 28, 28);
if (flags.bag[i][1] > 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 17) + 20, 288 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 17) + 12, 288 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 28 && i < 37) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i - 26) + 2, 320 + 2, 28, 28);
if (flags.bag[i][1] > 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 26) + 20, 320 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 26) + 12, 320 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
}
var box = flags.boxlist[flags.box_xy][i - 37];
if (i >= 37 && flags.boxlist[flags.box_xy][i - 37][0] && flags.boxlist[flags.box_xy][i - 37][1] > 0) {
if (i >= 37 && i < 46) {
core.drawIcon("uievent", box[0], 32 * (i - 35) + 2, 32 + 2, 28, 28);
if (box[1] > 0 && box[1] < 10) {
core.ui.fillText("uievent", box[1].toString(), 32 * (i - 35) + 20, 32 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (box[1] >= 10) {
core.ui.fillText("uievent", box[1].toString(), 32 * (i - 35) + 12, 32 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 46 && i < 55) {
core.drawIcon("uievent", box[0], 32 * (i - 44) + 2, 64 + 2, 28, 28);
if (box[1] > 0 && box[1] < 10) {
core.ui.fillText("uievent", box[1].toString(), 32 * (i - 44) + 20, 64 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (box[1] >= 10) {
core.ui.fillText("uievent", box[1].toString(), 32 * (i - 44) + 12, 64 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 55 && i < 64) {
core.drawIcon("uievent", box[0], 32 * (i - 53) + 2, 96 + 2, 28, 28);
if (box[1] > 0 && box[1] < 10) {
core.ui.fillText("uievent", box[1].toString(), 32 * (i - 53) + 20, 96 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (box[1] >= 10) {
core.ui.fillText("uievent", box[1].toString(), 32 * (i - 53) + 12, 96 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 64 && i < 73) {
core.drawIcon("uievent", box[0], 32 * (i - 62) + 2, 128 + 2, 28, 28);
if (box[1] > 0 && box[1] < 10) {
core.ui.fillText("uievent", box[1].toString(), 32 * (i - 62) + 20, 128 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (box[1] >= 10) {
core.ui.fillText("uievent", box[1].toString(), 32 * (i - 62) + 12, 128 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 73 && i < 82) {
core.drawIcon("uievent", box[0], 32 * (i - 71) + 2, 160 + 2, 28, 28);
if (box[1] > 0 && box[1] < 10) {
core.ui.fillText("uievent", box[1].toString(), 32 * (i - 71) + 20, 160 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (box[1] >= 10) {
core.ui.fillText("uievent", box[1].toString(), 32 * (i - 71) + 12, 160 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 82 && i < 91) {
core.drawIcon("uievent", box[0], 32 * (i - 80) + 2, 192 + 2, 28, 28);
if (box[1] > 0 && box[1] < 10) {
core.ui.fillText("uievent", box[1].toString(), 32 * (i - 80) + 20, 192 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (box[1] >= 10) {
core.ui.fillText("uievent", box[1].toString(), 32 * (i - 80) + 12, 192 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
}
if (flags.bag[i][0] && !core.hasItem(flags.bag[i][0]) && core.getEquip(0) != flags.bag[i][0] || flags.bag[i][1] <= 0) {
flags.bag[i] = ["", 0];
}
if (flags.bag[i][0] == "" && flags.bag[i][1] != 0) {
flags.bag[i] = ["", 0];
}
if (i >= 37 && box[0] && box[1] <= 0) {
flags.boxlist[flags.box_xy][i - 37] = ["", 0];
}
}
} else if (flags.interface == "工作台") {
if (core.getContextByName("mcui") == null) {
core.createCanvas("mcui", 0, 0, 416, 416, 126);
} else {
core.clearMap('mcui');
}
core.drawImage("mcui", "CraftingTable.png", 0, 0, 416, 416);
if (core.getContextByName("uievent") == null) {
core.createCanvas("uievent", 0, 0, 416, 416, 130);
} else {
core.clearMap('uievent');
core.createCanvas("uievent", 0, 0, 416, 416, 130);
}
//检测到工作台界面有物品时,绘制图标和数量
for (var i = 1; i < 37; i++) {
if ((flags.bag[i][0] && flags.bag[i][1] > 0 && core.hasItem(flags.bag[i][0])) || (core.getEquip(0) == flags.bag[i][0] && flags.bag[i][0] != null)) {
if (i >= 1 && i < 10) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i + 1) + 2, 384 + 2, 28, 28);
if (flags.bag[i][1] > 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i + 1) + 20, 384 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i + 1) + 12, 384 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 10 && i < 19) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i - 8) + 2, 256 + 2, 28, 28);
if (flags.bag[i][1] > 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 8) + 20, 256 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 8) + 12, 256 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 19 && i < 28) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i - 17) + 2, 288 + 2, 28, 28);
if (flags.bag[i][1] > 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 17) + 20, 288 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 17) + 12, 288 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 28 && i < 37) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i - 26) + 2, 320 + 2, 28, 28);
if (flags.bag[i][1] > 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 26) + 20, 320 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 26) + 12, 320 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
}
if (flags.bag[i][0] && !core.hasItem(flags.bag[i][0]) && core.getEquip(0) != flags.bag[i][0] || flags.bag[i][1] <= 0) {
flags.bag[i] = ["", 0];
}
}
//绘制3X3合成栏的物品的图标和数量
var com = flags.comlist2;
if (com[0][0]) {
core.drawIcon("uievent", com[0][0], 128 + 2, 128 + 2, 28, 28);
if (com[0][1] >= 0 && com[0][1] < 10) {
core.ui.fillText("uievent", com[0][1].toString(), 128 + 20, 128 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (com[0][1] >= 10) {
core.ui.fillText("uievent", com[0][1].toString(), 128 + 12, 128 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
if (com[1][0]) {
core.drawIcon("uievent", com[1][0], 160 + 2, 128 + 2, 28, 28);
if (com[1][1] >= 0 && com[1][1] < 10) {
core.ui.fillText("uievent", com[1][1].toString(), 160 + 20, 128 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (com[1][1] >= 10) {
core.ui.fillText("uievent", com[1][1].toString(), 160 + 12, 128 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
if (com[2][0]) {
core.drawIcon("uievent", com[2][0], 192 + 2, 128 + 2, 28, 28);
if (com[2][1] >= 0 && com[2][1] < 10) {
core.ui.fillText("uievent", com[2][1].toString(), 192 + 20, 128 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (com[2][1] >= 10) {
core.ui.fillText("uievent", com[2][1].toString(), 192 + 12, 128 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
if (com[3][0]) {
core.drawIcon("uievent", com[3][0], 128 + 2, 160 + 2, 28, 28);
if (com[3][1] >= 0 && com[3][1] < 10) {
core.ui.fillText("uievent", com[3][1].toString(), 128 + 20, 160 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (com[3][1] >= 10) {
core.ui.fillText("uievent", com[3][1].toString(), 128 + 12, 160 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
if (com[4][0]) {
core.drawIcon("uievent", com[4][0], 160 + 2, 160 + 2, 28, 28);
if (com[4][1] >= 0 && com[4][1] < 10) {
core.ui.fillText("uievent", com[4][1].toString(), 160 + 20, 160 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (com[4][1] >= 10) {
core.ui.fillText("uievent", com[4][1].toString(), 160 + 12, 160 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
if (com[5][0]) {
core.drawIcon("uievent", com[5][0], 192 + 2, 160 + 2, 28, 28);
if (com[5][1] >= 0 && com[5][1] < 10) {
core.ui.fillText("uievent", com[5][1].toString(), 192 + 20, 160 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (com[5][1] >= 10) {
core.ui.fillText("uievent", com[5][1].toString(), 192 + 12, 160 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
if (com[6][0]) {
core.drawIcon("uievent", com[6][0], 128 + 2, 192 + 2, 28, 28);
if (com[6][1] >= 0 && com[6][1] < 10) {
core.ui.fillText("uievent", com[6][1].toString(), 128 + 20, 192 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (com[6][1] >= 10) {
core.ui.fillText("uievent", com[6][1].toString(), 128 + 12, 192 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
if (com[7][0]) {
core.drawIcon("uievent", com[7][0], 160 + 2, 192 + 2, 28, 28);
if (com[7][1] >= 0 && com[7][1] < 10) {
core.ui.fillText("uievent", com[7][1].toString(), 160 + 20, 192 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (com[7][1] >= 10) {
core.ui.fillText("uievent", com[7][1].toString(), 160 + 12, 192 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
if (com[8][0]) {
core.drawIcon("uievent", com[8][0], 192 + 2, 192 + 2, 28, 28);
if (com[8][1] >= 0 && com[8][1] < 10) {
core.ui.fillText("uievent", com[8][1].toString(), 192 + 20, 192 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (com[8][1] >= 10) {
core.ui.fillText("uievent", com[8][1].toString(), 192 + 12, 192 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
for (var j = 0; j < 9; j++) {
if (com[j][0] && com[j][1] <= 0) {
com[j] = ["", 0];
}
}
} else if (flags.interface == "熔炉") {
if (core.getContextByName("mcui") == null) {
core.createCanvas("mcui", 0, 0, 416, 416, 126);
} else {
core.clearMap('mcui');
}
core.drawImage("mcui", "Furnace.png", 0, 0, 416, 416);
if (core.getContextByName("uievent") == null) {
core.createCanvas("uievent", 0, 0, 416, 416, 130);
} else {
core.clearMap('uievent');
core.createCanvas("uievent", 0, 0, 416, 416, 130);
}
//检测到熔炉界面有物品时,绘制图标和数量
for (var i = 1; i < 37; i++) {
if ((flags.bag[i][0] && flags.bag[i][1] > 0 && core.hasItem(flags.bag[i][0])) || (core.getEquip(0) == flags.bag[i][0] && flags.bag[i][0] != null)) {
if (i >= 1 && i < 10) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i + 1) + 2, 384 + 2, 28, 28);
if (flags.bag[i][1] > 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i + 1) + 20, 384 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i + 1) + 12, 384 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 10 && i < 19) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i - 8) + 2, 256 + 2, 28, 28);
if (flags.bag[i][1] > 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 8) + 20, 256 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 8) + 12, 256 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 19 && i < 28) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i - 17) + 2, 288 + 2, 28, 28);
if (flags.bag[i][1] > 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 17) + 20, 288 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 17) + 12, 288 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
} else if (i >= 28 && i < 37) {
core.drawIcon("uievent", flags.bag[i][0], 32 * (i - 26) + 2, 320 + 2, 28, 28);
if (flags.bag[i][1] > 0 && flags.bag[i][1] < 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 26) + 20, 320 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (flags.bag[i][1] >= 10) {
core.ui.fillText("uievent", flags.bag[i][1].toString(), 32 * (i - 26) + 12, 320 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
}
if (flags.bag[i][0] && !core.hasItem(flags.bag[i][0]) && core.getEquip(0) != flags.bag[i][0] || flags.bag[i][1] <= 0) {
flags.bag[i] = ["", 0];
}
}
var fur = flags.furnacelist[flags.box_xy];
if (fur[0][0]) {
core.drawIcon("uievent", fur[0][0], 160 + 2, 192 + 2, 28, 28);
if (fur[0][1] >= 0 && fur[0][1] < 10) {
core.ui.fillText("uievent", fur[0][1].toString(), 160 + 20, 192 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (fur[0][1] >= 10) {
core.ui.fillText("uievent", fur[0][1].toString(), 160 + 12, 192 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
if (fur[1][0]) {
core.drawIcon("uievent", fur[1][0], 160 + 2, 128 + 2, 28, 28);
if (fur[1][1] >= 0 && fur[1][1] < 10) {
core.ui.fillText("uievent", fur[1][1].toString(), 160 + 20, 128 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (fur[1][1] >= 10) {
core.ui.fillText("uievent", fur[1][1].toString(), 160 + 12, 128 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
if (fur[2][0]) {
core.drawIcon("uievent", fur[2][0], 256 + 2, 160 + 2, 28, 28);
if (fur[2][1] >= 0 && fur[2][1] < 10) {
core.ui.fillText("uievent", fur[2][1].toString(), 256 + 20, 160 + 29, "white", ui.prototype._buildFont(15, false), 64);
} else if (fur[2][1] >= 10) {
core.ui.fillText("uievent", fur[2][1].toString(), 256 + 12, 160 + 29, "white", ui.prototype._buildFont(15, false), 64);
}
}
if (flags.furnacelist[flags.box_xy][3][0] > 0) {
core.ui.fillText("uievent", flags.furnacelist[flags.box_xy][3][0], 192 + 21, 160 + 10, "white", ui.prototype._buildFont(18, false), 64);
}
core.ui.fillText("uievent", flags.furnacelist[flags.box_xy][3][1], 213, 210, "white", ui.prototype._buildFont(18, false), 64);
for (var i = 0; i < 3; i++) {
if (fur[i][0] && fur[i][1] <= 0) {
fur[i] = ["", 0];
}
}
}
};//绘制物品栏光标并实时检测主手物品
this.invMC = function () {
//主手装备武器时会根据武器ID进行攻速和攻击范围加成
if (flags.interface == "物品栏") {
for (var i = 1; i < 10; i++) {
if (flags.cursor1 == i) {
core.strokeRect("inventory", 63 + ((i - 1) * 32), 384, 32, 32, "#ebebeb", 2);
// core.ui.drawLine("inventory", 64 - 1 + ((i - 1) * 32), 384, 96 + 1 + ((i - 1) * 32), 384, "white", 3);
// core.ui.drawLine("inventory", 64 + ((i - 1) * 32), 384 - 1, 64 + ((i - 1) * 32), 416 + 1, "white", 3);
// core.ui.drawLine("inventory", 64 - 1 + ((i - 1) * 32), 416, 96 + 1 + ((i - 1) * 32), 416, "white", 3);
// core.ui.drawLine("inventory", 96 + ((i - 1) * 32), 384 - 1, 96 + ((i - 1) * 32), 416 + 1, "white", 3);
}
}
}
for (var i = 1; i < 10; i++) {
if (flags.interface == "物品栏" && flags.cursor1 == i && flags.bag[i][0]) {
if (core.canEquip(flags.bag[i][0], true) && core.getEquip(0) && core.getEquip(0) != flags.bag[i][0] && core.getEquipTypeById(flags.bag[i][0]) == 0) {
for (var eq in flags.weapon) {
if (core.getEquip(0) == eq) {
flags.property.atkSpeed[0] -= flags.weapon[eq][2];
flags.property.touchRange[0] -= flags.weapon[eq][3];
}
}
core.unloadEquip(0);
core.loadEquip(flags.bag[i][0]);
for (var eq in flags.weapon) {
if (core.getEquip(0) == eq) {
flags.property.atkSpeed[0] += flags.weapon[eq][2];
flags.property.touchRange[0] += flags.weapon[eq][3];
}
}
} else if (core.canEquip(flags.bag[i][0], true) && !core.getEquip(0) && core.getEquipTypeById(flags.bag[i][0]) == 0) {
core.loadEquip(flags.bag[i][0]);
for (var eq in flags.weapon) {
if (core.getEquip(0) == eq) {
flags.property.atkSpeed[0] += flags.weapon[eq][2];
flags.property.touchRange[0] += flags.weapon[eq][3];
}
}
} else if ((!core.canEquip(flags.bag[i][0], true) && core.getEquip(0)) || (core.canEquip(flags.bag[i][0], true) && core.getEquipTypeById(flags.bag[i][0]) != 0)) {
for (var eq in flags.weapon) {
if (core.getEquip(0) == eq) {
flags.property.atkSpeed[0] -= flags.weapon[eq][2];
flags.property.touchRange[0] -= flags.weapon[eq][3];
}
}
core.unloadEquip(0);
} else if (!core.canEquip(flags.bag[i][0], true) && !core.getEquip(0)) { }
} else if (flags.interface == "物品栏" && flags.cursor1 == i && !flags.bag[i][0]) {
if (core.getEquip(0)) {
for (var eq in flags.weapon) {
if (core.getEquip(0) == eq) {
flags.property.atkSpeed[0] -= flags.weapon[eq][2];
flags.property.touchRange[0] -= flags.weapon[eq][3];
}
}
core.unloadEquip(0);
}
}
}
var t = 0;
for (var j in flags.tool) {
if (core.getEquip(0) == j) {
t = 1;
if (core.getContextByName("durableBar") == null) {
core.createCanvas("durableBar", 0, 0, 416, 416, 131);
} else {
core.clearMap('durableBar');
}
core.fillRect("durableBar", (32 * (flags.cursor1 - 1)) + 67, 409, 26, 3, "#2b2b2b");
core.fillRect("durableBar", (32 * (flags.cursor1 - 1)) + 67, 409, Math.ceil((flags.toolDur[j][0] / flags.tool[j][0]) * 26), 3, "#00bf29");
}
}
for (var j in flags.weapon) {
if (core.getEquip(0) == j) {
t = 1;
if (core.getContextByName("durableBar") == null) {
core.createCanvas("durableBar", 0, 0, 416, 416, 131);
} else {
core.clearMap('durableBar');
}
core.fillRect("durableBar", (32 * (flags.cursor1 - 1)) + 67, 409, 26, 3, "#2b2b2b");
core.fillRect("durableBar", (32 * (flags.cursor1 - 1)) + 67, 409, Math.ceil((flags.weaDur[j][0] / flags.weapon[j][0]) * 26), 3, "#00bf29");
}
}
if (t == 0) {
core.deleteCanvas("durableBar");
//core.clearMap('durable');
}
core.plugin.atkRange();
};//绘制背包光标;实现物品交换逻辑
this.bagMC = function () {
if (flags.interface == "背包") {
manage(flags.comlist1, 40);
}
};//绘制箱子光标;实现物品交换逻辑
this.boxMC = function () {
if (flags.interface == "箱子") {
var grid = 63;
switch (flags.extraGrid) {
case 0:
grid = 63;
break;
case 3:
grid = 66;
break;
case 6:
grid = 69;
break;
case 9:
grid = 72;
break;
case 12:
grid = 75;
break;
case 15:
grid = 78;
break;
case 18:
grid = 81;
break;
case 21:
grid = 84;
break;
case 24:
grid = 87;
break;
case 27:
grid = 90;
break;
}
manage(flags.boxlist[flags.box_xy], grid);
}
};//绘制工作台光标;实现物品交换逻辑
this.workMC = function () {
if (flags.interface == "工作台") {
manage(flags.comlist2, 45);
}
};//绘制熔炉光标;实现物品交换逻辑
this.furMC = function () {
if (flags.interface == "熔炉") {
manage(flags.furnacelist[flags.box_xy], 38);
}
};//当处于背包界面或合成界面时,遍历合成栏上的物品是否满足合成表
this.comMC = function () {
if (flags.interface == "背包") {
var cancraft = 0;
var guide = flags.craftGuide1;
cra: for (var id in guide) {
var i = 0;
do {
if (guide[id][i][0] == flags.comlist1[0][0] &&
guide[id][i][1] == flags.comlist1[1][0] &&
guide[id][i][2] == flags.comlist1[2][0] &&
guide[id][i][3] == flags.comlist1[3][0]) {
if (flags.comlist1[0][1] != 0 ||
flags.comlist1[1][1] != 0 ||
flags.comlist1[2][1] != 0 ||
flags.comlist1[3][1] != 0) {
core.drawIcon("uievent", id, 320, 128);
core.ui.fillText("uievent", guide[id][i][4].toString(), 320 + 20, 128 + 29, "white", ui.prototype._buildFont(15, false), 64);
flags.comlist1[4] = [id, guide[id][i][4]];
cancraft = 1;
break cra;
}
}
i++;
} while (guide[id][i] != undefined)
}
if (!cancraft) {
flags.comlist1[4] = ["", 0];
}
} else if (flags.interface == "工作台") {
var cancraft = 0;
var guide = flags.craftGuide2;
cra: for (var id in guide) {
var i = 0;
do {
if (guide[id][i][0] == flags.comlist2[0][0] &&
guide[id][i][1] == flags.comlist2[1][0] &&
guide[id][i][2] == flags.comlist2[2][0] &&
guide[id][i][3] == flags.comlist2[3][0] &&
guide[id][i][4] == flags.comlist2[4][0] &&
guide[id][i][5] == flags.comlist2[5][0] &&
guide[id][i][6] == flags.comlist2[6][0] &&
guide[id][i][7] == flags.comlist2[7][0] &&
guide[id][i][8] == flags.comlist2[8][0]) {
if (flags.comlist2[0][1] != 0 ||
flags.comlist2[1][1] != 0 ||
flags.comlist2[2][1] != 0 ||
flags.comlist2[3][1] != 0 ||
flags.comlist2[4][1] != 0 ||
flags.comlist2[5][1] != 0 ||
flags.comlist2[6][1] != 0 ||
flags.comlist2[7][1] != 0 ||
flags.comlist2[8][1] != 0) {
core.drawIcon("uievent", id, 288, 160);
core.ui.fillText("uievent", guide[id][i][9].toString(), 288 + 20, 160 + 29, "white", ui.prototype._buildFont(15, false), 64);
flags.comlist2[9] = [id, guide[id][i][9]];
cancraft = 1;
break cra;
}
}
i++;
} while (guide[id][i] != undefined)
}
if (!cancraft) {
flags.comlist2[9] = ["", 0];
}
}
};
function switch1(b1, b2, m1, isget, changeNum) {
if (m1 == flags.cursor2 && !(b1[0] == b2[0] && b2[1] >= 64)) {
if (changeNum) {
if (isget) core.addItem(b1[0], -b1[1]);
else if (b1[0] != b2[0]) core.addItem(b1[0], b1[1]);
}
flags.bagCache = b2[0];
b2[0] = b1[0];
b1[0] = flags.bagCache;
if (b1[0] == b2[0]) {
if (b2[1] < 64) {
var min = 64 - b2[1];
b2[1] += Math.min(min, b1[1]);
if (changeNum) core.addItem(b2[0], Math.min(min, b1[1]));
if (Math.min(min, b1[1]) == b1[1]) {
b1[0] = "";
b1[1] = 0;
} else {
b1[0] = b2[0];
b1[1] -= min;
}
} else {
b1[0] = b2[0];
b1[1] -= b2[1] - 64;
}
}
else {
flags.bagCache = b2[1];
b2[1] = b1[1];
b1[1] = flags.bagCache;
if (changeNum && b1[0] && b1[0] != b2[0]) {
if (isget) core.addItem(b1[0], b1[1]);
else core.addItem(b1[0], -b1[1]);
}
}
flags.cursor2 = 0;
flags.cursplit = 0;
}
else if (m1 == flags.cursplit && (b1[0] == b2[0] && b2[1] < 64) || b2[0] == "") {
var num;
isget ? num = Math.ceil(b1[1] / 2) : num = 1;
if (changeNum) isget ? core.addItem(b1[0], -num) : core.addItem(b1[0], num);
b2[0] = b1[0];
b2[1] += num;
b1[1] -= num;
if (b1[1] == 0) b1[0] = "";
flags.cursor2 = 0;
flags.cursplit = 0;
}
}
function collect1(b1, n1) {
if (flags.curdou != 1 || flags.bag[0][0] == "" || flags.bag[0][1] >= 64) {
flags.curdou = 0;
return;
}
for (var i = 0; i < n1; i++) {
if (b1[i][0] == flags.bag[0][0] && b1[i][1] < 10) {
var min = Math.min(b1[i][1], 64 - flags.bag[0][1]);
flags.bag[0][1] += min;
b1[i][1] -= min;
if (flags.bag[0][1] >= 64) {
flags.curdou = 0;
return;
}
}
}
for (var i = 1; i < 37; i++) {
if (flags.bag[i][0] == flags.bag[0][0] && flags.bag[i][1] < 10) {
var min = Math.min(flags.bag[i][1], 64 - flags.bag[0][1]);
flags.bag[0][1] += min;
flags.bag[i][1] -= min;
core.addItem(flags.bag[i][0], -min);
if (flags.bag[0][1] >= 64) {
flags.curdou = 0;
return;
}
}
}
for (var i = 0; i < n1; i++) {
if (b1[i][0] == flags.bag[0][0]) {
var min = Math.min(b1[i][1], 64 - flags.bag[0][1]);
flags.bag[0][1] += min;
b1[i][1] -= min;
if (flags.bag[0][1] >= 64) {
flags.curdou = 0;
return;
}
}
}
for (var i = 1; i < 37; i++) {
if (flags.bag[i][0] == flags.bag[0][0]) {
var min = Math.min(flags.bag[i][1], 64 - flags.bag[0][1]);
flags.bag[0][1] += min;
flags.bag[i][1] -= min;
core.addItem(flags.bag[i][0], -min);
if (flags.bag[0][1] >= 64) {
flags.curdou = 0;
return;
}
}
}
}
function putmore(b1, b2, m1) {
flags.cursor2 = core.plugin.clickloc(flags.curlight[0][0], flags.curlight[0][1]);
if (flags.cursor2 == undefined) {
flags.cursor2 = 0;
flags.cursplit = 0;
return;
}
if (!flags.curarr.includes(flags.cursor2)) {
if (m1 == 1) {
if (flags.curarr.length == 0) {
flags.curarr.push(flags.cursor2);
} else {
if ((flags.curarr[0] < 37 && flags.cursor2 < 37) ||
(flags.curarr[0] >= 37 && flags.cursor2 >= 37)) {
flags.curarr.push(flags.cursor2);
} else {
flags.cursor2 = 0;
flags.cursplit = 0;
return;
}
}
} else if (m1 == 2) {
flags.curarr.push(flags.cursor2);
}
} else {
flags.cursor2 = 0;
flags.cursplit = 0;
return;
}
var b;
if (flags.cursor2 < 37) {
b = flags.bag[flags.cursor2];
if (b[0] == flags.bag[0][0] && !flags.cursor2 in flags.splitCache2 == false) {
var c = flags.cursor2;
flags.splitCache2[c] = [b[0], b[1]];
}
} else {
b = b2[flags.cursor2 - 37];
if (b[0] == flags.bag[0][0] && flags.cursor2 in flags.splitCache2 == false) {
var c = flags.cursor2;
flags.splitCache2[c] = [b[0], b[1]];
}
}
if (m1 == 1) {
if (!flags.splitCache1) flags.splitCache1 = JSON.parse(JSON.stringify(b1));
if (b != undefined && ((b[0] == b1[0] && b[1] < 64) || b[0] == "") && flags.curarr.length <= flags.splitCache1[1]) {
if (flags.cursor2 >= 1 && flags.cursor2 < 37) {
//core.addItem(b1[0], Math.floor(b1[1] / flags.curarr.length));
b2 = flags.bag;
var long = 0;
for (var c in flags.curarr) {
if (b2[flags.curarr[c]][0] == flags.splitCache1[0] || b2[flags.curarr[c]][0] == "") {
long += 1;
}
}
for (var c in flags.curarr) {
if (b2[flags.curarr[c]][0] == flags.splitCache1[0] || b2[flags.curarr[c]][0] == "") {
b2[flags.curarr[c]][0] = b1[0];
if (long > 1 && b2[flags.curarr[c]][1] > 0) {
if (flags.curarr[c] in flags.splitCache2 &&
flags.splitCache2[flags.curarr[c]][0] != "" &&
flags.splitCache2[flags.curarr[c]][0] == flags.splitCache1[0]) {
var num = b2[flags.curarr[c]][1] - flags.splitCache2[flags.curarr[c]][1];
core.addItem(b2[flags.curarr[c]][0], -num);
b2[flags.curarr[c]][1] = flags.splitCache2[flags.curarr[c]][1];
} else {
core.addItem(b2[flags.curarr[c]][0], -b2[flags.curarr[c]][1]);
b2[flags.curarr[c]][1] = 0;
}
}
b2[flags.curarr[c]][1] += Math.floor(flags.splitCache1[1] / long);
core.addItem(b2[flags.curarr[c]][0], Math.floor(flags.splitCache1[1] / long));
}
}
b1[1] = flags.splitCache1[1];
b1[1] = flags.splitCache1[1] - (Math.floor(flags.splitCache1[1] / long) * long);
} else if (flags.cursor2 >= 37 && flags.cursor2 < 91) {
var long = 0;
for (var c in flags.curarr) {
if (b2[flags.curarr[c] - 37][0] == flags.splitCache1[0] || b2[flags.curarr[c] - 37][0] == "") {
long += 1;
}
}
for (var c in flags.curarr) {
if (b2[flags.curarr[c] - 37][0] == flags.splitCache1[0] || b2[flags.curarr[c] - 37][0] == "") {
b2[flags.curarr[c] - 37][0] = b1[0];
if (long > 1 && b2[flags.curarr[c] - 37][1] > 0) {
if (flags.curarr[c] in flags.splitCache2 &&
flags.splitCache2[flags.curarr[c]][0] != "" &&
flags.splitCache2[flags.curarr[c]][0] == flags.splitCache1[0]) {
b2[flags.curarr[c] - 37][1] = flags.splitCache2[flags.curarr[c]][1];
} else {
b2[flags.curarr[c] - 37][1] = 0;
}
}
b2[flags.curarr[c] - 37][1] += Math.floor(flags.splitCache1[1] / long);
}
}
b1[1] = flags.splitCache1[1];
b1[1] = flags.splitCache1[1] - (Math.floor(flags.splitCache1[1] / long) * long);
}
}
} else if (m1 == 2) {
if (b != undefined && ((b[0] == b1[0] && b[1] < 64) || b[0] == "")) {
if (flags.cursor2 >= 1 && flags.cursor2 < 37) {
core.addItem(b1[0], 1);
b[0] = b1[0];
b[1] += 1;
b1[1] -= 1;
if (b1[1] == 0) {
b1[0] = "";
core.deleteCanvas('viscous');
//core.clearMap('viscous');
}
} else if (flags.cursor2 >= 37 && flags.cursor2 < 91) {
b2[flags.cursor2 - 37][0] = b1[0];
b2[flags.cursor2 - 37][1] += 1;
b1[1] -= 1;
if (b1[1] == 0) {
b1[0] = "";
core.deleteCanvas('viscous');
//core.clearMap('viscous');
}
}
}
}
flags.cursor2 = 0;
flags.cursplit = 0;
}
function model(m1, list1, num1) {
if (flags.bag[0][0] == "") {
//拿起
if (m1 >= 1 && m1 < 37 && flags.bag[m1][0]) {
flags.curCache2[0] = m1;
var bag0 = flags.bag[flags.curCache2[0]];
switch1(bag0, flags.bag[0], m1, 1, 1);
} else if (m1 >= 37 && m1 < num1 && list1[m1 - 37][0]) {
flags.curCache2[0] = m1;
var list = list1[flags.curCache2[0] - 37];
switch1(list, flags.bag[0], m1, 1, 0);
}
} else if (flags.bag[0][0] != "" && flags.longleft == 0 && flags.longright == 0) {
//放下
if (m1 >= 1 && m1 < 37) {
flags.curCache2[0] = m1;
var bag0 = flags.bag[flags.curCache2[0]];
switch1(flags.bag[0], bag0, m1, 0, 1);
} else if (m1 >= 37 && m1 < num1) {
flags.curCache2[0] = m1;
var list = list1[flags.curCache2[0] - 37];
switch1(flags.bag[0], list, m1, 0, 0);
}
}
}
function manage(list1, num1) {
if (flags.transfer) return;
collect1(list1, num1 - 36);
if (!flags.mingan) {
model(flags.cursor2, list1, num1 + 1);
model(flags.cursplit, list1, num1 + 1);
}
if (flags.longleft) putmore(flags.bag[0], list1, 1);
else if (flags.longright && flags.bag[0][0] != "") putmore(flags.bag[0], list1, 2);
core.plugin.drawMC();
core.plugin.comMC();
}
},
"10-背包存储": function () {
this.beibaocunchu = function () {
if ("I705" in core.status.hero.items.tools) {
flags.level[1] += core.status.hero.items.tools["I705"];
core.plugin.jingyandengji();
core.addItem("I705", -core.status.hero.items.tools["I705"]);
}
var singleItemSum = 0;
//将已获得的装备映射到MC背包
for (let id in core.status.hero.items.equips) {
if (id) {
for (var j = 1; j <= 37; j++) {
if (id == flags.bag[j][0]) {
for (var k in flags.bag) {
if (k != '0' && id == flags.bag[k][0]) {
singleItemSum += flags.bag[k][1];
}
}
if (singleItemSum == core.status.hero.items.equips[id] && core.getEquip(0) == flags.bag[j][0]) {
flags.bag[j][1] += 1;
singleItemSum += 1;
}
if (singleItemSum < core.status.hero.items.equips[id] && core.getEquip(0) != flags.bag[j][0]) {
flags.bag[j][1] += core.status.hero.items.equips[id] - singleItemSum;
}
if (singleItemSum < core.status.hero.items.equips[id] && core.getEquip(0) == flags.bag[j][0]) {
flags.bag[j][1] += core.status.hero.items.equips[id] - singleItemSum + 1;
}
if (singleItemSum > core.status.hero.items.equips[id] && core.getEquip(0) != flags.bag[j][0]) {
flags.bag[j][1] -= singleItemSum - core.status.hero.items.equips[id];
}
if (singleItemSum > core.status.hero.items.equips[id] && core.getEquip(0) == flags.bag[j][0]) {
flags.bag[j][1] -= singleItemSum - core.status.hero.items.equips[id] - 1;
}
// core.plugin.lockMC();
// core.plugin.drawMC();
//实际7个装备1个背包6个显示7个
//实际5个装备1个背包4个应该显示5个
//实际7个装备0个背包7个显示7个
//实际5个装备0个背包5个应该显示5个
singleItemSum = 0;
break;
}
if (j == 37) {
for (var k = 1; k < 37; k++) {
if (!flags.bag[k][0]) {
flags.bag[k][0] = id;
if (core.getEquip(0) == flags.bag[k][0]) {
flags.bag[k][1] = core.status.hero.items.equips[id] + 1;
} else {
flags.bag[k][1] = core.status.hero.items.equips[id];
}
// core.plugin.lockMC();
// core.plugin.drawMC();
break;
}
if (k == 36) {
//console.log("背包满了");
}
}
}
}
}
}
//将已获得的消耗道具映射到MC背包
for (let id in core.status.hero.items.tools) {
if (id) {
for (var j = 1; j <= 37; j++) {
if (id == flags.bag[j][0]) {
for (var k in flags.bag) {
if (k != '0' && id == flags.bag[k][0]) {
singleItemSum += flags.bag[k][1];
}
}
if (singleItemSum < core.status.hero.items.tools[id]) {
flags.bag[j][1] += core.status.hero.items.tools[id] - singleItemSum;
}
if (singleItemSum > core.status.hero.items.tools[id]) {
flags.bag[j][1] -= singleItemSum - core.status.hero.items.tools[id];
}
// core.plugin.lockMC();
// core.plugin.drawMC();
singleItemSum = 0;
break;
}
if (j == 37) {
for (var k = 1; k < 37; k++) {
if (!flags.bag[k][0]) {
flags.bag[k][0] = id;
flags.bag[k][1] = core.status.hero.items.tools[id];
// core.plugin.lockMC();
// core.plugin.drawMC();
break;
}
if (k == 36) {
//console.log("背包满了");
}
}
}
}
}
}
//将已获得的永久道具映射到MC背包
for (let id in core.status.hero.items.constants) {
if (id) {
for (var j = 1; j <= 37; j++) {
if (id == flags.bag[j][0]) {
for (var k in flags.bag) {
if (k != '0' && id == flags.bag[k][0]) {
singleItemSum += flags.bag[k][1];
}
}
if (singleItemSum != core.status.hero.items.constants[id]) {
flags.bag[j][1] = 1;
}
// core.plugin.lockMC();
// core.plugin.drawMC();
singleItemSum = 0;
break;
}
if (j == 37) {
for (var k = 1; k < 37; k++) {
if (!flags.bag[k][0]) {
flags.bag[k][0] = id;
flags.bag[k][1] = 1;
// core.plugin.lockMC();
// core.plugin.drawMC();
break;
}
if (k == 36) {
//console.log("背包满了");
}
}
}
}
}
}
//背包内物品超过64个后的处理
for (var i = 1; i < 37; i++) {
if (flags.bag[i] && flags.bag[i][1] > 64) {
var number = flags.bag[i][1];
flags.bag[i][1] = 64;
for (var j = 1; j < 37; j++) {
if (flags.bag[j][0] == flags.bag[i][0] && flags.bag[j][1] < 64) {
flags.bag[j][1] += number - 64;
number = 0;
break;
}
}
if (number) {
for (var j = 1; j < 37; j++) {
if (!flags.bag[j][0]) {
flags.bag[j][0] = flags.bag[i][0];
flags.bag[j][1] = number - 64;
break;
}
}
}
// core.plugin.lockMC();
// core.plugin.drawMC();
}
}
core.plugin.lockMC();
core.plugin.drawMC();
core.plugin.invMC();
core.plugin.comMC();
}
},
"11-熔炉熔炼检测": function () {
this.ronglujiance = function () {
//检测当某个熔炉燃料和原料都有且成品栏有空间时,执行熔炼行为
flags.smeltcheck = 0;
for (var i in flags.furnacelist) {
if (flags.furnacelist[i][1][1] > 0 && (flags.furnacelist[i][0][1] > 0 || flags.furnacelist[i][3][1] > 0)) {
flags.smeltcheck = 1;
for (var j in flags.furGuide) {
if (j == flags.furnacelist[i][1][0]) {
if (flags.furGuide[j][0] == flags.furnacelist[i][2][0] && flags.furnacelist[i][2][1] < 64) {
if (flags.furnacelist[i][3][0] == 1) {
flags.furnacelist[i][2][1] += 1;
flags.furnacelist[i][1][1] -= 1;
if (flags.furnacelist[i][1][1] <= 0) {
flags.furnacelist[i][1] = ["", 0];
}
flags.furnacelist[i][3][0] = -1;
} else if (flags.furnacelist[i][3][0] == -1) {
flags.furnacelist[i][3][0] = 4;
}
} else if (!flags.furnacelist[i][2][0]) {
if (flags.furnacelist[i][3][0] == 1) {
flags.furnacelist[i][2][0] = flags.furGuide[j][0];
flags.furnacelist[i][2][1] += 1;
flags.furnacelist[i][1][1] -= 1;
if (flags.furnacelist[i][1][1] <= 0) {
flags.furnacelist[i][1] = ["", 0];
}
flags.furnacelist[i][3][0] = -1;
} else if (flags.furnacelist[i][3][0] == -1) {
flags.furnacelist[i][3][0] = 4;
}
}
}
}
} else {
flags.furnacelist[i][3][0] = -1;
}
//熔炉燃料值变化及自动补充燃料值
if (flags.furnacelist[i][3][0] > 0) {
flags.furnacelist[i][3][0] -= 1;
if (flags.furnacelist[i][3][1] > 0) {
flags.furnacelist[i][3][1] -= 1;
} else {
if (flags.furnacelist[i][0][0]) {
flags.furnacelist[i][0][1] -= 1;
for (var j in flags.fuelGuide) {
if (j == flags.furnacelist[i][0][0]) {
flags.furnacelist[i][3][1] = flags.fuelGuide[j][0];
flags.furnacelist[i][3][1] -= 1;
}
}
}
}
}
}
if (flags.interface == "熔炉") {
core.plugin.mcjiemian();
core.plugin.beibaocunchu();
}
setTimeout(function () {
if (flags.smeltcheck == 1) {
core.plugin.ronglujiance();
}
}, 1000);
}
},
"12-并行处理": function () {
function playbgm() {
core.setVolume(0.8);
var bgm = "";
if (core.status.floorId == null) {
if (core.rand2(2) == 0) {
bgm = 'menu1.mp3';
} else {
bgm = 'menu3.mp3';
}
} else {
var r1 = core.rand2(3);
if (r1 != 0) {
if (core.getBgNumber(core.status.hero.loc.x, core.status.hero.loc.y) == 343 ||
core.getBgNumber(core.status.hero.loc.x, core.status.hero.loc.y) == 344) {
if (core.rand2(2) == 0) {
bgm = 'desert1.mp3';
} else {
bgm = 'desert2.mp3';
}
} else if (core.getBgNumber(core.status.hero.loc.x, core.status.hero.loc.y) == 339 ||
core.getBgNumber(core.status.hero.loc.x, core.status.hero.loc.y) == 340) {
if (core.rand2(2) == 0) {
bgm = 'forest2.mp3';
} else {
bgm = 'forest5.mp3';
}
} else if (core.getBgNumber(core.status.hero.loc.x, core.status.hero.loc.y) == 345 ||
core.getBgNumber(core.status.hero.loc.x, core.status.hero.loc.y) == 348) {
if (core.rand2(2) == 0) {
bgm = 'ocean1.mp3';
} else {
bgm = 'ocean3.mp3';
}
} else if (core.getBgNumber(core.status.hero.loc.x, core.status.hero.loc.y) == 341 ||
core.getBgNumber(core.status.hero.loc.x, core.status.hero.loc.y) == 342) {
if (core.rand2(2) == 0) {
bgm = 'snowfield1.mp3';
} else {
bgm = 'snowfield2.mp3';
}
} else {
var r2 = core.rand2(8);
switch (r2) {
case 0:
bgm = 'zhu1.mp3';
break;
case 1:
bgm = 'zhu3.mp3';
break;
case 2:
bgm = 'zhu4.mp3';
break;
case 3:
bgm = 'zhu5.mp3';
break;
case 4:
bgm = 'zhu10.mp3';
break;
case 5:
bgm = 'zhu11.mp3';
break;
case 6:
bgm = 'zhu12.mp3';
break;
case 7:
bgm = 'zhu6.mp3';
break;
default:
bgm = 'zhu1.mp3';
break;
}
}
} else {
var r2 = core.rand2(8);
switch (r2) {
case 0:
bgm = 'zhu1.mp3';
break;
case 1:
bgm = 'zhu3.mp3';
break;
case 2:
bgm = 'zhu4.mp3';
break;
case 3:
bgm = 'zhu5.mp3';
break;
case 4:
bgm = 'zhu10.mp3';
break;
case 5:
bgm = 'zhu11.mp3';
break;
case 6:
bgm = 'zhu12.mp3';
break;
case 7:
bgm = 'zhu16.mp3';
break;
default:
bgm = 'zhu1.mp3';
break;
}
}
}
core.playBgm(bgm);
//console.log(bgm)
}
setInterval(function () {
if (!window.core) return;
if (!core.isPlaying) return;
if (!core.isPlaying()) return;
if (flags.worldlist["0"]["游戏规则"][1] == "开") {
var recover = 1;
if (flags.worldlist["0"]["难度"] == "简单") {
recover = 3;
} else if (flags.worldlist["0"]["难度"] == "普通") {
recover = 2;
} else if (flags.worldlist["0"]["难度"] == "困难") {
recover = 1;
}
//饱食度满时恢复生命
if (flags.hunger == undefined) return;
if (core.status.hero.hp > 0 &&
flags.hunger[0] / flags.hunger[1] >= 0.9 &&
core.status.hero.hp < core.status.hero.hpmax) {
if (flags.hunger[0] / flags.hunger[1] >= 0.98) {
core.status.hero.hp += recover * 2;
core.plugin.baoshidu(9);
}
core.status.hero.hp += recover;
if (core.status.hero.hp > core.status.hero.hpmax) core.status.hero.hp = core.status.hero.hpmax;
core.plugin.baoshidu(3);
//core.updateStatusBar(true, true);
core.plugin.hpBar(1);
}
}
//背景音乐切换
if (core.musicStatus.playingBgm == null) {
playbgm();
}
if (flags.step != 2) {
flags.step = 2;
}
}, 5000);
setInterval(function () {
if (!window.core) return;
if (!core.isPlaying) return;
if (!core.isPlaying()) return;
if (core.status.hero.loc.x == -1 && core.status.hero.loc.y == -1) return;
if (core.status.hero.hp > 0) {
//时间流逝
if (flags.worldlist["0"]["游戏规则"][5] == "开") {
flags.time += 1;
flags.sleep += 1;
} else if (flags.worldlist["0"]["游戏规则"][5] == "永昼") {
flags.time = 720;
} else if (flags.worldlist["0"]["游戏规则"][5] == "永夜") {
flags.time = 0;
}
core.updateStatusBar(true);
if (flags.time >= 1440) flags.time = 0;
//时间段变化
if (flags.dimension[0] == "主世界" && flags.dimension[1] == "地表") {
if (flags.time == 240) {
for (var eid in flags.enemylist) {
core.plugin.delenemy(eid, 0);
}
flags.tip[0] = "太阳升起了";
} else if (flags.time == 1200) {
flags.tip[0] = "月亮升起了";
}
if (flags.time >= 240 && flags.time < 360) {
flags.timePeriod = "日出";
core.plugin.drawLight('fg1', 0.4 - (flags.time - 240) * 0.0033, [[0, 0, 0]], 1);
} else if (flags.time >= 360 && flags.time < 1080) {
flags.timePeriod = "白天";
core.plugin.drawLight('fg1', 0, [[0, 0, 0]], 1);
} else if (flags.time >= 1080 && flags.time < 1200) {
flags.timePeriod = "黄昏";
core.plugin.drawLight('fg1', (flags.time - 1080) * 0.0033, [[0, 0, 0]], 1);
} else if ((flags.time >= 1200 && flags.time < 1440) || (flags.time >= 0 && flags.time < 240)) {
flags.timePeriod = "夜晚";
core.plugin.drawLight('fg1', 0.4, [[0, 0, 0]], 1);
}
} else if (flags.dimension[0] == "主世界" && flags.dimension[1] == "洞穴") {
if (flags.time >= 240 && flags.time < 360) {
flags.timePeriod = "日出";
} else if (flags.time >= 360 && flags.time < 1080) {
flags.timePeriod = "白天";
} else if (flags.time >= 1080 && flags.time < 1200) {
flags.timePeriod = "黄昏";
} else if ((flags.time >= 1200 && flags.time < 1440) || (flags.time >= 0 && flags.time < 240)) {
flags.timePeriod = "夜晚";
}
core.plugin.drawLight('fg1', 1, [[208, 208, 240]]);
}
if (core.status.floorId != "MT0" && core.status.floorId != "zzt1") {
var num = Object.keys(flags.enemylist).length;
var ref = (num * (num + 3) / 2) + 2;
if (flags.timePeriod != "夜晚") ref *= 3;
if (core.rand2(ref) == 0) core.plugin.shuaguai();
}
if (!core.getContextByName("bg1") || !core.getContextByName("sj1") || !core.getContextByName("fg1")) {
core.createCanvas("bg1", 0, 0, 416, 416, 11);
core.createCanvas("sj1", 0, 0, 416, 416, 31);
core.createCanvas("fg1", 0, 0, 416, 416, 61);
core.createCanvas("fg2", 0, 0, 416, 416, 101);
}
core.plugin.drawLight('bg1', 0.2, [
[0, 0, 0]
]);
core.plugin.drawLight('sj1', 0.2, [
[0, 0, 0]
]);
}
//自动保存
if (flags.worldindex > 1) {
if (flags.worldindex % 600 == 0) {
core.doSL(flags.worldlist["0"]["世界存档"][0], "save");
flags.tip[0] = "当前进度已保存";
}
if (flags.worldindex % 3600 == 0) {
core.doSL(flags.worldlist["0"]["世界存档"][1], "save");
}
flags.worldindex += 1;
}
//挖掘进度累减
if (flags.dig && flags.dig[4] > 0) {
flags.dig[4] -= 1000;
if (flags.dig[4] <= 0) {
flags.dig = [0, 0, 0, 0, 0];
core.deleteCanvas("dig");
}
}
}, 1000);
},
"13-科技": function () {
this.techUI = function () {//todo 科技实际效果
//显示科技界面及相关逻辑
if (flags.tech == 1) {
if (core.getContextByName("uievent") == null) {
core.createCanvas("uievent", 0, 0, 416, 416, 130);
} else {
core.clearMap('uievent');
core.createCanvas("uievent", 0, 0, 416, 416, 130);
}
var ctx = "uievent";
flags.interface = "锁定";
core.drawImage(ctx, "tech1.png", 0, 0, 416, 416);
core.fillBoldText(ctx, "退出", 370, 406, "#ff6661", "black", ui.prototype._buildFont(18, false), 416);
core.fillBoldText(ctx, "科技点:", 16, 28, "white", "black", ui.prototype._buildFont(18, false), 100);
core.ui.fillText(ctx, flags.tpointnum, 92, 28, "#fdffc2", ui.prototype._buildFont(16, false), 416);
core.fillBoldText(ctx, "世界等级:", 244, 28, "white", "black", ui.prototype._buildFont(18, false), 416);
core.ui.fillText(ctx, flags.worldlevel, 340, 28, "#941a00", ui.prototype._buildFont(16, false), 416);
for (var i = 1; i < 13; i++) {
var te = "";
var icon = "I560";
switch (i) {
case 1:
te = "灵感";
icon = "I673";
break;
case 2:
te = "领悟";
icon = "I629";
break;
case 3:
te = "生命之力";
icon = "I636";
break;
case 4:
te = "增幅";
icon = "I708";
break;
case 5:
te = "坚定";
icon = "I618";
break;
case 6:
te = "敏捷";
icon = "I572";
break;
case 7:
te = "耐力";
icon = "I633";
break;
case 8:
te = "空间扩展";
icon = "I709";
break;
case 9:
te = "守护之韧";
icon = "I610";
break;
case 10:
te = "锋锐恒久";
icon = "I581";
break;
case 11:
te = "生机";
icon = "I625";
break;
case 12:
te = "商贾之道";
icon = "I533";
break;
}
var lv1 = flags.tech1[te][0];
var lv2 = flags.tech1[te][1];
var text1 = te + lv1;
var text2 = lv1 >= lv2 ? flags.tech2[te][0][lv2 - 2] : flags.tech2[te][0][lv1 - 1];
var text3 = "科技点" + flags.tpointnum + "/" + flags.tech3[te][0][lv1 - 1] + "" + "钱币" + flags.coppernum + "/" + flags.tech3[te][1][lv1 - 1];
var x1 = i % 2 == 0 ? 218 : 16;
var y1 = (Math.ceil(i / 2) - 1) * 56 + 70;
var x2 = i % 2 == 0 ? 258 : 56;
var y2 = (Math.ceil(i / 2) - 1) * 56 + 86;
var x3 = i % 2 == 0 ? 258 : 56;
var y3 = (Math.ceil(i / 2) - 1) * 56 + 104;
var x4 = i % 2 == 0 ? 219 : 18;
var y4 = (Math.ceil(i / 2) - 1) * 56 + 74;
var color1 = "#e0f0ff";
var color2 = "#197b39";
var color3 = "#7d150c";
//绘制文本
core.drawIcon(ctx, icon, x4, y4, 32, 32);
core.ui.fillText(ctx, text1, x1, y1, color1, ui.prototype._buildFont(14, false), 416);
core.ui.fillText(ctx, text2, x2, y2, color1, ui.prototype._buildFont(14, false), 150);
if (lv1 < lv2) {
if (flags.tpointnum >= flags.tech3[te][0][lv1 - 1] &&
flags.coppernum >= flags.tech3[te][1][lv1 - 1]) {
core.ui.fillText(ctx, text3, x3, y3, color2, ui.prototype._buildFont(14, false), 150);
} else {
core.ui.fillText(ctx, text3, x3, y3, color3, ui.prototype._buildFont(14, false), 150);
}
}
}
} else if (flags.tech != 1 && flags.tech != -1) {
core.clearMap('uievent');
flags.interface = "锁定";
core.drawImage("uievent", "tech2.png", 0, 0, 416, 416);
core.fillBoldText("uievent", "确定升级该科技吗?", 120, 52, "white", "black", ui.prototype._buildFont(20, false), 416);
core.fillBoldText("uievent", "升级所需", 270, 176, "white", "black", ui.prototype._buildFont(18, false), 416);
core.fillBoldText("uievent", "升级", 272, 354, "white", "black", ui.prototype._buildFont(18, false), 416);
core.fillBoldText("uievent", "返回", 336, 354, "white", "black", ui.prototype._buildFont(18, false), 416);
var num = 2;
for (var te in flags.tech2) {
if (flags.tech == num) {
var icon = "I560";
switch (te) {
case "灵感":
icon = "I673";
break;
case "领悟":
icon = "I629";
break;
case "生命之力":
icon = "I636";
break;
case "增幅":
icon = "I708";
break;
case "坚定":
icon = "I618";
break;
case "敏捷":
icon = "I572";
break;
case "耐力":
icon = "I633";
break;
case "空间扩展":
icon = "I709";
break;
case "守护之韧":
icon = "I610";
break;
case "锋锐恒久":
icon = "I581";
break;
case "生机":
icon = "I625";
break;
case "商贾之道":
icon = "I533";
break;
}
var lv = flags.tech1[te];
var t1 = flags.tech2[te][1];
var t2 = flags.tech2[te][2];
var t3 = flags.tech2[te][3];
var needt = flags.tech3[te][0];
var needc = flags.tech3[te][1];
var needw = flags.tech3[te][2];
var color1 = "black";
var color2 = "#a3fabf";
var color3 = "#7d150c";
//名称+等级
core.ui.fillText("uievent", te + lv[0], 200, 112, color1, ui.prototype._buildFont(15, false), 416);
core.drawIcon("uievent", icon, 151, 92, 32, 32);
//科技升级
if (lv[0] < lv[1]) {
core.ui._uievent_drawTextContent({
ctx: "uievent",
text: (te + lv[0] + " -> " + te + (lv[0] + 1)),
left: 10,
top: 160,
maxWidth: 224,
fontSize: 15,
color: color1,
align: "center"
});
core.ui._uievent_drawTextContent({
ctx: "uievent",
text: (t1[lv[0] - 1]),
left: 10,
top: 210,
maxWidth: 224,
fontSize: 15,
color: color1,
align: "center"
});
} else {
core.ui._uievent_drawTextContent({
ctx: "uievent",
text: (te + lv[0]),
left: 10,
top: 160,
maxWidth: 224,
fontSize: 15,
color: color1,
align: "center"
});
core.ui._uievent_drawTextContent({
ctx: "uievent",
text: ("已满级"),
left: 10,
top: 210,
maxWidth: 224,
fontSize: 15,
color: color1,
align: "center"
});
}
//升级提升2
if (t2[lv[0] - 1]) {
core.ui._uievent_drawTextContent({
ctx: "uievent",
text: (t2[lv[0] - 1]),
left: 10,
top: 256,
maxWidth: 224,
fontSize: 15,
color: color1,
align: "center"
});
}
//科技描述
core.ui._uievent_drawTextContent({
ctx: "uievent",
text: t3[0],
left: 14,
top: 330,
maxWidth: 224,
fontSize: 15,
color: color1,
align: "center"
});
//升级条件
if (lv[0] < lv[1]) {
core.ui.fillText("uievent", "科技点 " + flags.tpointnum + "/" + needt[lv[0] - 1], 270, 210, flags.tpointnum >= needt[lv[0] - 1] ? color2 : color3, ui.prototype._buildFont(15, false), 416);
core.ui.fillText("uievent", "钱币 " + flags.coppernum + "/" + needc[lv[0] - 1], 270, 240, flags.coppernum >= needc[lv[0] - 1] ? color2 : color3, ui.prototype._buildFont(15, false), 416);
}
//升级限制
if (flags.worldlevel < needw[lv[0] - 1]) {
core.ui._uievent_drawTextContent({
ctx: "uievent",
text: "需求世界等级" + (needw[lv[0] - 1]) + "级",
left: 270,
top: 316,
maxWidth: 128,
fontSize: 13,
color: color3,
align: "left"
});
}
break;
} else {
num += 1;
}
}
} else if (flags.tech == -1) {
core.drawImage("uievent", "tech3.png", 0, 0, 416, 416);
core.ui._uievent_drawTextContent({
ctx: "uievent",
text: "1、初始世界等级为1级满级10级。世界等级会影响到敌怪属性、敌怪掉落、地图资源生成、BOSS奖励箱内资源丰厚程度等。\n2、每次世界等级提升后都可以在该界面领取丰厚的世界奖励每级世界等级仅限一次。\n3、目前已消耗${flags.tpointsum})个科技点。\n4、再次点击右上角的“问号”按钮可以返回科技界面。",
left: 32,
top: 64,
maxWidth: 352,
fontSize: 15,
color: "black",
align: "left"
});
}
//世界等级设定
if (flags.tpointsum >= 1 && flags.worldlevel == 1 ||
flags.tpointsum >= 6 && flags.worldlevel == 2 ||
flags.tpointsum >= 19 && flags.worldlevel == 3 ||
flags.tpointsum >= 47 && flags.worldlevel == 4 ||
flags.tpointsum >= 95 && flags.worldlevel == 5 ||
flags.tpointsum >= 170 && flags.worldlevel == 6 ||
flags.tpointsum >= 263 && flags.worldlevel == 7 ||
flags.tpointsum >= 374 && flags.worldlevel == 8 ||
flags.tpointsum >= 505 && flags.worldlevel == 9) {
flags.worldlevel += 1;
core.playSound("worldlevelup.ogg");
flags.tip[0] = "世界等级提升了,欢迎来到" + flags.worldlevel + "级世界!";
core.ui.drawStatusBar();
}
}
},
"14-自定义按键": function () {
this.zidingyianjian = function () {
//显示自定义按键界面
if (flags.CustomKey == 1) {
var ctx = "uievent";
flags.interface = "锁定";
if (core.getContextByName(ctx) == null) {
core.createCanvas(ctx, 0, 0, 416, 416, 130);
} else {
core.clearMap(ctx);
core.createCanvas(ctx, 0, 0, 416, 416, 130);
}
core.drawImage(ctx, "anjian.png", 0, 0, 416, 416);
core.fillBoldText(ctx, "退出", 354, 392, "#ff6661", "black", ui.prototype._buildFont(18, false), 416);
core.fillBoldText(ctx, "自定义按键", 160, 42, "white", "black", ui.prototype._buildFont(20, false), 416);
core.fillBoldText(ctx, "上一页", 100, 392, "white", "black", ui.prototype._buildFont(18, false), 416);
core.fillBoldText(ctx, "下一页", 270, 392, "white", "black", ui.prototype._buildFont(18, false), 416);
core.ui.fillText(ctx, flags.pagenumber, 206, 390, "black", ui.prototype._buildFont(15, false), 416);
for (var i = 1; i < 4; i++) {
for (var j = 0; j < 6; j++) {
if (i == flags.pagenumber) {
core.ui.fillText(ctx, flags.keylist[(i - 1) * 6 + j][0], 44, 100 + (46 * j), "black", ui.prototype._buildFont(15, false), 416);
core.drawTextContent(ctx, core.plugin.keyc(flags.keylist[(i - 1) * 6 + j][1]), { left: 274, top: 88 + (46 * j), maxWidth: 100, fontSize: 15, color: "black", align: "center" });
}
}
}
//显示自定义快捷键界面光标
if (flags.curKey) {
if (flags.pagenumber * 6 >= flags.curKey && flags.pagenumber * 6 - 5 <= flags.curKey) {
core.strokeRect(ctx, 272, 82 + 46 * (flags.curKey - ((flags.pagenumber - 1) * 6) - 1), 100, 30, "white");
} else {
flags.curKey = 0;
}
}
}
}
},
"15-饱食度检测": function () {
this.baoshidu = function (a = 0) {
//饱食度与饥饿值
if (flags.hunger[0] > 0) {
flags.hunger[2] += core.rand2(2 + a) + 1 + a;
if (flags.hunger[2] >= flags.hunger[3]) {
flags.hunger[2] = 0;
flags.hunger[0] -= 1;
}
} else if (flags.hunger[0] <= 0) {
flags.hunger[0] = 0;
flags.hunger[2] = 0;
core.status.hero.hp -= 1;
}
core.plugin.hungerBar();
}
},
"16-耐久度检测": function () {
this.reduceDur = function (type, damage) {
var list;
var dur;
switch (type) {
case "wea":
list = flags.weapon;
dur = flags.weaDur;
break;
case "tool":
list = flags.tool;
dur = flags.toolDur;
break;
case "equ":
list = flags.equip;
dur = flags.equDur;
break;
}
if (type == "wea" || type == "tool") {
for (var i in list) {
if (core.getEquip(0) == i) {
dur[i][0] -= 1;
if (dur[i][0] <= 0 && core.hasEquip(i)) {
// 装备耐久度为零后消失
core.unloadEquip(core.getEquipTypeById(i));
core.addItem(i, -1);
dur[i][0] = list[i][0] + flags.extraDur[1];
core.playSound("break1.ogg");
}
break;
}
}
} else if (type == "equ") {
var a = Math.floor(damage / 5);
var b = damage % 5;
for (var i in list) {
for (var j = 1; j < 6; j++) {
if (core.getEquip(j) == i) {
dur[i][0] -= a;
if (b != 0) {
dur[i][0] -= 1;
b -= 1;
}
if (dur[i][0] <= 0 && core.hasEquip(i)) {
// 装备耐久度为零后消失
core.unloadEquip(core.getEquipTypeById(i));
core.addItem(i, -1);
dur[i][0] = list[i][0] + flags.extraDur[0];
core.playSound("break2.ogg");
}
}
}
}
}
}
},
"17-经验和等级": function () {
this.jingyandengji = function () {
//玩家获得经验并检测是否升级
var levelup = 0;
do {
flags.level[2] = Math.floor(flags.level[0] / 10) * 5 + 100;
if (flags.level[1] >= flags.level[2]) {
flags.level[0] += 1;
flags.level[1] -= flags.level[2];
levelup = 1;
}
} while (flags.level[1] >= flags.level[2]);
core.playSound("orb.ogg");
if (levelup == 1) core.playSound("levelup.ogg");
core.plugin.expBar();
}
},
"18-自绘全屏标题": function () {
// 横屏下,使标题画面可以覆盖状态栏 554*422
// 竖屏下,标题画面依然和游戏画面大小相同 422*422
// 可能存在bug。遇到bug的话可以在技术群内找“理派四阵”反馈
// 本插件需要开启“标题事件化”才能使用且同时具有“标题”和“难度分歧”2个功能
if (!core.flags.startUsingCanvas) return;
//请按照“低-高”的顺序填写各个难度的英文名默认的flags.hard依次为1、2、3……以此类推
//和hard同样的顺序填写各个难度的颜色
//var hard = ["hard1", "hard2", "hard3"],
//hardColor = ["#3333DD", "#33DD33", "#DD3333"];
//以下部分,需要自行编写具体内容
//绘制部分:需要横竖屏分别绘制
//绘制标题界面
this.drawTitle = function () {
var ctx = document.getElementById("title").getContext('2d');
core.clearMap(ctx);
if (1/*!core.domStyle.isVertical*/) { }
switch (core.getFlag("title", 0)) {
case "开始界面":
core.drawImage(ctx, "jz2.png", 0, 0);
core.fillBoldText(ctx, "我的世界:生存", 110, 70, "white", "black",
ui.prototype._buildFont(50, false), 400);
core.fillText(ctx, "MC_survival 1.0.0", 5, 398, "white", ui.prototype._buildFont(13, false), 400);
core.fillText(ctx, "@ 天堑无涯", 5, 415, "white", ui.prototype._buildFont(13, false), 400);
if (flags.worldcur != 5) core.strokeRect(ctx, 445, 368, 100, 30, "white");
core.fillBoldText(ctx, "点我全屏~", 450, 390, "white", "black",
ui.prototype._buildFont(20, false), 400);
core.fillText(ctx, "作者在这里祝大家——新年快乐!", 330, 415, "white", ui.prototype._buildFont(15, false), 400);
core.drawImage(ctx, 'buttonA.png', 152, 140, 250, 36);
core.drawImage(ctx, 'buttonA.png', 152, 180, 250, 36);
core.drawImage(ctx, 'buttonA.png', 152, 240, 120, 36);
core.drawImage(ctx, 'buttonA.png', 282, 240, 120, 36);
core.drawTextContent(ctx, '单人游戏', { left: 72, top: 145, align: 'center', fontSize: 20 });
core.drawTextContent(ctx, '多人游戏', { left: 72, top: 185, align: 'center', fontSize: 20 });
core.drawTextContent(ctx, '教程关卡', { left: 137, top: 245, align: 'center', fontSize: 20 });
core.drawTextContent(ctx, 'Mod', { left: 6, top: 245, align: 'center', fontSize: 20 });
switch (flags.worldcur) {
case 1:
core.strokeRect(ctx, 154, 142, 246, 32, "#ebebeb");
break;
case 2:
core.strokeRect(ctx, 154, 182, 246, 32, "#ebebeb");
break;
case 3:
core.strokeRect(ctx, 154, 242, 116, 32, "#ebebeb");
break;
case 4:
core.strokeRect(ctx, 284, 242, 116, 32, "#ebebeb");
break;
case 5:
core.strokeRect(ctx, 405, 328, 140, 80, "white");
break;
}
break;
case "选择世界":
core.drawImage(ctx, "jz3.png", 0, 0);
core.setAlpha(ctx, 0.9);
core.fillRect(ctx, 170, 30, 220, 35, "black");
core.setAlpha(ctx, 0.8);
core.fillRect(ctx, 0, 80, 554, 250, "black");
core.setAlpha(ctx, 1);
core.strokeRect(ctx, 172, 32, 216, 31, "#9c9c9c");
core.drawImage(ctx, 'buttonA.png', 85, 340, 190, 30);
core.drawImage(ctx, 'buttonA.png', 285, 340, 190, 30);
core.drawImage(ctx, 'buttonA.png', 85, 380, 90, 30);
core.drawImage(ctx, 'buttonA.png', 185, 380, 90, 30);
core.drawImage(ctx, 'buttonA.png', 285, 380, 90, 30);
core.drawImage(ctx, 'buttonA.png', 385, 380, 90, 30);
core.fillText(ctx, "选择世界", 250, 20, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "进入选中的世界", 124, 360, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "创建新的世界", 330, 360, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "备份", 114, 400, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "删除", 214, 400, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "重命名", 309, 400, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "返回", 414, 400, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "<", 440, 70, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldpage, 470, 70, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, ">", 500, 70, "white", ui.prototype._buildFont(16, false), 400);
if (flags.worldcur2 != 0) {
core.drawImage(ctx, 'buttonA.png', 6, 380, 68, 30);
core.fillText(ctx, "访问历史存档", 10, 398, "white", ui.prototype._buildFont(10, false), 400);
}
if (core.getLocalStorage('world')) {
for (var i = 0; i < 4; i++) {
for (var j = 0; j < 2; j++) {
var num = (i * 4) + (j * 2) + 1;
if (core.getLocalStorage('world')[num + (flags.worldpage - 1) * 16]) {
var world = core.getLocalStorage('world')[num + (flags.worldpage - 1) * 16];
core.fillRect(ctx, 70 + (220 * j), 90 + (58 * i), 50, 50, "white");
core.fillText(ctx, world["世界名称"], 126 + (220 * j), 104 + (58 * i), "white", ui.prototype._buildFont(14, false), 400);
core.fillText(ctx, world["创建时间"], 126 + (220 * j), 120 + (58 * i), "#9c9c9c", ui.prototype._buildFont(13, false), 400);
core.fillText(ctx, world["游戏模式"] + "模式," + world["难度"], 126 + (220 * j), 136 + (58 * i), "#9c9c9c", ui.prototype._buildFont(13, false), 400);
}
}
}
}
switch (flags.worldcur) {
case 1:
core.strokeRect(ctx, 87, 342, 186, 26, "#ebebeb");
break;
case 2:
core.strokeRect(ctx, 287, 342, 186, 26, "#ebebeb");
break;
case 3:
core.strokeRect(ctx, 87, 382, 86, 26, "#ebebeb");
break;
case 4:
core.strokeRect(ctx, 187, 382, 86, 26, "#ebebeb");
break;
case 5:
core.strokeRect(ctx, 287, 382, 86, 26, "#ebebeb");
break;
case 6:
core.strokeRect(ctx, 387, 382, 86, 26, "#ebebeb");
break;
case 7:
core.strokeRect(ctx, 65, 85, 220, 60, "#ebebeb");
break;
case 8:
core.strokeRect(ctx, 285, 85, 220, 60, "#ebebeb");
break;
case 9:
core.strokeRect(ctx, 65, 143, 220, 60, "#ebebeb");
break;
case 10:
core.strokeRect(ctx, 285, 143, 220, 60, "#ebebeb");
break;
case 11:
core.strokeRect(ctx, 65, 201, 220, 60, "#ebebeb");
break;
case 12:
core.strokeRect(ctx, 285, 201, 220, 60, "#ebebeb");
break;
case 13:
core.strokeRect(ctx, 65, 259, 220, 60, "#ebebeb");
break;
case 14:
core.strokeRect(ctx, 285, 259, 220, 60, "#ebebeb");
break;
}
switch (flags.worldcur2) {
case 1:
core.strokeRect(ctx, 65, 85, 220, 60, "#ebebeb");
core.drawImage(ctx, "playarrow.png", 82, 100);
break;
case 2:
core.strokeRect(ctx, 285, 85, 220, 60, "#ebebeb");
core.drawImage(ctx, "playarrow.png", 302, 100);
break;
case 3:
core.strokeRect(ctx, 65, 143, 220, 60, "#ebebeb");
core.drawImage(ctx, "playarrow.png", 82, 158);
break;
case 4:
core.strokeRect(ctx, 285, 143, 220, 60, "#ebebeb");
core.drawImage(ctx, "playarrow.png", 302, 158);
break;
case 5:
core.strokeRect(ctx, 65, 201, 220, 60, "#ebebeb");
core.drawImage(ctx, "playarrow.png", 82, 216);
break;
case 6:
core.strokeRect(ctx, 285, 201, 220, 60, "#ebebeb");
core.drawImage(ctx, "playarrow.png", 302, 216);
break;
case 7:
core.strokeRect(ctx, 65, 259, 220, 60, "#ebebeb");
core.drawImage(ctx, "playarrow.png", 82, 274);
break;
case 8:
core.strokeRect(ctx, 285, 259, 220, 60, "#ebebeb");
core.drawImage(ctx, "playarrow.png", 302, 274);
break;
}
break;
case "教程":
core.drawImage(ctx, "jz2.png", 0, 0);
core.setAlpha(ctx, 0.6);
core.fillRect(ctx, 0, 0, 554, 422, "black");
core.setAlpha(ctx, 1);
core.drawImage(ctx, 'buttonA.png', 385, 380, 90, 30);
core.fillText(ctx, "敬请期待", 220, 100, "white", ui.prototype._buildFont(30, false), 400);
core.fillText(ctx, "返回", 414, 400, "white", ui.prototype._buildFont(16, false), 400);
switch (flags.worldcur) {
case 1:
core.strokeRect(ctx, 387, 382, 86, 26, "#ebebeb");
break;
}
break;
case "模组":
core.drawImage(ctx, "jz2.png", 0, 0);
core.setAlpha(ctx, 0.6);
core.fillRect(ctx, 0, 0, 554, 422, "black");
core.setAlpha(ctx, 1);
core.drawImage(ctx, 'buttonA.png', 385, 380, 90, 30);
core.fillText(ctx, "敬请期待", 220, 100, "white", ui.prototype._buildFont(30, false), 400);
core.fillText(ctx, "返回", 414, 400, "white", ui.prototype._buildFont(16, false), 400);
switch (flags.worldcur) {
case 1:
core.strokeRect(ctx, 387, 382, 86, 26, "#ebebeb");
break;
}
break;
case "多人游戏":
core.drawImage(ctx, "jz2.png", 0, 0);
core.setAlpha(ctx, 0.6);
core.fillRect(ctx, 0, 0, 554, 422, "black");
core.setAlpha(ctx, 1);
core.drawImage(ctx, 'buttonA.png', 385, 380, 90, 30);
core.fillText(ctx, "敬请期待", 220, 100, "white", ui.prototype._buildFont(30, false), 400);
core.fillText(ctx, "返回", 414, 400, "white", ui.prototype._buildFont(16, false), 400);
switch (flags.worldcur) {
case 1:
core.strokeRect(ctx, 387, 382, 86, 26, "#ebebeb");
break;
}
break;
case "创建世界_游戏":
core.drawImage(ctx, "jz3.png", 0, 0);
core.setAlpha(ctx, 0.9);
core.fillRect(ctx, 166, 80, 220, 35, "black");
core.setAlpha(ctx, 0.6);
core.fillRect(ctx, 0, 0, 554, 422, "black");
core.setAlpha(ctx, 1);
core.strokeRect(ctx, 168, 82, 216, 31, "#9c9c9c");
core.drawImage(ctx, 'buttonA.png', 36, 10, 160, 35);
core.drawImage(ctx, 'buttonA.png', 196, 10, 160, 35);
core.drawImage(ctx, 'buttonA.png', 356, 10, 160, 35);
core.drawImage(ctx, 'buttonA.png', 166, 125, 220, 30);
core.drawImage(ctx, 'buttonA.png', 166, 165, 220, 30);
core.drawImage(ctx, 'buttonA.png', 166, 205, 220, 30);
core.drawImage(ctx, 'buttonA.png', 166, 245, 220, 30);
core.drawImage(ctx, 'buttonA.png', 85, 380, 180, 30);
core.drawImage(ctx, 'buttonA.png', 285, 380, 180, 30);
core.fillText(ctx, "游戏", 98, 30, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "世界", 258, 30, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "更多", 420, 30, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "世界名称", 166, 72, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["世界名称"], 172, 100, "#9c9c9c", ui.prototype._buildFont(14, false), 400);
core.fillText(ctx, "游戏模式:" + flags.worldlist["0"]["游戏模式"], 226, 144, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "难度:" + flags.worldlist["0"]["难度"], 242, 184, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "游戏规则", 244, 224, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "MOD", 256, 264, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "创建新的世界", 130, 400, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "取消", 358, 400, "white", ui.prototype._buildFont(16, false), 400);
core.drawTextContent(ctx, flags.worldDescribe, { left: 400, top: 145, align: 'left', color: "white", fontSize: 16, maxWidth: 150 });
switch (flags.worldcur) {
case 1:
core.strokeRect(ctx, 198, 12, 156, 31, "#ebebeb");
break;
case 2:
core.strokeRect(ctx, 358, 12, 156, 31, "#ebebeb");
break;
case 3:
core.strokeRect(ctx, 168, 82, 216, 31, "#ebebeb");
break;
case 4:
core.strokeRect(ctx, 168, 127, 216, 26, "#ebebeb");
break;
case 5:
core.strokeRect(ctx, 168, 167, 216, 26, "#ebebeb");
break;
case 6:
core.strokeRect(ctx, 168, 207, 216, 26, "#ebebeb");
break;
case 7:
core.strokeRect(ctx, 168, 247, 216, 26, "#ebebeb");
break;
case 8:
core.strokeRect(ctx, 87, 382, 176, 26, "#ebebeb");
break;
case 9:
core.strokeRect(ctx, 287, 382, 176, 26, "#ebebeb");
break;
}
break;
case "创建世界_世界":
core.drawImage(ctx, "jz3.png", 0, 0);
core.setAlpha(ctx, 0.9);
core.fillRect(ctx, 84, 136, 380, 35, "black");
core.setAlpha(ctx, 0.6);
core.fillRect(ctx, 0, 0, 554, 422, "black");
core.setAlpha(ctx, 1);
core.strokeRect(ctx, 86, 138, 376, 31, "#9c9c9c");
core.drawImage(ctx, 'buttonA.png', 36, 10, 160, 35);
core.drawImage(ctx, 'buttonA.png', 196, 10, 160, 35);
core.drawImage(ctx, 'buttonA.png', 356, 10, 160, 35);
core.drawImage(ctx, 'buttonA.png', 85, 380, 180, 30);
core.drawImage(ctx, 'buttonA.png', 285, 380, 180, 30);
core.drawImage(ctx, 'buttonA.png', 404, 180, 60, 30);
core.drawImage(ctx, 'buttonA.png', 404, 215, 60, 30);
core.drawImage(ctx, 'buttonA.png', 404, 250, 60, 30);
core.drawImage(ctx, 'buttonA.png', 84, 80, 180, 35);
core.drawImage(ctx, 'buttonA.png', 284, 80, 180, 35);
core.fillText(ctx, "游戏", 98, 30, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "世界", 258, 30, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "更多", 420, 30, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "世界类型:" + flags.worldlist["0"]["世界选项"][0], 120, 102, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "自定义", 346, 102, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "世界生成器的种子", 86, 132, "white", ui.prototype._buildFont(14, false), 400);
core.fillText(ctx, flags.seed1 == undefined ? "留空以生成随机种子" : flags.seed1, 93, 158, "#9c9c9c", ui.prototype._buildFont(14, false), 400);
core.fillText(ctx, "生成结构", 86, 200, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "初始奖励箱", 86, 234, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "世界大小", 86, 268, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["世界选项"][1], 426, 200, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["世界选项"][2], 426, 234, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["世界选项"][3], 426, 268, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "创建新的世界", 130, 400, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "取消", 358, 400, "white", ui.prototype._buildFont(16, false), 400);
core.drawTextContent(ctx, flags.worldDescribe, { left: 90, top: 280, align: 'left', color: "white", fontSize: 16, maxWidth: 300 });
switch (flags.worldcur) {
case 1:
core.strokeRect(ctx, 38, 12, 156, 31, "#ebebeb");
break;
case 2:
core.strokeRect(ctx, 358, 12, 156, 31, "#ebebeb");
break;
case 3:
core.strokeRect(ctx, 86, 82, 176, 31, "#ebebeb");
break;
case 4:
core.strokeRect(ctx, 286, 82, 176, 31, "#ebebeb");
break;
case 5:
core.strokeRect(ctx, 86, 138, 376, 31, "#ebebeb");
break;
case 6:
core.strokeRect(ctx, 406, 182, 56, 26, "#ebebeb");
break;
case 7:
core.strokeRect(ctx, 406, 217, 56, 26, "#ebebeb");
break;
case 8:
core.strokeRect(ctx, 406, 252, 56, 26, "#ebebeb");
break;
case 9:
core.strokeRect(ctx, 87, 382, 176, 26, "#ebebeb");
break;
case 10:
core.strokeRect(ctx, 287, 382, 176, 26, "#ebebeb");
break;
}
break;
case "创建世界_更多":
core.drawImage(ctx, "jz3.png", 0, 0);
core.setAlpha(ctx, 0.6);
core.fillRect(ctx, 0, 0, 554, 422, "black");
core.setAlpha(ctx, 1);
core.drawImage(ctx, 'buttonA.png', 36, 10, 160, 35);
core.drawImage(ctx, 'buttonA.png', 196, 10, 160, 35);
core.drawImage(ctx, 'buttonA.png', 356, 10, 160, 35);
core.drawImage(ctx, 'buttonA.png', 85, 380, 180, 30);
core.drawImage(ctx, 'buttonA.png', 285, 380, 180, 30);
core.fillText(ctx, "游戏", 98, 30, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "世界", 258, 30, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "更多", 420, 30, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "创建新的世界", 130, 400, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "取消", 358, 400, "white", ui.prototype._buildFont(16, false), 400);
switch (flags.worldcur) {
case 1:
core.strokeRect(ctx, 38, 12, 156, 31, "#ebebeb");
break;
case 2:
core.strokeRect(ctx, 198, 12, 156, 31, "#ebebeb");
break;
case 3:
core.strokeRect(ctx, 87, 382, 176, 26, "#ebebeb");
break;
case 4:
core.strokeRect(ctx, 287, 382, 176, 26, "#ebebeb");
break;
}
break;
case "游戏规则":
core.drawImage(ctx, "jz3.png", 0, 0);
core.setAlpha(ctx, 0.6);
core.fillRect(ctx, 0, 0, 554, 422, "black");
core.setAlpha(ctx, 1);
core.drawImage(ctx, 'buttonA.png', 385, 50, 60, 30);
core.drawImage(ctx, 'buttonA.png', 385, 80, 60, 30);
core.drawImage(ctx, 'buttonA.png', 385, 140, 60, 30);
core.drawImage(ctx, 'buttonA.png', 385, 200, 60, 30);
core.drawImage(ctx, 'buttonA.png', 385, 230, 60, 30);
core.drawImage(ctx, 'buttonA.png', 385, 290, 60, 30);
core.drawImage(ctx, 'buttonA.png', 385, 320, 60, 30);
core.drawImage(ctx, 'buttonA.png', 285, 380, 180, 30);
core.fillText(ctx, "玩家", 260, 40, "yellow", ui.prototype._buildFont(20, false), 400);
core.fillText(ctx, "死亡经验惩罚", 100, 70, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "生命自然恢复", 100, 100, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "生物", 260, 130, "yellow", ui.prototype._buildFont(20, false), 400);
core.fillText(ctx, "允许破坏性生物行为", 100, 160, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "生成", 260, 190, "yellow", ui.prototype._buildFont(20, false), 400);
core.fillText(ctx, "启用特殊事件", 100, 220, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "生成幻翼", 100, 250, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "世界规则", 240, 280, "yellow", ui.prototype._buildFont(20, false), 400);
core.fillText(ctx, "游戏内时间流逝", 100, 310, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "火焰蔓延", 100, 340, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["游戏规则"][0], 408, 70, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["游戏规则"][1], 408, 100, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["游戏规则"][2], 408, 160, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["游戏规则"][3], 408, 220, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["游戏规则"][4], 408, 250, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["游戏规则"][5], 408, 310, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["游戏规则"][6], 408, 340, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "完成", 358, 400, "white", ui.prototype._buildFont(16, false), 400);
switch (flags.worldcur) {
case 1:
core.strokeRect(ctx, 387, 52, 56, 26, "#ebebeb");
break;
case 2:
core.strokeRect(ctx, 387, 82, 56, 26, "#ebebeb");
break;
case 3:
core.strokeRect(ctx, 387, 142, 56, 26, "#ebebeb");
break;
case 4:
core.strokeRect(ctx, 387, 202, 56, 26, "#ebebeb");
break;
case 5:
core.strokeRect(ctx, 387, 232, 56, 26, "#ebebeb");
break;
case 6:
core.strokeRect(ctx, 387, 292, 56, 26, "#ebebeb");
break;
case 7:
core.strokeRect(ctx, 387, 322, 56, 26, "#ebebeb");
break;
case 8:
core.strokeRect(ctx, 287, 382, 176, 26, "#ebebeb");
break;
}
break;
case "自定义世界":
core.drawImage(ctx, "jz3.png", 0, 0);
core.setAlpha(ctx, 0.6);
core.fillRect(ctx, 0, 0, 554, 422, "black");
core.setAlpha(ctx, 1);
core.drawImage(ctx, 'buttonA.png', 100, 80, 60, 30);
core.drawImage(ctx, 'buttonA.png', 100, 140, 60, 30);
core.drawImage(ctx, 'buttonA.png', 100, 200, 60, 30);
core.drawImage(ctx, 'buttonA.png', 100, 260, 60, 30);
core.drawImage(ctx, 'buttonA.png', 100, 320, 60, 30);
core.drawImage(ctx, 'buttonA.png', 170, 80, 60, 30);
core.drawImage(ctx, 'buttonA.png', 170, 140, 60, 30);
core.drawImage(ctx, 'buttonA.png', 170, 200, 60, 30);
core.drawImage(ctx, 'buttonA.png', 170, 260, 60, 30);
core.drawImage(ctx, 'buttonA.png', 170, 320, 60, 30);
core.drawImage(ctx, 'buttonA.png', 240, 80, 60, 30);
core.drawImage(ctx, 'buttonA.png', 310, 80, 60, 30);
core.drawImage(ctx, 'buttonA.png', 310, 140, 60, 30);
core.drawImage(ctx, 'buttonA.png', 310, 200, 60, 30);
core.drawImage(ctx, 'buttonA.png', 310, 260, 60, 30);
core.drawImage(ctx, 'buttonA.png', 310, 320, 60, 30);
core.drawImage(ctx, 'buttonA.png', 380, 80, 60, 30);
core.drawImage(ctx, 'buttonA.png', 380, 140, 60, 30);
core.drawImage(ctx, 'buttonA.png', 380, 200, 60, 30);
core.drawImage(ctx, 'buttonA.png', 380, 260, 60, 30);
core.drawImage(ctx, 'buttonA.png', 380, 320, 60, 30);
core.drawImage(ctx, 'buttonA.png', 285, 380, 180, 30);
core.fillText(ctx, "自定义", 240, 30, "white", ui.prototype._buildFont(20, false), 400);
core.fillText(ctx, "平原", 100, 70, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "森林", 100, 130, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "丛林", 100, 190, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "针叶林", 100, 250, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "雪原", 100, 310, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "沙漠", 170, 70, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "恶地", 170, 130, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "海洋", 170, 190, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "丘陵", 170, 250, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "蘑菇岛", 170, 310, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "河流", 240, 70, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "水井", 310, 70, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "废墟", 310, 130, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "岩浆池", 310, 190, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "废弃传送门", 310, 250, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "雪屋", 310, 310, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "前哨站", 380, 70, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "村庄", 380, 130, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "沉船", 380, 190, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "沙漠神殿", 380, 250, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "丛林神庙", 380, 310, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["地形"]["平原"][0] == 1 ? "正常" : (flags.worldlist["0"]["地形"]["平原"][0] == 2 ? "密集" : "稀疏"), 114, 100, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["地形"]["森林"][0] == 1 ? "正常" : (flags.worldlist["0"]["地形"]["森林"][0] == 2 ? "密集" : "稀疏"), 114, 160, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["地形"]["丛林"][0] == 1 ? "正常" : (flags.worldlist["0"]["地形"]["丛林"][0] == 2 ? "密集" : "稀疏"), 114, 220, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["地形"]["针叶林"][0] == 1 ? "正常" : (flags.worldlist["0"]["地形"]["针叶林"][0] == 2 ? "密集" : "稀疏"), 114, 280, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["地形"]["雪原"][0] == 1 ? "正常" : (flags.worldlist["0"]["地形"]["雪原"][0] == 2 ? "密集" : "稀疏"), 114, 340, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["地形"]["沙漠"][0] == 1 ? "正常" : (flags.worldlist["0"]["地形"]["沙漠"][0] == 2 ? "密集" : "稀疏"), 184, 100, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["地形"]["恶地"][0] == 1 ? "正常" : (flags.worldlist["0"]["地形"]["恶地"][0] == 2 ? "密集" : "稀疏"), 184, 160, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["地形"]["海洋"][0] == 1 ? "正常" : (flags.worldlist["0"]["地形"]["海洋"][0] == 2 ? "密集" : "稀疏"), 184, 220, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["地形"]["丘陵"][0] == 1 ? "正常" : (flags.worldlist["0"]["地形"]["丘陵"][0] == 2 ? "密集" : "稀疏"), 184, 280, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["地形"]["蘑菇岛"][0] == 1 ? "正常" : (flags.worldlist["0"]["地形"]["蘑菇岛"][0] == 2 ? "密集" : "稀疏"), 184, 340, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["地形"]["河流"][0] == 1 ? "正常" : (flags.worldlist["0"]["地形"]["河流"][0] == 2 ? "密集" : "稀疏"), 254, 100, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["结构"]["水井"][0] == 1 ? "正常" : (flags.worldlist["0"]["结构"]["水井"][0] == 2 ? "密集" : "稀疏"), 324, 100, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["结构"]["废墟"][0] == 1 ? "正常" : (flags.worldlist["0"]["结构"]["废墟"][0] == 2 ? "密集" : "稀疏"), 324, 160, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["结构"]["岩浆池"][0] == 1 ? "正常" : (flags.worldlist["0"]["结构"]["岩浆池"][0] == 2 ? "密集" : "稀疏"), 324, 220, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["结构"]["废弃传送门"][0] == 1 ? "正常" : (flags.worldlist["0"]["结构"]["废弃传送门"][0] == 2 ? "密集" : "稀疏"), 324, 280, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["结构"]["雪屋"][0] == 1 ? "正常" : (flags.worldlist["0"]["结构"]["雪屋"][0] == 2 ? "密集" : "稀疏"), 324, 340, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["结构"]["前哨站"][0] == 1 ? "正常" : (flags.worldlist["0"]["结构"]["前哨站"][0] == 2 ? "密集" : "稀疏"), 394, 100, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["结构"]["村庄"][0] == 1 ? "正常" : (flags.worldlist["0"]["结构"]["村庄"][0] == 2 ? "密集" : "稀疏"), 394, 160, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["结构"]["沉船"][0] == 1 ? "正常" : (flags.worldlist["0"]["结构"]["沉船"][0] == 2 ? "密集" : "稀疏"), 394, 220, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["结构"]["沙漠神殿"][0] == 1 ? "正常" : (flags.worldlist["0"]["结构"]["沙漠神殿"][0] == 2 ? "密集" : "稀疏"), 394, 280, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, flags.worldlist["0"]["结构"]["丛林神庙"][0] == 1 ? "正常" : (flags.worldlist["0"]["结构"]["丛林神庙"][0] == 2 ? "密集" : "稀疏"), 394, 340, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "完成", 358, 400, "white", ui.prototype._buildFont(16, false), 400);
break;
case "单一群系":
core.drawImage(ctx, "jz3.png", 0, 0);
core.setAlpha(ctx, 0.6);
core.fillRect(ctx, 0, 0, 554, 422, "black");
core.setAlpha(ctx, 1);
core.drawImage(ctx, 'buttonA.png', 100, 80, 60, 30);
core.drawImage(ctx, 'buttonA.png', 100, 140, 60, 30);
core.drawImage(ctx, 'buttonA.png', 100, 200, 60, 30);
core.drawImage(ctx, 'buttonA.png', 100, 260, 60, 30);
core.drawImage(ctx, 'buttonA.png', 100, 320, 60, 30);
core.drawImage(ctx, 'buttonA.png', 170, 80, 60, 30);
core.drawImage(ctx, 'buttonA.png', 170, 140, 60, 30);
core.drawImage(ctx, 'buttonA.png', 170, 200, 60, 30);
core.drawImage(ctx, 'buttonA.png', 170, 260, 60, 30);
core.drawImage(ctx, 'buttonA.png', 170, 320, 60, 30);
core.drawImage(ctx, 'buttonA.png', 240, 80, 60, 30);
core.drawImage(ctx, 'buttonA.png', 285, 380, 180, 30);
core.fillText(ctx, "自定义", 240, 30, "white", ui.prototype._buildFont(20, false), 400);
core.fillText(ctx, "平原", 100, 70, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "森林", 100, 130, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "丛林", 100, 190, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "针叶林", 100, 250, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "雪原", 100, 310, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "沙漠", 170, 70, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "恶地", 170, 130, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "海洋", 170, 190, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "丘陵", 170, 250, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "蘑菇岛", 170, 310, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "随机", 240, 70, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "选我", 114, 100, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "选我", 114, 160, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "选我", 114, 220, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "选我", 114, 280, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "选我", 114, 340, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "选我", 184, 100, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "选我", 184, 160, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "选我", 184, 220, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "选我", 184, 280, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "选我", 184, 340, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "选我", 254, 100, "white", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "完成", 358, 400, "white", ui.prototype._buildFont(16, false), 400);
break;
case "确认删除框":
core.drawImage(ctx, "jz3.png", 0, 0);
core.setAlpha(ctx, 0.8);
core.fillRect(ctx, 0, 80, 554, 250, "black");
core.setAlpha(ctx, 1);
if (core.getLocalStorage('world')) {
for (var i = 0; i < 4; i++) {
for (var j = 0; j < 2; j++) {
var num = (i * 4) + (j * 2) + 1;
if (core.getLocalStorage('world')[num]) {
var world = core.getLocalStorage('world')[num];
core.fillRect(ctx, 70 + (220 * j), 90 + (58 * i), 50, 50, "white");
core.fillText(ctx, world["世界名称"], 126 + (220 * j), 104 + (58 * i), "white", ui.prototype._buildFont(14, false), 400);
core.fillText(ctx, world["创建时间"], 126 + (220 * j), 120 + (58 * i), "#9c9c9c", ui.prototype._buildFont(13, false), 400);
core.fillText(ctx, world["游戏模式"] + "模式," + world["难度"], 126 + (220 * j), 136 + (58 * i), "#9c9c9c", ui.prototype._buildFont(13, false), 400);
}
}
}
}
core.drawImage(ctx, 'buttonA.png', 140, 330, 90, 30);
core.drawImage(ctx, 'buttonA.png', 320, 330, 90, 30);
core.fillText(ctx, "确认删除世界吗?该操作无法撤销", 90, 60, "white", ui.prototype._buildFont(30, false), 400);
core.fillText(ctx, "删除", 170, 350, "red", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "返回", 350, 350, "white", ui.prototype._buildFont(16, false), 400);
break;
}
}//开始界面操作
function StartInter(px, py, click) {
if (px >= 153 && px <= 404 && py >= 141 && py < 175) {
flags.worldcur = 1;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "选择世界");
} else if (px >= 153 && px <= 404 && py >= 182 && py < 216) {
flags.worldcur = 2;
if (click == 0) return;
core.playSound("取消");
core.setFlag('title', "多人游戏");
} else if (px >= 151 && px <= 273 && py >= 240 && py < 278) {
flags.worldcur = 3;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "教程");
} else if (px >= 283 && px <= 404 && py >= 241 && py < 275) {
flags.worldcur = 4;
if (click == 0) return;
core.playSound("取消");
flags.worldcur = 0;
core.setFlag('title', "模组");
} else if (px >= 400 && px <= 554 && py >= 330 && py < 422) {
flags.worldcur = 5;
if (click == 0) return;
core.playSound("取消");
flags.worldcur = 0;
core.plugin.triggerFulscreen(true);
} else {
flags.worldcur = 0;
}
}//进入选中的世界
function Enterworld() {
var save = (flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16;
flags.worldlist["0"]["世界存档"] = [save, save + 1];
core.removeFlag('start');
document.getElementById('title').style.display = 'none';
core.setFlag('title', 'character');
core.doSL(save, "load");
core.plugin.siwangjiance();
}//选择世界操作
function ChooseInter(px, py, click) {
if (px >= 85 && px <= 277 && py >= 340 && py < 370) {//进入选中世界
flags.worldcur = 1;
if (click == 0) return;
core.playSound("取消");
if (!flags.worldcur2) return;
Enterworld();
} else if (px >= 286 && px <= 477 && py >= 340 && py < 370) {//创建世界
flags.worldcur = 2;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "创建世界_游戏");
} else if (px >= 85 && px <= 176 && py >= 380 && py < 411) {//备份
flags.worldcur = 3;
if (click == 0) return;
core.playSound("取消");
if (!flags.worldcur2) return;
for (var i = 1; i <= 1000; i++) {
if (!core.hasSave(i * 2 - 1) || !core.hasSave(i * 2)) {
core.getLocalForage("save" + ((flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16), null, data => {
core.setLocalForage("save" + (i * 2 - 1), data);
});
core.getLocalForage("save" + ((flags.worldcur2 - 1) * 2 + 2 + (flags.worldpage - 1) * 16), null, data => {
core.setLocalForage("save" + (i * 2), data);
});
var world = core.getLocalStorage('world');
world[i * 2 - 1] = {
世界名称: world[(flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16]["世界名称"],
世界存档: [i * 2 - 1, i * 2],
世界选项: world[(flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16]["世界选项"],
游戏模式: world[(flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16]["游戏模式"],
难度: world[(flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16]["难度"],
游戏规则: world[(flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16]["游戏规则"],
创建时间: core.formatDate().slice(0, 16),
};
core.setLocalStorage('world', world);
alert("备份成功!");
break;
}
}
} else if (px >= 185 && px <= 276 && py >= 381 && py < 411) {//删除世界
flags.worldcur = 4;
if (click == 0) return;
core.playSound("取消");
if (!flags.worldcur2) return;
core.setFlag('title', "确认删除框");
} else if (px >= 286 && px <= 375 && py >= 382 && py < 409) {//重命名
flags.worldcur = 5;
if (click == 0) return;
core.playSound("取消");
if (!flags.worldcur2) return;
core.myprompt("请输入世界名称", "", function (result) {
if (result) {
var world = core.getLocalStorage('world');
world[(flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16] = {
世界名称: result,
世界存档: world[(flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16]["世界存档"],
世界选项: world[(flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16]["世界选项"],
游戏模式: world[(flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16]["游戏模式"],
难度: world[(flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16]["难度"],
游戏规则: world[(flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16]["游戏规则"],
创建时间: world[(flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16]["创建时间"],
};
core.setLocalStorage('world', world);
return;
}
});
} else if (px >= 385 && px <= 477 && py >= 380 && py < 409) {//返回开始界面
flags.worldcur = 6;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "开始界面");
} else if (px >= 2 && px <= 77 && py >= 375 && py < 414) {//访问历史存档
if (click == 0 || !flags.worldcur2) return;
core.playSound("取消");
var save = (flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16;
flags.worldlist["0"]["世界存档"] = [save, save + 1];
core.removeFlag('start');
document.getElementById('title').style.display = 'none';
core.setFlag('title', 'character');
core.doSL(save + 1, "load");
core.plugin.siwangjiance();
} else if (px >= 417 && px <= 476 && py >= 50 && py < 78) {//上一页
if (click == 0) return;
if (flags.worldpage > 1) flags.worldpage -= 1;
flags.worldcur2 = 0;
} else if (px >= 477 && px <= 540 && py >= 50 && py < 78) {//下一页
if (click == 0) return;
flags.worldpage += 1;
flags.worldcur2 = 0;
} else if (px >= 60 && px <= 280 && py >= 80 && py < 144) {
var file = 1 + (flags.worldpage - 1) * 16;
if (!core.getLocalStorage('world')[file.toString()]) {
flags.worldcur = 0;
return;
}
flags.worldcur = 7;
if (click == 0) return;
if (flags.worldcur2 == 1) Enterworld();
else flags.worldcur2 = 1;
} else if (px >= 281 && px <= 500 && py >= 80 && py < 144) {
var file = 3 + (flags.worldpage - 1) * 16;
if (!core.getLocalStorage('world')[file.toString()]) {
flags.worldcur = 0;
return;
}
flags.worldcur = 8;
if (click == 0) return;
if (flags.worldcur2 == 2) Enterworld();
else flags.worldcur2 = 2;
} else if (px >= 60 && px <= 280 && py >= 144 && py < 208) {
var file = 5 + (flags.worldpage - 1) * 16;
if (!core.getLocalStorage('world')[file.toString()]) {
flags.worldcur = 0;
return;
}
flags.worldcur = 9;
if (click == 0) return;
if (flags.worldcur2 == 3) Enterworld();
else flags.worldcur2 = 3;
} else if (px >= 281 && px <= 500 && py >= 144 && py < 208) {
var file = 7 + (flags.worldpage - 1) * 16;
if (!core.getLocalStorage('world')[file.toString()]) {
flags.worldcur = 0;
return;
}
flags.worldcur = 10;
if (click == 0) return;
if (flags.worldcur2 == 4) Enterworld();
else flags.worldcur2 = 4;
} else if (px >= 60 && px <= 280 && py >= 208 && py < 272) {
var file = 9 + (flags.worldpage - 1) * 16;
if (!core.getLocalStorage('world')[file.toString()]) {
flags.worldcur = 0;
return;
}
flags.worldcur = 11;
if (click == 0) return;
if (flags.worldcur2 == 5) Enterworld();
else flags.worldcur2 = 5;
} else if (px >= 281 && px <= 500 && py >= 208 && py < 272) {
var file = 11 + (flags.worldpage - 1) * 16;
if (!core.getLocalStorage('world')[file.toString()]) {
flags.worldcur = 0;
return;
}
flags.worldcur = 12;
if (click == 0) return;
if (flags.worldcur2 == 6) Enterworld();
else flags.worldcur2 = 6;
} else if (px >= 60 && px <= 280 && py >= 272 && py < 336) {
var file = 13 + (flags.worldpage - 1) * 16;
if (!core.getLocalStorage('world')[file.toString()]) {
flags.worldcur = 0;
return;
}
flags.worldcur = 13;
if (click == 0) return;
if (flags.worldcur2 == 7) Enterworld();
else flags.worldcur2 = 7;
} else if (px >= 281 && px <= 500 && py >= 272 && py < 336) {
var file = 15 + (flags.worldpage - 1) * 16;
if (!core.getLocalStorage('world')[file.toString()]) {
flags.worldcur = 0;
return;
}
flags.worldcur = 14;
if (click == 0) return;
if (flags.worldcur2 == 8) Enterworld();
else flags.worldcur2 = 8;
} else {
flags.worldcur = 0;
if (click == 0) return;
//flags.worldcur2 = 0;
}
}//教程界面操作
function GuideInter(px, py, click) {
if (px >= 386 && px <= 477 && py >= 380 && py < 409) {
flags.worldcur = 1;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "开始界面");
} else {
flags.worldcur = 0;
}
}//模组界面操作
function ModInter(px, py, click) {
if (px >= 386 && px <= 477 && py >= 380 && py < 409) {
flags.worldcur = 1;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "开始界面");
} else {
flags.worldcur = 0;
}
}//多人游戏界面操作
function MulInter(px, py, click) {
if (px >= 386 && px <= 477 && py >= 380 && py < 409) {
flags.worldcur = 1;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "开始界面");
} else {
flags.worldcur = 0;
}
}//创建世界
function CreateWorld() {
for (var i = 1; i <= 1000; i++) {
if (!core.hasSave(i * 2 - 1) || !core.hasSave(i * 2)) {
flags.worldlist["0"]["世界存档"] = [i * 2 - 1, i * 2];
flags.worldindex = 1;
break;
}
}
if (flags.seed1 == undefined || typeof flags.seed1 !== 'number') flags.seed1 = core.rand(100000000);
core.plugin.LCGrand();
var world = core.getLocalStorage('world');
world[flags.worldlist["0"]["世界存档"][0]] = {
世界名称: flags.worldlist["0"]["世界名称"],
世界存档: flags.worldlist["0"]["世界存档"],
世界选项: flags.worldlist["0"]["世界选项"],
游戏模式: flags.worldlist["0"]["游戏模式"],
难度: flags.worldlist["0"]["难度"],
游戏规则: flags.worldlist["0"]["游戏规则"],
创建时间: core.formatDate().slice(0, 16),
世界种子: flags.seed1,
};
core.setLocalStorage('world', world);
flags.time = 480;
if (flags.maplist == undefined) {
flags.maplist = {};
for (var floor in core.status.maps) {
flags.maplist[floor] = [];
for (var i = 0; i < 63; i++) {
flags.maplist[floor][i] = [];
}
}
}
if (flags.bglist == undefined) {
flags.bglist = {};
for (var floor in core.status.maps) {
flags.bglist[floor] = [];
for (var i = 0; i < 63; i++) {
flags.bglist[floor][i] = [];
}
}
}
//core.plugin.jiazaitu("jz4.png", 2000);
core.setFlag('title', 'createrate');
if (flags.worldlist["0"]["世界选项"][3] == "小" || flags.worldlist["0"]["世界选项"][3] == "中") {
core.plugin.WorldGeneration2();
} else if (flags.worldlist["0"]["世界选项"][3] == "大") {
core.plugin.WorldGeneration();
}
//core.plugin.Maplist();
if (flags.worldlist["0"]["世界选项"][2] == "开") {
core.setBlock(420, flags.revive[1], flags.revive[2], flags.revive[0]);
core.plugin.Chestloot("初始奖励箱", (flags.revive[1] * 1000 + flags.revive[2]).toString().padStart(6, '0') + flags.revive[0], 27);
}
//core.setLocalStorage('maplist', flags.maplist);
core.setFlag("maplist");
core.setFlag("bglist");
//core.setFlag('__' + "bg" + 'v__');
//core.plugin.jiazaitu("jz4.png", 4000);
if (flags.worldlist["0"]["难度"] == "简单") {
flags.property.crit += 0.5;
flags.property.reduceDa += 0.4;
flags.hunger[3] = 30;
} else if (flags.worldlist["0"]["难度"] == "普通") {
flags.property.reduceDa += 0.2;
flags.hunger[3] = 15;
} else if (flags.worldlist["0"]["难度"] == "困难") {
flags.hunger[3] = 10;
}
setTimeout(function () {
if (flags.worldindex == 1 && core.status.hero.loc.x >= 0 && core.status.hero.loc.y >= 0) {
var save = flags.worldlist["0"]["世界存档"];
if (!core.hasSave(save[0]) ||
!core.hasSave(save[1])) {
for (var si = 0; si < 2; si++) {
core.doSL(save[si], "save");
}
}
flags.worldindex = 2;
flags.tip[0] = "进度已保存";
}
}, 2000);
core.removeFlag('start');
document.getElementById('title').style.display = 'none';
core.setFlag('title', 'character');
}//创建世界_游戏 操作
function Create_Game(px, py, click) {
if (px >= 197 && px <= 357 && py >= 12 && py < 42) {//切换到世界页签
flags.worldcur = 1;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "创建世界_世界");
} else if (px >= 358 && px <= 516 && py >= 12 && py < 42) {//切换到更多页签
flags.worldcur = 2;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "创建世界_更多");
} else if (px >= 167 && px <= 387 && py >= 82 && py < 113) {//命名
flags.worldcur = 3;
if (click == 0) return;
core.myprompt("请输入世界名称", flags.worldlist["0"]["世界名称"], function (result) {
if (result) {
flags.worldlist["0"]["世界名称"] = result;
return;
}
});
} else if (px >= 167 && px <= 387 && py >= 127 && py < 153) {//游戏模式
flags.worldcur = 4;
if (flags.worldlist["0"]["游戏模式"] == "生存") {
flags.worldDescribe = "探索未知的世界,尽情建造、收集、合成并与怪物战斗";
} else if (flags.worldlist["0"]["游戏模式"] == "创造") {
flags.worldDescribe = "这个模式还没做,所以选这个也是生存";
} else if (flags.worldlist["0"]["游戏模式"] == "冒险") {
flags.worldDescribe = "这个模式还没做,所以选这个也是生存";
} else if (flags.worldlist["0"]["游戏模式"] == "极限") {
flags.worldDescribe = "这个模式还没做,所以选这个也是生存";
}
if (click == 0) return;
core.playSound("取消");
if (flags.worldlist["0"]["游戏模式"] == "生存") {
flags.worldlist["0"]["游戏模式"] = "创造";
flags.worldDescribe = "这个模式还没做,所以选这个也是生存";
} else if (flags.worldlist["0"]["游戏模式"] == "创造") {
flags.worldlist["0"]["游戏模式"] = "冒险";
flags.worldDescribe = "这个模式还没做,所以选这个也是生存";
} else if (flags.worldlist["0"]["游戏模式"] == "冒险") {
flags.worldlist["0"]["游戏模式"] = "极限";
flags.worldDescribe = "这个模式还没做,所以选这个也是生存";
} else if (flags.worldlist["0"]["游戏模式"] == "极限") {
flags.worldlist["0"]["游戏模式"] = "生存";
flags.worldDescribe = "探索未知的世界,尽情建造、收集、合成并与怪物战斗";
}
} else if (px >= 167 && px <= 387 && py >= 167 && py < 196) {//难度
flags.worldcur = 5;
if (flags.worldlist["0"]["难度"] == "简单") {
flags.worldDescribe = "简单模式:更多的生命恢复,额外增伤和减伤加成,不容易饿。但无法完成挑战成就";
} else if (flags.worldlist["0"]["难度"] == "普通") {
flags.worldDescribe = "普通模式适中的生命恢复额外减伤加成。但委托2倍消耗";
} else if (flags.worldlist["0"]["难度"] == "困难") {
flags.worldDescribe = "困难模式较少的生命恢复委托2倍消耗";
}
if (click == 0) return;
core.playSound("取消");
if (flags.worldlist["0"]["难度"] == "简单") {
flags.worldlist["0"]["难度"] = "普通";
flags.worldDescribe = "普通模式适中的生命恢复额外减伤加成。但委托2倍消耗";
} else if (flags.worldlist["0"]["难度"] == "普通") {
flags.worldlist["0"]["难度"] = "困难";
flags.worldDescribe = "困难模式较少的生命恢复委托2倍消耗";
} else if (flags.worldlist["0"]["难度"] == "困难") {
flags.worldlist["0"]["难度"] = "简单";
flags.worldDescribe = "简单模式:更多的生命恢复,额外增伤和减伤加成,不容易饿。但无法完成挑战成就";
}
} else if (px >= 167 && px <= 387 && py >= 207 && py < 235) {//游戏规则
flags.worldcur = 6;
flags.worldDescribe = "一些可调整的游戏规则";
if (click == 0) return;
core.playSound("取消");
core.setFlag('title', "游戏规则");
} else if (px >= 167 && px <= 387 && py >= 246 && py < 276) {//模组
flags.worldcur = 7;
flags.worldDescribe = "敬请期待";
if (click == 0) return;
core.playSound("取消");
flags.worldDescribe = "敬请期待";
} else if (px >= 85 && px <= 264 && py >= 379 && py < 411) {//生成世界
flags.worldcur = 8;
if (click == 0) return;
core.playSound("取消");
CreateWorld();
} else if (px >= 286 && px <= 467 && py >= 379 && py < 411) {//返回
flags.worldcur = 9;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "选择世界");
} else {
flags.worldcur = 0;
flags.worldDescribe = "";
if (click == 0) return;
}
}//创建世界_世界 操作
function Create_World(px, py, click) {
if (px >= 36 && px <= 196 && py >= 12 && py < 42) {//切换到游戏页签
flags.worldcur = 1;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "创建世界_游戏");
} else if (px >= 358 && px <= 516 && py >= 12 && py < 42) {//切换到更多页签
flags.worldcur = 2;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "创建世界_更多");
} else if (px >= 84 && px <= 264 && py >= 82 && py < 113) {//世界类型
flags.worldcur = 3;
if (flags.worldlist["0"]["世界选项"][0] == "默认") {
flags.worldDescribe = "探索设定好的数十个生物群系";
} else if (flags.worldlist["0"]["世界选项"][0] == "单一群系") {
flags.worldDescribe = "整个世界只包含一个生物群系!可以指定或随机";
}
if (click == 0) return;
core.playSound("取消");
if (flags.worldlist["0"]["世界选项"][0] == "默认") {
flags.worldlist["0"]["世界选项"][0] = "单一群系";
flags.worldDescribe = "整个世界只包含一个生物群系!可以指定或随机";
} else if (flags.worldlist["0"]["世界选项"][0] == "单一群系") {
flags.worldlist["0"]["世界选项"][0] = "默认";
flags.worldDescribe = "探索设定好的数十个生物群系";
}
} else if (px >= 284 && px <= 465 && py >= 82 && py < 113) {//自定义
flags.worldcur = 4;
if (click == 0) return;
core.playSound("取消");
if (flags.worldlist["0"]["世界选项"][0] == "默认") {
core.setFlag('title', "自定义世界");
} else if (flags.worldlist["0"]["世界选项"][0] == "单一群系") {
core.setFlag('title', "单一群系");
}
} else if (px >= 86 && px <= 463 && py >= 137 && py < 168) {//种子
flags.worldcur = 5;
if (click == 0) return;
core.myprompt("请输入世界种子", flags.seed1, function (result) {
if (result) {
flags.seed1 = parseInt(result);
return;
}
});
} else if (px >= 403 && px <= 464 && py >= 181 && py < 209) {//是否生成结构
flags.worldcur = 6;
flags.worldDescribe = "是否生成村庄、沉船等结构";
if (click == 0) return;
core.playSound("取消");
if (flags.worldlist["0"]["世界选项"][1] == "开") {
flags.worldlist["0"]["世界选项"][1] = "关";
} else if (flags.worldlist["0"]["世界选项"][1] == "关") {
flags.worldlist["0"]["世界选项"][1] = "开";
}
} else if (px >= 403 && px <= 464 && py >= 216 && py < 246) {//是否生成奖励箱
flags.worldcur = 7;
flags.worldDescribe = "是否生成初始奖励箱";
if (click == 0) return;
core.playSound("取消");
if (flags.worldlist["0"]["世界选项"][2] == "开") {
flags.worldlist["0"]["世界选项"][2] = "关";
} else if (flags.worldlist["0"]["世界选项"][2] == "关") {
flags.worldlist["0"]["世界选项"][2] = "开";
}
} else if (px >= 403 && px <= 464 && py >= 251 && py < 281) {//世界大小
flags.worldcur = 8;
if (flags.worldlist["0"]["世界选项"][3] == "大") {
flags.worldDescribe = "主世界地表为5X5的区域其他层为3X3的区域性能压力和跑图压力较高不推荐";
} else if (flags.worldlist["0"]["世界选项"][3] == "中") {
flags.worldDescribe = "所有层均为3X3的区域跑图压力小";
} else if (flags.worldlist["0"]["世界选项"][3] == "小") {
flags.worldDescribe = "所有层均为2X2的区域麻雀虽小五脏俱全这个还没做所以也是中型世界";
}
if (click == 0) return;
core.playSound("取消");
if (flags.worldlist["0"]["世界选项"][3] == "大") {
flags.worldlist["0"]["世界选项"][3] = "小";
flags.worldDescribe = "所有层均为2X2的区域麻雀虽小五脏俱全这个还没做所以也是中型世界";
} else if (flags.worldlist["0"]["世界选项"][3] == "中") {
flags.worldlist["0"]["世界选项"][3] = "大";
flags.worldDescribe = "主世界地表为5X5的区域其他层为3X3的区域性能压力和跑图压力较高不推荐";
} else if (flags.worldlist["0"]["世界选项"][3] == "小") {
flags.worldlist["0"]["世界选项"][3] = "中";
flags.worldDescribe = "所有层均为3X3的区域跑图压力小";
}
} else if (px >= 85 && px <= 264 && py >= 379 && py < 411) {//生成世界
flags.worldcur = 9;
if (click == 0) return;
core.playSound("取消");
CreateWorld();
} else if (px >= 286 && px <= 467 && py >= 379 && py < 411) {//返回
flags.worldcur = 10;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "选择世界");
} else {
flags.worldcur = 0;
flags.worldDescribe = "";
if (click == 0) return;
}
}//创建世界_更多 操作
function Create_More(px, py, click) {
if (px >= 36 && px <= 196 && py >= 12 && py < 42) {
flags.worldcur = 1;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "创建世界_游戏");
} else if (px >= 198 && px <= 356 && py >= 12 && py < 42) {
flags.worldcur = 2;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "创建世界_世界");
} else if (px >= 85 && px <= 264 && py >= 379 && py < 411) {
flags.worldcur = 3;
if (click == 0) return;
core.playSound("取消");
CreateWorld();
} else if (px >= 286 && px <= 467 && py >= 379 && py < 411) {
flags.worldcur = 4;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "选择世界");
} else {
flags.worldcur = 0;
if (click == 0) return;
flags.worldDescribe = "";
}
}//游戏规则
function GameRule(px, py, click) {
if (px >= 385 && px <= 445 && py >= 50 && py < 80) {
flags.worldcur = 1;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
if (flags.worldlist["0"]["游戏规则"][0] == "开") flags.worldlist["0"]["游戏规则"][0] = "关";
else flags.worldlist["0"]["游戏规则"][0] = "开";
} else if (px >= 385 && px <= 445 && py >= 81 && py < 110) {
flags.worldcur = 2;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
if (flags.worldlist["0"]["游戏规则"][1] == "开") flags.worldlist["0"]["游戏规则"][1] = "关";
else flags.worldlist["0"]["游戏规则"][1] = "开";
} else if (px >= 385 && px <= 445 && py >= 140 && py < 170) {
flags.worldcur = 3;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
if (flags.worldlist["0"]["游戏规则"][2] == "开") flags.worldlist["0"]["游戏规则"][2] = "关";
else flags.worldlist["0"]["游戏规则"][2] = "开";
} else if (px >= 385 && px <= 445 && py >= 200 && py < 230) {
flags.worldcur = 4;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
if (flags.worldlist["0"]["游戏规则"][3] == "开") flags.worldlist["0"]["游戏规则"][3] = "关";
else flags.worldlist["0"]["游戏规则"][3] = "开";
} else if (px >= 385 && px <= 445 && py >= 231 && py < 260) {
flags.worldcur = 5;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
if (flags.worldlist["0"]["游戏规则"][4] == "开") flags.worldlist["0"]["游戏规则"][4] = "关";
else flags.worldlist["0"]["游戏规则"][4] = "开";
} else if (px >= 385 && px <= 445 && py >= 290 && py < 320) {
flags.worldcur = 6;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
if (flags.worldlist["0"]["游戏规则"][5] == "开") {
flags.worldlist["0"]["游戏规则"][5] = "永昼";
} else if (flags.worldlist["0"]["游戏规则"][5] == "永昼") {
flags.worldlist["0"]["游戏规则"][5] = "永夜";
} else if (flags.worldlist["0"]["游戏规则"][5] == "永夜") {
flags.worldlist["0"]["游戏规则"][5] = "开";
}
} else if (px >= 385 && px <= 445 && py >= 321 && py < 350) {
flags.worldcur = 7;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
if (flags.worldlist["0"]["游戏规则"][6] == "开") flags.worldlist["0"]["游戏规则"][6] = "关";
else flags.worldlist["0"]["游戏规则"][6] = "开";
} else if (px >= 286 && px <= 467 && py >= 379 && py < 411) {
flags.worldcur = 8;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "创建世界_游戏");
} else {
flags.worldcur = 0;
if (click == 0) return;
flags.worldDescribe = "";
}
}//自定义世界
function DIYworld(px, py, click) {
if (px >= 100 && px <= 160 && py >= 80 && py < 110) {
flags.worldcur = 1;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "地形";
var t2 = "平原";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 100 && px <= 160 && py >= 140 && py < 170) {
flags.worldcur = 2;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "地形";
var t2 = "森林";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 100 && px <= 160 && py >= 200 && py < 230) {
flags.worldcur = 3;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "地形";
var t2 = "丛林";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 100 && px <= 160 && py >= 260 && py < 290) {
flags.worldcur = 4;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "地形";
var t2 = "针叶林";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 100 && px <= 160 && py >= 320 && py < 350) {
flags.worldcur = 5;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "地形";
var t2 = "雪原";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 170 && px <= 230 && py >= 80 && py < 110) {
flags.worldcur = 6;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "地形";
var t2 = "沙漠";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 170 && px <= 230 && py >= 140 && py < 170) {
flags.worldcur = 7;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "地形";
var t2 = "恶地";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 170 && px <= 230 && py >= 200 && py < 230) {
flags.worldcur = 8;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "地形";
var t2 = "海洋";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 170 && px <= 230 && py >= 260 && py < 290) {
flags.worldcur = 9;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "地形";
var t2 = "丘陵";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 170 && px <= 230 && py >= 320 && py < 350) {
flags.worldcur = 10;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "地形";
var t2 = "蘑菇岛";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 240 && px <= 300 && py >= 80 && py < 110) {
flags.worldcur = 11;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "地形";
var t2 = "河流";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 310 && px <= 370 && py >= 80 && py < 110) {
flags.worldcur = 12;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "结构";
var t2 = "水井";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 310 && px <= 370 && py >= 140 && py < 170) {
flags.worldcur = 13;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "结构";
var t2 = "废墟";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 310 && px <= 370 && py >= 200 && py < 230) {
flags.worldcur = 14;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "结构";
var t2 = "岩浆池";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 310 && px <= 370 && py >= 260 && py < 290) {
flags.worldcur = 15;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "结构";
var t2 = "废弃传送门";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 310 && px <= 370 && py >= 320 && py < 250) {
flags.worldcur = 16;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "结构";
var t2 = "雪屋";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 380 && px <= 440 && py >= 80 && py < 110) {
flags.worldcur = 17;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "结构";
var t2 = "前哨站";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 380 && px <= 440 && py >= 140 && py < 170) {
flags.worldcur = 18;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "结构";
var t2 = "村庄";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 380 && px <= 440 && py >= 200 && py < 230) {
flags.worldcur = 19;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "结构";
var t2 = "沉船";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 380 && px <= 440 && py >= 260 && py < 290) {
flags.worldcur = 20;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "结构";
var t2 = "沙漠神殿";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 380 && px <= 440 && py >= 320 && py < 350) {
flags.worldcur = 21;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var t1 = "结构";
var t2 = "丛林神庙";
if (flags.worldlist["0"][t1][t2][0] == 1) {
flags.worldlist["0"][t1][t2][0] = 2;
} else if (flags.worldlist["0"][t1][t2][0] == 2) {
flags.worldlist["0"][t1][t2][0] = 0.5;
} else if (flags.worldlist["0"][t1][t2][0] == 0.5) {
flags.worldlist["0"][t1][t2][0] = 1;
}
} else if (px >= 286 && px <= 467 && py >= 379 && py < 411) {
flags.worldcur = 8;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "创建世界_世界");
} else {
flags.worldcur = 0;
if (click == 0) return;
flags.worldDescribe = "";
}
}//单一群系
function SingleFormation(px, py, click) {
if (px >= 100 && px <= 160 && py >= 80 && py < 110) {
flags.worldcur = 1;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
flags.worldlist["0"]["单一群系"][0] = "平原";
core.setFlag('title', "创建世界_世界");
} else if (px >= 100 && px <= 160 && py >= 140 && py < 170) {
flags.worldcur = 2;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
flags.worldlist["0"]["单一群系"][0] = "森林";
core.setFlag('title', "创建世界_世界");
} else if (px >= 100 && px <= 160 && py >= 200 && py < 230) {
flags.worldcur = 3;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
flags.worldlist["0"]["单一群系"][0] = "丛林";
core.setFlag('title', "创建世界_世界");
} else if (px >= 100 && px <= 160 && py >= 260 && py < 290) {
flags.worldcur = 4;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
flags.worldlist["0"]["单一群系"][0] = "针叶林";
core.setFlag('title', "创建世界_世界");
} else if (px >= 100 && px <= 160 && py >= 320 && py < 350) {
flags.worldcur = 5;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
flags.worldlist["0"]["单一群系"][0] = "雪原";
core.setFlag('title', "创建世界_世界");
} else if (px >= 170 && px <= 230 && py >= 80 && py < 110) {
flags.worldcur = 6;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
flags.worldlist["0"]["单一群系"][0] = "沙漠";
core.setFlag('title', "创建世界_世界");
} else if (px >= 170 && px <= 230 && py >= 140 && py < 170) {
flags.worldcur = 7;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
flags.worldlist["0"]["单一群系"][0] = "恶地";
core.setFlag('title', "创建世界_世界");
} else if (px >= 170 && px <= 230 && py >= 200 && py < 230) {
flags.worldcur = 8;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
flags.worldlist["0"]["单一群系"][0] = "海洋";
core.setFlag('title', "创建世界_世界");
} else if (px >= 170 && px <= 230 && py >= 260 && py < 290) {
flags.worldcur = 9;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
flags.worldlist["0"]["单一群系"][0] = "丘陵";
core.setFlag('title', "创建世界_世界");
} else if (px >= 170 && px <= 230 && py >= 320 && py < 350) {
flags.worldcur = 10;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
flags.worldlist["0"]["单一群系"][0] = "蘑菇岛";
core.setFlag('title', "创建世界_世界");
} else if (px >= 240 && px <= 300 && py >= 80 && py < 110) {
flags.worldcur = 11;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var p = ["平原", "森林", "丛林", "针叶林", "雪原", "沙漠", "恶地", "海洋", "丘陵", "蘑菇岛"];
flags.worldlist["0"]["单一群系"][0] = p[core.rand2(p.length)];
core.setFlag('title', "创建世界_世界");
} else if (px >= 286 && px <= 467 && py >= 379 && py < 411) {
flags.worldcur = 8;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "创建世界_世界");
} else {
flags.worldcur = 0;
if (click == 0) return;
flags.worldDescribe = "";
}
}//确认删除框
function DelWorld(px, py, click) {
if (px >= 140 && px <= 230 && py >= 330 && py < 360) {
flags.worldcur = 1;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
var world = core.getLocalStorage('world');
if (core.saves.ids[world[(flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16]["世界存档"][0].toString()]) {
core.removeSave(world[(flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16]["世界存档"][0].toString());
core.removeSave(world[(flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16]["世界存档"][1].toString());
}
delete world[(flags.worldcur2 - 1) * 2 + 1 + (flags.worldpage - 1) * 16];
core.setLocalStorage('world', world);
flags.worldcur2 = 0;
core.setFlag('title', "选择世界");
} else if (px >= 320 && px <= 410 && py >= 330 && py < 360) {
flags.worldcur = 1;
if (click == 0) return;
flags.worldcur = 0;
core.playSound("取消");
core.setFlag('title', "选择世界");
} else {
flags.worldcur = 0;
}
}
//处理玩家的点击操作
this.performTitle = function (e) {
var px = parseInt(e.offsetX / core.domStyle.scale),
py = parseInt(e.offsetY / core.domStyle.scale);
//console.log(px, py);
switch (core.getFlag("title", 0)) {
case "开始界面":
flags.worldcur = 0;
StartInter(px, py, 1);
break;
case "选择世界":
flags.worldcur = 0;
ChooseInter(px, py, 1);
break;
case "教程":
flags.worldcur = 0;
GuideInter(px, py, 1);
break;
case "模组":
flags.worldcur = 0;
ModInter(px, py, 1);
break;
case "多人游戏":
flags.worldcur = 0;
MulInter(px, py, 1);
break;
case "创建世界_游戏":
flags.worldcur = 0;
Create_Game(px, py, 1);
break;
case "创建世界_世界":
flags.worldcur = 0;
Create_World(px, py, 1);
break;
case "创建世界_更多":
flags.worldcur = 0;
Create_More(px, py, 1);
break;
case "游戏规则":
flags.worldcur = 0;
GameRule(px, py, 1);
break;
case "自定义世界":
flags.worldcur = 0;
DIYworld(px, py, 1);
break;
case "单一群系":
flags.worldcur = 0;
SingleFormation(px, py, 1);
break;
case "确认删除框":
flags.worldcur = 0;
DelWorld(px, py, 1);
break;
}
}//处理玩家鼠标移动操作
this.performMove = function (px, py) {
//console.log(px, py);
switch (core.getFlag("title", 0)) {
case "开始界面":
StartInter(px, py, 0);
break;
case "选择世界":
ChooseInter(px, py, 0);
break;
case "教程":
GuideInter(px, py, 0);
break;
case "模组":
ModInter(px, py, 0);
break;
case "多人游戏":
flags.worldcur = 0;
MulInter(px, py, 0);
break;
case "创建世界_游戏":
Create_Game(px, py, 0);
break;
case "创建世界_世界":
Create_World(px, py, 0);
break;
case "创建世界_更多":
Create_More(px, py, 0);
break;
case "游戏规则":
GameRule(px, py, 0);
break;
case "自定义世界":
DIYworld(px, py, 0);
break;
case "单一群系":
SingleFormation(px, py, 0);
break;
case "确认删除框":
DelWorld(px, py, 0);
break;
}
}//处理玩家滚轮操作
this.performScroll = function (delta) {
//console.log(delta);
switch (core.getFlag("title", 0)) {
case "选择世界":
break;
}
}//默认全屏/横屏
this.triggerFulscreen = async function (full) {
if (!!document.fullscreenElement && !full) {
if (window.jsinterface) {
window.jsinterface.requestPortrait();
return;
}
await document.exitFullscreen();
}
if (full && !document.fullscreenElement) {
if (window.jsinterface) {
window.jsinterface.requestLandscape();
return;
}
await document.body.requestFullscreen();
}
}
this.performTitle_hardSelect = function (px, py) { //横屏下,难度分歧页面的点击处理
if (px >= 20 && px <= 100 && py >= 211 && py <= 253) core.plugin.selectHard(1);
if (px >= 73 && px <= 153 && py >= 270 && py <= 314) core.plugin.selectHard(2);
if (px >= 140 && px <= 222 && py >= 331 && py <= 374) core.plugin.selectHard(3); //这里的1、2、3就是你希望的flags.hard取几。强烈建议按照1、2、3……的顺序否则需要修改很多关联内容
//你可以设置更多的难度
}
////之后的部分请勿修改
////之后的部分请勿修改
////之后的部分请勿修改
this.title = function () { //主程序
//resize后数值初始化
var width = parseFloat(document.getElementById('statusBar').style.width.slice(0, -2));
if (document.getElementById("title")) { //重启游戏时
document.getElementById("title").style.display = "block";
core.setFlag("title", "开始界面");
core.plugin.drawTitle();
return;
}
//第一次打开页面时
var newCanvas = document.createElement("canvas");
newCanvas.id = "title";
newCanvas.style.display = 'block';
newCanvas.style.left = '0px';
newCanvas.style.top = '0px';
newCanvas.style.left = '0px';
newCanvas.style.top = '0px';
newCanvas.style.zIndex = 210;
newCanvas.style.position = 'absolute';
if (core.domStyle.isVertical) {
newCanvas.style.top = core.dom.gameDraw.style.top;
newCanvas.width = newCanvas.height = 422;
newCanvas.style.width = newCanvas.style.height = width + 'px';
core.maps._setHDCanvasSize(newCanvas.getContext('2d'), 422, 422);
} else {
newCanvas.width = 554;
newCanvas.height = 422;
newCanvas.style.width = '554px';
newCanvas.style.height = '422px';
core.maps._setHDCanvasSize(newCanvas.getContext('2d'), 554, 422);
}
newCanvas.onclick = function (e) { //点击-处理-重绘如此循环。和自绘ui一个原理
e.stopPropagation();
core.plugin.performTitle(e);
core.plugin.drawTitle();
}
function MouseMove(e) { //鼠标移动监听
var x = parseInt(e.offsetX / core.domStyle.scale);
var y = parseInt(e.offsetY / core.domStyle.scale);
core.plugin.performMove(x, y);
core.plugin.drawTitle();
}
// 添加监听器
newCanvas.addEventListener('mousemove', MouseMove);
newCanvas.onwheel = function (e) { //滚轮监听
e.stopPropagation();
// 获取滚轮的滚动量,这里假设我们关心的是垂直方向的滚动
var delta = e.deltaY || e.detail || e.wheelDelta;
// 根据滚轮的滚动量进行相应的处理
core.plugin.performScroll(delta * 1.5 / 100);
// 重绘标题或其他需要更新的元素
core.plugin.drawTitle();
};
core.dom.gameGroup.appendChild(newCanvas); //注册该画布
core.control.resize(); //调整分辨率
core.setFlag("title", "开始界面");
core.plugin.drawTitle();
}
this.selectHard = function (num) { //选中了某难度时num表示flags.hard应设为num
core.setFlag("hard", num);
core.status.hard = hard[num - 1];
core.setFlag('__hardColor__', hardColor[num - 1]);
core.status.route.push("hard:" + num);
//隐藏标题画布,继续后面的“开场剧情”
core.removeFlag("start");
document.getElementById("title").style.display = "none";
}
this.openSL = function () {
document.getElementById("title").style.display = "none";
core.insertAction([
{ "type": "callLoad" },
{ "type": "function", "function": "function(){ if (core.status.event.id === 'action') {document.getElementById('title').style.display = 'block'} }" }
]);
}
this.replayHardSelect = function (action, fromOpening) {
if (action.indexOf("hard:") < 0) return false;
if (!fromOpening) { //把难度选项移到了开场剧情中执行,实际回放时不执行以免录像重复
setTimeout(core.replay, core.control.__replay_getTimeout());
return true;
}
var num = parseInt(action.substr(5));
if (!Number.isInteger(num)) return false;
core.status.route.push(action);
core.setFlag("hard", num);
core.status.hard = hard[num - 1];
core.setFlag('__hardColor__', hardColor[num - 1]);
setTimeout(core.replay, core.control.__replay_getTimeout());
return true;
}
core.control._resize_canvas = function (obj) {
var innerSize = (obj.CANVAS_WIDTH * core.domStyle.scale) + "px";
for (var i = 0; i < core.dom.gameCanvas.length; ++i)
core.dom.gameCanvas[i].style.width = core.dom.gameCanvas[i].style.height = innerSize;
core.dom.gif.style.width = core.dom.gif.style.height = innerSize;
core.dom.gif2.style.width = core.dom.gif2.style.height = innerSize;
core.dom.gameDraw.style.width = core.dom.gameDraw.style.height = innerSize;
core.dom.gameDraw.style.top = obj.statusBarHeightInVertical + "px";
core.dom.gameDraw.style.right = 0;
core.dom.gameDraw.style.border = obj.border;
// resize bigmap
core.bigmap.canvas.forEach(function (cn) {
var ratio = core.canvas[cn].canvas.hasAttribute('isHD') ? core.domStyle.ratio : 1;
core.canvas[cn].canvas.style.width = core.canvas[cn].canvas.width / ratio * core.domStyle.scale + "px";
core.canvas[cn].canvas.style.height = core.canvas[cn].canvas.height / ratio * core.domStyle.scale + "px";
});
// resize dynamic canvas
for (var name in core.dymCanvas) {
var ctx = core.dymCanvas[name],
canvas = ctx.canvas;
var ratio = canvas.hasAttribute('isHD') ? core.domStyle.ratio : 1;
canvas.style.width = canvas.width / ratio * core.domStyle.scale + "px";
canvas.style.height = canvas.height / ratio * core.domStyle.scale + "px";
canvas.style.left = parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px";
canvas.style.top = parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px";
}
// resize next
main.dom.next.style.width = main.dom.next.style.height = 5 * core.domStyle.scale + "px";
main.dom.next.style.borderBottomWidth = main.dom.next.style.borderRightWidth = 4 * core.domStyle.scale + "px";
//resize title
var title = document.getElementById('title');
if (title) {
if (core.domStyle.isVertical) {
title.style.width = newCanvas.style.height = 422 * core.domStyle.scale + 'px';
} else {
title.style.width = 554 * core.domStyle.scale + 'px';
title.style.height = 422 * core.domStyle.scale + 'px';
}
}
}
core.control.registerResize("canvas", control.prototype._resize_canvas);
core.control.registerReplayAction("hard", core.plugin.replayHardSelect);
},
"19-地形生成": function () {
//创建大型世界
this.WorldGeneration = function () {
var formation1 = ["平原,森林", "平原,丘陵", "平原,丛林", "森林,丛林", "沙漠,恶地", "森林,雪原", "森林,针叶林", "针叶林,雪原", "针叶林,丘陵", "沙漠,丘陵", "平原,雪原", "平原,针叶林", "平原,沙漠", "平原,恶地", "森林,沙漠"];
var formation2 = ["平原,丘陵", "平原,丛林", "森林,丛林", "沙漠,恶地", "森林,雪原", "针叶林,雪原", "针叶林,丘陵", "沙漠,丘陵", "平原,恶地"];
var sea = ["海洋", "海底神殿", "海洋,丘陵", "海洋,蘑菇岛"];
var floor = ["zhu1", "zhu2", "zhu3", "zhu4", "zhu5", "zhu6", "zhu7", "zhu8", "zhu9", "zhu10", "zhu11", "zhu12", "zhu13", "zhu14", "zhu15", "zhu16", "zhu17", "zhu18", "zhu19", "zhu20", "zhu21", "zhu22", "zhu23", "zhu24", "zhu25",];
var searand = core.plugin.rand3(6);
switch (searand) {
case 0:
var r1 = core.plugin.rand3(4);
core.plugin.MapGeneration("zhu11", sea[r1]);
sea.splice(r1, 1);
r1 = core.plugin.rand3(3);
core.plugin.MapGeneration("zhu16", sea[r1]);
sea.splice(r1, 1);
r1 = core.plugin.rand3(2);
core.plugin.MapGeneration("zhu21", sea[r1]);
sea.splice(r1, 1);
core.plugin.MapGeneration("zhu22", sea[0]);
sea.splice(0, 1);
floor.splice(floor.indexOf("zhu11"), 1);
floor.splice(floor.indexOf("zhu16"), 1);
floor.splice(floor.indexOf("zhu21"), 1);
floor.splice(floor.indexOf("zhu22"), 1);
break;
case 1:
var r1 = core.plugin.rand3(4);
core.plugin.MapGeneration("zhu16", sea[r1]);
sea.splice(r1, 1);
r1 = core.plugin.rand3(3);
core.plugin.MapGeneration("zhu21", sea[r1]);
sea.splice(r1, 1);
r1 = core.plugin.rand3(2);
core.plugin.MapGeneration("zhu22", sea[r1]);
sea.splice(r1, 1);
core.plugin.MapGeneration("zhu23", sea[0]);
sea.splice(0, 1);
floor.splice(floor.indexOf("zhu16"), 1);
floor.splice(floor.indexOf("zhu21"), 1);
floor.splice(floor.indexOf("zhu22"), 1);
floor.splice(floor.indexOf("zhu23"), 1);
break;
case 2:
var r1 = core.plugin.rand3(4);
core.plugin.MapGeneration("zhu21", sea[r1]);
sea.splice(r1, 1);
r1 = core.plugin.rand3(3);
core.plugin.MapGeneration("zhu22", sea[r1]);
sea.splice(r1, 1);
r1 = core.plugin.rand3(2);
core.plugin.MapGeneration("zhu23", sea[r1]);
sea.splice(r1, 1);
core.plugin.MapGeneration("zhu24", sea[0]);
sea.splice(0, 1);
floor.splice(floor.indexOf("zhu21"), 1);
floor.splice(floor.indexOf("zhu22"), 1);
floor.splice(floor.indexOf("zhu23"), 1);
floor.splice(floor.indexOf("zhu24"), 1);
break;
case 3:
var r1 = core.plugin.rand3(4);
core.plugin.MapGeneration("zhu22", sea[r1]);
sea.splice(r1, 1);
r1 = core.plugin.rand3(3);
core.plugin.MapGeneration("zhu23", sea[r1]);
sea.splice(r1, 1);
r1 = core.plugin.rand3(2);
core.plugin.MapGeneration("zhu24", sea[r1]);
sea.splice(r1, 1);
core.plugin.MapGeneration("zhu25", sea[0]);
sea.splice(0, 1);
floor.splice(floor.indexOf("zhu22"), 1);
floor.splice(floor.indexOf("zhu23"), 1);
floor.splice(floor.indexOf("zhu24"), 1);
floor.splice(floor.indexOf("zhu25"), 1);
break;
case 4:
var r1 = core.plugin.rand3(4);
core.plugin.MapGeneration("zhu20", sea[r1]);
sea.splice(r1, 1);
r1 = core.plugin.rand3(3);
core.plugin.MapGeneration("zhu23", sea[r1]);
sea.splice(r1, 1);
r1 = core.plugin.rand3(2);
core.plugin.MapGeneration("zhu24", sea[r1]);
sea.splice(r1, 1);
core.plugin.MapGeneration("zhu25", sea[0]);
sea.splice(0, 1);
floor.splice(floor.indexOf("zhu20"), 1);
floor.splice(floor.indexOf("zhu23"), 1);
floor.splice(floor.indexOf("zhu24"), 1);
floor.splice(floor.indexOf("zhu25"), 1);
break;
case 5:
var r1 = core.plugin.rand3(4);
core.plugin.MapGeneration("zhu15", sea[r1]);
sea.splice(r1, 1);
r1 = core.plugin.rand3(3);
core.plugin.MapGeneration("zhu20", sea[r1]);
sea.splice(r1, 1);
r1 = core.plugin.rand3(2);
core.plugin.MapGeneration("zhu24", sea[r1]);
sea.splice(r1, 1);
core.plugin.MapGeneration("zhu25", sea[0]);
sea.splice(0, 1);
floor.splice(floor.indexOf("zhu15"), 1);
floor.splice(floor.indexOf("zhu20"), 1);
floor.splice(floor.indexOf("zhu24"), 1);
floor.splice(floor.indexOf("zhu25"), 1);
break;
}
for (var i = 0; i < 15; i++) {
rand1 = core.plugin.rand3(15 - i);
core.plugin.MapGeneration(floor[0], formation1[rand1]);
floor.splice(0, 1);
formation1.splice(rand1, 1);
}
for (var i = 0; i < 6; i++) {
rand1 = core.plugin.rand3(9 - i);
core.plugin.MapGeneration(floor[0], formation2[rand1]);
floor.splice(0, 1);
formation2.splice(rand1, 1);
}
core.plugin.smoothTerrain();
core.plugin.Cavedec();
core.plugin.GenerateBedrock(); // 基岩
core.plugin.CreateRate("正在进入世界...");
}//创建中型世界
this.WorldGeneration2 = function () {
var formation1 = ["类型1", "类型2", "类型3", "类型4", "类型5", "类型6", "类型7", "类型8", "类型9"];
var floor = ["zhu7", "zhu8", "zhu9", "zhu12", "zhu13", "zhu14", "zhu17", "zhu18", "zhu19"];
var rand1;
for (var i = 0; i < 9; i++) {
do {
rand1 = core.plugin.rand3(9 - i);
} while (floor[0] == "zhu13" && formation1[rand1] == "类型3");
//console.log(floor[0], formation1[rand1]);
core.plugin.MapGeneration(floor[0], formation1[rand1]);
floor.splice(0, 1);
formation1.splice(rand1, 1);
}
core.plugin.smoothTerrain();
core.plugin.Cavedec();
core.plugin.GenerateBedrock(); // 基岩
core.plugin.CreateRate("正在进入世界...");
} //根据地形组合创建地形
this.MapGeneration = function (floor, formation) {
var b1 = 305; // 浅草地
var b2 = 339; // 森林草地
var b3 = 340; // 丛林草地
var b4 = 341; // 针叶林草地
var b5 = 342; // 雪地
var b6 = 343; // 沙子
var b7 = 344; // 红沙
var b8 = 345; // 深水
var b9 = 346; // 石头
var b10 = 347; // 菌丝
var b11 = 348; // 浅水
var floor1 = "";
switch (floor) {
case "zhu7":
floor1 = "dong1";
break;
case "zhu8":
floor1 = "dong2";
break;
case "zhu9":
floor1 = "dong3";
break;
case "zhu12":
floor1 = "dong4";
break;
case "zhu13":
floor1 = "dong5";
break;
case "zhu14":
floor1 = "dong6";
break;
case "zhu17":
floor1 = "dong7";
break;
case "zhu18":
floor1 = "dong8";
break;
case "zhu19":
floor1 = "dong9";
break;
}
if (flags.worldlist["0"]["世界选项"][0] == "单一群系") {
var q = flags.worldlist["0"]["单一群系"][0];
switch (q) {
case "平原":
core.plugin.GenerateTerrain(20, b1, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, q);
break;
case "森林":
core.plugin.GenerateTerrain(20, b2, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, q);
break;
case "丛林":
core.plugin.GenerateTerrain(20, b3, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, q);
break;
case "针叶林":
core.plugin.GenerateTerrain(20, b4, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, q);
break;
case "雪原":
core.plugin.GenerateTerrain(20, b5, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, q);
break;
case "沙漠":
core.plugin.GenerateTerrain(20, b6, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, q);
break;
case "恶地":
core.plugin.GenerateTerrain(20, b7, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, q);
break;
case "海洋":
core.plugin.GenerateTerrain(20, b8, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, q);
break;
case "丘陵":
core.plugin.GenerateTerrain(20, b9, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, q);
break;
case "蘑菇岛":
core.plugin.GenerateTerrain(20, b10, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, q);
break;
}
return;
}
if (flags.worldlist["0"]["世界选项"][3] == "小" || flags.worldlist["0"]["世界选项"][3] == "中") {
if (formation == "类型1") {
core.plugin.GenerateTerrain(10, b5, floor);
core.plugin.GenerateTerrain(10, b4, floor);
core.plugin.GenerateTerrain(10, b9, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "雪原");
core.plugin.GenerateResourceGroup(floor, "针叶林");
core.plugin.GenerateResourceGroup(floor, "丘陵");
} else if (formation == "类型2") {
core.plugin.GenerateTerrain(10, b8, floor);
core.plugin.GenerateTerrain(10, b9, floor);
core.plugin.GenerateTerrain(10, b10, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "海洋");
core.plugin.GenerateResourceGroup(floor, "蘑菇岛");
core.plugin.GenerateResourceGroup(floor, "丘陵");
} else if (formation == "类型3") {
core.plugin.GenerateTerrain(20, b8, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "海洋");
core.plugin.GenerateResourceGroup(floor, "海底神殿");
} else if (formation == "类型4") {
core.plugin.GenerateTerrain(10, b1, floor);
core.plugin.GenerateTerrain(10, b4, floor);
core.plugin.GenerateTerrain(10, b5, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "平原");
core.plugin.GenerateResourceGroup(floor, "雪原");
core.plugin.GenerateResourceGroup(floor, "针叶林");
} else if (formation == "类型5") {
core.plugin.GenerateTerrain(10, b2, floor);
core.plugin.GenerateTerrain(10, b3, floor);
core.plugin.GenerateTerrain(10, b3, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "森林");
core.plugin.GenerateResourceGroup(floor, "丛林");
core.plugin.GenerateResourceGroup(floor, "丛林");
} else if (formation == "类型6") {
core.plugin.GenerateTerrain(10, b2, floor);
core.plugin.GenerateTerrain(10, b6, floor);
core.plugin.GenerateTerrain(10, b7, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "沙漠");
core.plugin.GenerateResourceGroup(floor, "恶地");
core.plugin.GenerateResourceGroup(floor, "森林");
} else if (formation == "类型7") {
core.plugin.GenerateTerrain(10, b1, floor);
core.plugin.GenerateTerrain(10, b2, floor);
core.plugin.GenerateTerrain(10, b4, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "平原");
core.plugin.GenerateResourceGroup(floor, "森林");
core.plugin.GenerateResourceGroup(floor, "针叶林");
} else if (formation == "类型8") {
core.plugin.GenerateTerrain(10, b1, floor);
core.plugin.GenerateTerrain(10, b3, floor);
core.plugin.GenerateTerrain(10, b6, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "平原");
core.plugin.GenerateResourceGroup(floor, "沙漠");
core.plugin.GenerateResourceGroup(floor, "丛林");
} else if (formation == "类型9") {
core.plugin.GenerateTerrain(10, b6, floor);
core.plugin.GenerateTerrain(10, b7, floor);
core.plugin.GenerateTerrain(10, b9, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "沙漠");
core.plugin.GenerateResourceGroup(floor, "恶地");
core.plugin.GenerateResourceGroup(floor, "丘陵");
}
} else if (flags.worldlist["0"]["世界选项"][3] == "大") {
if (formation == "平原,森林") {
core.plugin.GenerateTerrain(10, b1, floor);
core.plugin.GenerateTerrain(10, b2, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "平原");
core.plugin.GenerateResourceGroup(floor, "森林");
} else if (formation == "平原,丘陵") {
core.plugin.GenerateTerrain(10, b1, floor);
core.plugin.GenerateTerrain(2, b9, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "平原");
core.plugin.GenerateResourceGroup(floor, "丘陵");
} else if (formation == "平原,丛林") {
core.plugin.GenerateTerrain(10, b1, floor);
core.plugin.GenerateTerrain(10, b3, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "平原");
core.plugin.GenerateResourceGroup(floor, "丛林");
} else if (formation == "森林,丛林") {
core.plugin.GenerateTerrain(10, b2, floor);
core.plugin.GenerateTerrain(10, b3, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "森林");
core.plugin.GenerateResourceGroup(floor, "丛林");
} else if (formation == "沙漠,恶地") {
core.plugin.GenerateTerrain(10, b6, floor);
core.plugin.GenerateTerrain(10, b7, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "沙漠");
core.plugin.GenerateResourceGroup(floor, "恶地");
} else if (formation == "森林,雪原") {
core.plugin.GenerateTerrain(2, b2, floor);
core.plugin.GenerateTerrain(10, b5, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "森林");
core.plugin.GenerateResourceGroup(floor, "雪原");
} else if (formation == "海洋") {
core.plugin.GenerateTerrain(20, b8, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "海洋");
} else if (formation == "海底神殿") {
core.plugin.GenerateTerrain(20, b8, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "海洋");
core.plugin.GenerateResourceGroup(floor, "海底神殿");
} else if (formation == "海洋,蘑菇岛") {
core.plugin.GenerateTerrain(10, b8, floor);
core.plugin.GenerateTerrain(2, b10, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "海洋");
core.plugin.GenerateResourceGroup(floor, "蘑菇岛");
} else if (formation == "森林,针叶林") {
core.plugin.GenerateTerrain(10, b2, floor);
core.plugin.GenerateTerrain(10, b4, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "森林");
core.plugin.GenerateResourceGroup(floor, "针叶林");
} else if (formation == "针叶林,雪原") {
core.plugin.GenerateTerrain(10, b4, floor);
core.plugin.GenerateTerrain(10, b5, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "针叶林");
core.plugin.GenerateResourceGroup(floor, "雪原");
} else if (formation == "针叶林,丘陵") {
core.plugin.GenerateTerrain(10, b4, floor);
core.plugin.GenerateTerrain(5, b9, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "针叶林");
core.plugin.GenerateResourceGroup(floor, "丘陵");
} else if (formation == "沙漠,丘陵") {
core.plugin.GenerateTerrain(2, b6, floor);
core.plugin.GenerateTerrain(10, b9, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "沙漠");
core.plugin.GenerateResourceGroup(floor, "丘陵");
} else if (formation == "平原,雪原") {
core.plugin.GenerateTerrain(10, b1, floor);
core.plugin.GenerateTerrain(10, b5, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "平原");
core.plugin.GenerateResourceGroup(floor, "雪原");
} else if (formation == "平原,针叶林") {
core.plugin.GenerateTerrain(10, b1, floor);
core.plugin.GenerateTerrain(10, b4, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "平原");
core.plugin.GenerateResourceGroup(floor, "针叶林");
} else if (formation == "平原,沙漠") {
core.plugin.GenerateTerrain(2, b1, floor);
core.plugin.GenerateTerrain(10, b6, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "平原");
core.plugin.GenerateResourceGroup(floor, "沙漠");
} else if (formation == "平原,恶地") {
core.plugin.GenerateTerrain(1, b1, floor);
core.plugin.GenerateTerrain(10, b7, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "平原");
core.plugin.GenerateResourceGroup(floor, "恶地");
} else if (formation == "森林,沙漠") {
core.plugin.GenerateTerrain(2, b2, floor);
core.plugin.GenerateTerrain(10, b6, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "森林");
core.plugin.GenerateResourceGroup(floor, "沙漠");
} else if (formation == "海洋,丘陵") {
core.plugin.GenerateTerrain(10, b8, floor);
core.plugin.GenerateTerrain(2, b9, floor);
core.plugin.ArrangeTerrain(floor);
if (floor1) core.plugin.ArrangeTerrain(floor1);
core.plugin.GenerateResourceGroup(floor, "海洋");
core.plugin.GenerateResourceGroup(floor, "丘陵");
}
}
} //生成地形
this.GenerateTerrain = function (bDense, bg, floor) {
core.plugin.CreateRate("正在生成地形");
//生成地形
var n1 = 0;
var box = 0;
var floor1 = "";
var bg1;
switch (floor) {
case "zhu7":
floor1 = "dong1";
break;
case "zhu8":
floor1 = "dong2";
break;
case "zhu9":
floor1 = "dong3";
break;
case "zhu12":
floor1 = "dong4";
break;
case "zhu13":
floor1 = "dong5";
break;
case "zhu14":
floor1 = "dong6";
break;
case "zhu17":
floor1 = "dong7";
break;
case "zhu18":
floor1 = "dong8";
break;
case "zhu19":
floor1 = "dong9";
break;
}
switch (bg) {
case 346:
case 347:
case 305:
var rand1 = core.plugin.rand3(125);
if (rand1 < 20) {
bg1 = 305;
} else if (rand1 < 40) {
bg1 = 339;
} else {
bg1 = 340;
}
break;
case 339:
case 340:
case 341:
var rand1 = core.plugin.rand3(140);
if (rand1 < 50) {
bg1 = 341; //繁茂
} else if (rand1 < 60) {
bg1 = 305; //深层
} else if (rand1 < 70) {
bg1 = 339; //水晶
} else {
bg1 = 340; //普通
}
break;
case 342:
case 345:
var rand1 = core.plugin.rand3(205);
if (rand1 < 100) {
bg1 = 305;
} else if (rand1 < 120) {
bg1 = 339;
} else {
bg1 = 340;
}
break;
case 343:
bg1 = 343;
break;
case 344:
bg1 = 344;
break;
}
do {
//1、随机点的寻找
var r1 = core.plugin.rand3(63);
var r2 = core.plugin.rand3(63);
if (core.getBgNumber(r1, r2, floor) == 300 || core.getBgNumber(r1, r2, floor) == 0 || core.getBgNumber(r1, r2, floor) == bg) {
core.setBgFgBlock('bg', bg, r1, r2, floor);
flags.bglist[floor][r2][r1] = bg;
if (floor1) {
core.setBgFgBlock('bg', bg1, r1, r2, floor1);
flags.bglist[floor1][r2][r1] = bg;
}
n1 += 1;
if (bg == 347 && box == 0) {
core.setBlock(420, r1, r2, floor);
flags.maplist[floor][r2][r1] = 420;
core.plugin.Chestloot("蘑菇宝箱", (r1 * 1000 + r2).toString().padStart(6, '0') + floor, 30);
box = 1;
}
//2、随机半径
var r3 = core.plugin.rand3(4) + 7;
var r4 = core.plugin.rand3(4) + 7;
//3、内部填充+边缘不规则
for (var i = 0; i <= r3; i++) {
for (var j = 0; j <= r4; j++) {
if (i == r3 || j == r4) {
if (r1 + i >= 63 || r2 + j >= 63 || r1 + i < 0 || r2 + j < 0) { } else if (core.plugin.rand3(2) == 1 && (core.getBgNumber(r1 + i, r2 + j, floor) == 300 || core.getBgNumber(r1 + i, r2 + j, floor) == 0)) {
core.setBgFgBlock('bg', bg, r1 + i, r2 + j, floor);
flags.bglist[floor][r2 + j][r1 + i] = bg;
if (floor1) {
core.setBgFgBlock('bg', bg1, r1 + i, r2 + j, floor1);
flags.bglist[floor1][r2 + j][r1 + i] = bg;
}
}
if (r1 + i >= 63 || r2 - j >= 63 || r1 + i < 0 || r2 - j < 0) { } else if (core.plugin.rand3(2) == 1 && (core.getBgNumber(r1 + i, r2 - j, floor) == 300 || core.getBgNumber(r1 + i, r2 - j, floor) == 0)) {
core.setBgFgBlock('bg', bg, r1 + i, r2 - j, floor);
flags.bglist[floor][r2 - j][r1 + i] = bg;
if (floor1) {
core.setBgFgBlock('bg', bg1, r1 + i, r2 - j, floor1);
flags.bglist[floor1][r2 - j][r1 + i] = bg;
}
}
if (r1 - i >= 63 || r2 + j >= 63 || r1 - i < 0 || r2 + j < 0) { } else if (core.plugin.rand3(2) == 1 && (core.getBgNumber(r1 - i, r2 + j, floor) == 300 || core.getBgNumber(r1 - i, r2 + j, floor) == 0)) {
core.setBgFgBlock('bg', bg, r1 - i, r2 + j, floor);
flags.bglist[floor][r2 + j][r1 - i] = bg;
if (floor1) {
core.setBgFgBlock('bg', bg1, r1 - i, r2 + j, floor1);
flags.bglist[floor1][r2 + j][r1 - i] = bg;
}
}
if (r1 - i >= 63 || r2 - j >= 63 || r1 - i < 0 || r2 - j < 0) { } else if (core.plugin.rand3(2) == 1 && (core.getBgNumber(r1 - i, r2 - j, floor) == 300 || core.getBgNumber(r1 - i, r2 - j, floor) == 0)) {
core.setBgFgBlock('bg', bg, r1 - i, r2 - j, floor);
flags.bglist[floor][r2 - j][r1 - i] = bg;
if (floor1) {
core.setBgFgBlock('bg', bg1, r1 - i, r2 - j, floor1);
flags.bglist[floor1][r2 - j][r1 - i] = bg;
}
}
} else {
if (r1 + i >= 63 || r2 + j >= 63 || r1 + i < 0 || r2 + j < 0) { } else if (core.getBgNumber(r1 + i, r2 + j, floor) == 300 || core.getBgNumber(r1 + i, r2 + j, floor) == 0) {
core.setBgFgBlock('bg', bg, r1 + i, r2 + j, floor);
flags.bglist[floor][r2 + j][r1 + i] = bg;
if (floor1) {
core.setBgFgBlock('bg', bg1, r1 + i, r2 + j, floor1);
flags.bglist[floor1][r2 + j][r1 + i] = bg;
}
}
if (r1 + i >= 63 || r2 - j >= 63 || r1 + i < 0 || r2 - j < 0) { } else if (core.getBgNumber(r1 + i, r2 - j, floor) == 300 || core.getBgNumber(r1 + i, r2 - j, floor) == 0) {
core.setBgFgBlock('bg', bg, r1 + i, r2 - j, floor);
flags.bglist[floor][r2 - j][r1 + i] = bg;
if (floor1) {
core.setBgFgBlock('bg', bg1, r1 + i, r2 - j, floor1);
flags.bglist[floor1][r2 - j][r1 + i] = bg;
}
}
if (r1 - i >= 63 || r2 + j >= 63 || r1 - i < 0 || r2 + j < 0) { } else if (core.getBgNumber(r1 - i, r2 + j, floor) == 300 || core.getBgNumber(r1 - i, r2 + j, floor) == 0) {
core.setBgFgBlock('bg', bg, r1 - i, r2 + j, floor);
flags.bglist[floor][r2 + j][r1 - i] = bg;
if (floor1) {
core.setBgFgBlock('bg', bg1, r1 - i, r2 + j, floor1);
flags.bglist[floor1][r2 + j][r1 - i] = bg;
}
}
if (r1 - i >= 63 || r2 - j >= 63 || r1 - i < 0 || r2 - j < 0) { } else if (core.getBgNumber(r1 - i, r2 - j, floor) == 300 || core.getBgNumber(r1 - i, r2 - j, floor) == 0) {
core.setBgFgBlock('bg', bg, r1 - i, r2 - j, floor);
flags.bglist[floor][r2 - j][r1 - i] = bg;
if (floor1) {
core.setBgFgBlock('bg', bg1, r1 - i, r2 - j, floor1);
flags.bglist[floor1][r2 - j][r1 - i] = bg;
}
}
}
}
}
}
} while (n1 < bDense);
} //平整地形
this.ArrangeTerrain = function (floor) {
//平整地形
var n1 = 0;
do {
for (var i = 0; i < 63; i++) {
for (var j = 0; j < 63; j++) {
if (core.getBgNumber(i, j, floor) == 300 || core.getBgNumber(i, j, floor) == 0) {
if (i - 1 >= 0 && core.getBgNumber(i - 1, j, floor) != 300 && core.getBgNumber(i - 1, j, floor) != 0) {
core.setBgFgBlock('bg', core.getBgNumber(i - 1, j, floor), i, j, floor);
flags.bglist[floor][j][i] = core.getBgNumber(i - 1, j, floor);
} else if (j + 1 < 63 && core.getBgNumber(i, j + 1, floor) != 300 && core.getBgNumber(i, j + 1, floor) != 0) {
core.setBgFgBlock('bg', core.getBgNumber(i, j + 1, floor), i, j, floor);
flags.bglist[floor][j][i] = core.getBgNumber(i, j + 1, floor);
} else if (i + 1 < 63 && core.getBgNumber(i + 1, j, floor) != 300 && core.getBgNumber(i + 1, j, floor) != 0) {
core.setBgFgBlock('bg', core.getBgNumber(i + 1, j, floor), i, j, floor);
flags.bglist[floor][j][i] = core.getBgNumber(i + 1, j, floor);
} else if (j - 1 >= 0 && core.getBgNumber(i, j - 1, floor) != 300 && core.getBgNumber(i, j - 1, floor) != 0) {
core.setBgFgBlock('bg', core.getBgNumber(i, j - 1, floor), i, j, floor);
flags.bglist[floor][j][i] = core.getBgNumber(i, j - 1, floor);
}
}
}
}
n1 += 1;
} while (n1 < 128);
} //平滑过渡地形
this.smoothTerrain = function () {
core.plugin.CreateRate("正在平滑过渡地形");
// if (flags.worldlist["0"]["世界选项"][3] == "小" || flags.worldlist["0"]["世界选项"][3] == "中") {
// } else if (flags.worldlist["0"]["世界选项"][3] == "大") {
// }
var floor;
var floornum;
if (flags.worldlist["0"]["世界选项"][3] == "小" || flags.worldlist["0"]["世界选项"][3] == "中") {
floornum = 9;
floor = ["zhu7", "zhu8", "zhu9", "zhu12", "zhu13", "zhu14", "zhu17", "zhu18", "zhu19"];
} else if (flags.worldlist["0"]["世界选项"][3] == "大") {
floornum = 25;
floor = ["zhu1", "zhu2", "zhu3", "zhu4", "zhu5", "zhu6", "zhu7", "zhu8", "zhu9", "zhu10", "zhu11", "zhu12", "zhu13", "zhu14", "zhu15", "zhu16", "zhu17", "zhu18", "zhu19", "zhu20", "zhu21", "zhu22", "zhu23", "zhu24", "zhu25",];
}
var floor2 = [];
var floors;
for (var i = 0; i < floornum; i++) {
var rand1 = core.plugin.rand3(floornum - i);
floors = core.plugin.Floors(floor[rand1]);
for (var j = 0; j < 4; j++) {
if (floors[j] != "" && floor2.indexOf(floors[j]) == -1) {
var x, y, x1, y1;
switch (j) {
case 0:
x = 57;
y = 31;
x1 = 0;
y1 = 31;
break;
case 1:
x = 31;
y = 5;
x1 = 31;
y1 = 62;
break;
case 2:
x = 5;
y = 31;
x1 = 62;
y1 = 31;
break;
case 3:
x = 31;
y = 57;
x1 = 31;
y1 = 0;
break;
}
var bg1 = core.getBgNumber(x, y, floors[j]);
var bg2;
var r1 = core.plugin.rand3(4) + 2;
var r2 = 30, r3 = 30;
if (bg1 == 305 || bg1 == 339 || bg1 == 340 || bg1 == 341 || bg1 == 346) {
bg2 = bg1;
} else if (bg1 == 342) {
bg2 = 341;
} else if (bg1 == 343 || bg1 == 344) {
bg2 = 305;
} else if (bg1 == 345 || bg1 == 347 || bg1 == 348) {
bg2 = 343;
} else {
continue;
}
for (var r = 0; r < r1; r++) {
var x2, y2, n = 1;
function randrange(r2, n) {
var x3, y3;
for (var rr = 1; rr < r2; rr++) {
if (n == 1) {
x3 = x2 + rr;
y3 = y2;
} else if (n == 2) {
x3 = x2 - rr;
y3 = y2;
} else if (n == 3) {
x3 = x2;
y3 = y2 + rr;
} else if (n == 4) {
x3 = x2;
y3 = y2 - rr;
}
core.setBgFgBlock('bg', bg2, x3, y3, floor[rand1]);
flags.bglist[floor[rand1]][y3][x3] = bg2;
if (core.getBlockNumber(x3, y3, floor[rand1]) != 91 &&
core.getBlockNumber(x3, y3, floor[rand1]) != 92 &&
core.getBlockNumber(x3, y3, floor[rand1]) != 93 &&
core.getBlockNumber(x3, y3, floor[rand1]) != 94 &&
core.getBlockNumber(x3, y3, floor[rand1]) != 302) {
core.setBlock(0, x3, y3, floor[rand1]);
flags.maplist[floor[rand1]][y3][x3] = 0;
}
}
}
if (y1 == 0) {
x2 = x1;
y2 = y1 + r;
n = 1;
} else if (y1 == 62) {
x2 = x1;
y2 = y1 - r;
n = 1;
} else if (x1 == 0) {
x2 = x1 + r;
y2 = y1;
n = 3;
} else if (x1 == 62) {
x2 = x1 - r;
y2 = y1;
n = 3;
}
core.setBgFgBlock('bg', bg2, x2, y2, floor[rand1]);
flags.bglist[floor[rand1]][y2][x2] = bg2;
if (core.getBlockNumber(x2, y2, floor[rand1]) != 91 &&
core.getBlockNumber(x2, y2, floor[rand1]) != 92 &&
core.getBlockNumber(x2, y2, floor[rand1]) != 93 &&
core.getBlockNumber(x2, y2, floor[rand1]) != 94 &&
core.getBlockNumber(x2, y2, floor[rand1]) != 302) {
core.setBlock(0, x2, y2, floor[rand1]);
flags.maplist[floor[rand1]][y2][x2] = 0;
}
var r4 = core.plugin.rand3(r2) + 2;
randrange(r4, n);
var r5 = core.plugin.rand3(r3) + 2;
randrange(r5, n + 1);
r2 = r4;
r3 = r5;
if (r != 0 && r2 < r * 2 + 4 && r3 < r * 2 + 4 && r2 + r3 < 12) break;
}
}
}
floor2.splice(0, 0, floor[rand1]);
floor.splice(rand1, 1);
}
} //返回周围楼层
this.Floors = function (floor) {
switch (floor) {
case "zhu1":
return ["", "zhu6", "zhu2", ""];
case "zhu2":
return ["zhu1", "zhu7", "zhu3", ""];
case "zhu3":
return ["zhu2", "zhu8", "zhu4", ""];
case "zhu4":
return ["zhu3", "zhu9", "zhu5", ""];
case "zhu5":
return ["zhu4", "zhu10", "", ""];
case "zhu6":
return ["", "zhu11", "zhu7", "zhu1"];
case "zhu7":
if (flags.worldlist["0"]["世界选项"][3] == "小" || flags.worldlist["0"]["世界选项"][3] == "中") {
return ["", "zhu12", "zhu8", ""];
} else if (flags.worldlist["0"]["世界选项"][3] == "大") {
return ["zhu6", "zhu12", "zhu8", "zhu2"];
}
case "zhu8":
if (flags.worldlist["0"]["世界选项"][3] == "小" || flags.worldlist["0"]["世界选项"][3] == "中") {
return ["zhu7", "zhu13", "zhu9", ""];
} else if (flags.worldlist["0"]["世界选项"][3] == "大") {
return ["zhu7", "zhu13", "zhu9", "zhu3"];
}
case "zhu9":
if (flags.worldlist["0"]["世界选项"][3] == "小" || flags.worldlist["0"]["世界选项"][3] == "中") {
return ["zhu8", "zhu14", "", ""];
} else if (flags.worldlist["0"]["世界选项"][3] == "大") {
return ["zhu8", "zhu14", "zhu10", "zhu4"];
}
case "zhu10":
return ["zhu9", "zhu15", "", "zhu5"];
case "zhu11":
return ["", "zhu16", "zhu12", "zhu6"];
case "zhu12":
if (flags.worldlist["0"]["世界选项"][3] == "小" || flags.worldlist["0"]["世界选项"][3] == "中") {
return ["", "zhu17", "zhu13", "zhu7"];
} else if (flags.worldlist["0"]["世界选项"][3] == "大") {
return ["zhu11", "zhu17", "zhu13", "zhu7"];
}
case "zhu13":
if (flags.worldlist["0"]["世界选项"][3] == "小" || flags.worldlist["0"]["世界选项"][3] == "中") {
return ["zhu12", "zhu18", "zhu14", "zhu8"];
} else if (flags.worldlist["0"]["世界选项"][3] == "大") {
return ["zhu12", "zhu18", "zhu14", "zhu8"];
}
case "zhu14":
if (flags.worldlist["0"]["世界选项"][3] == "小" || flags.worldlist["0"]["世界选项"][3] == "中") {
return ["zhu13", "zhu19", "", "zhu9"];
} else if (flags.worldlist["0"]["世界选项"][3] == "大") {
return ["zhu13", "zhu19", "zhu15", "zhu9"];
}
case "zhu15":
return ["zhu14", "zhu20", "", "zhu10"];
case "zhu16":
return ["", "zhu21", "zhu17", "zhu11"];
case "zhu17":
if (flags.worldlist["0"]["世界选项"][3] == "小" || flags.worldlist["0"]["世界选项"][3] == "中") {
return ["", "", "zhu18", "zhu12"];
} else if (flags.worldlist["0"]["世界选项"][3] == "大") {
return ["zhu16", "zhu22", "zhu18", "zhu12"];
}
case "zhu18":
if (flags.worldlist["0"]["世界选项"][3] == "小" || flags.worldlist["0"]["世界选项"][3] == "中") {
return ["zhu17", "", "zhu19", "zhu13"];
} else if (flags.worldlist["0"]["世界选项"][3] == "大") {
return ["zhu17", "zhu23", "zhu19", "zhu13"];
}
case "zhu19":
if (flags.worldlist["0"]["世界选项"][3] == "小" || flags.worldlist["0"]["世界选项"][3] == "中") {
return ["zhu18", "", "", "zhu14"];
} else if (flags.worldlist["0"]["世界选项"][3] == "大") {
return ["zhu18", "zhu24", "zhu20", "zhu14"];
}
case "zhu20":
return ["zhu19", "zhu25", "", "zhu15"];
case "zhu21":
return ["", "", "zhu22", "zhu16"];
case "zhu22":
return ["zhu21", "", "zhu23", "zhu17"];
case "zhu23":
return ["zhu22", "", "zhu24", "zhu18"];
case "zhu24":
return ["zhu23", "", "zhu25", "zhu19"];
case "zhu25":
return ["zhu24", "", "", "zhu20"];
}
} //洞穴层布置
this.Cavedec = function () {
var floors = ["dong1", "dong2", "dong3", "dong4", "dong5", "dong6", "dong7", "dong8", "dong9",];
for (var id = 0; id < floors.length; id++) {
var floor = floors[id];
for (var i = 1; i < 62; i++) {
for (var j = 1; j < 62; j++) {
var block;
var type = "普通洞穴";
switch (core.getBgNumber(i, j, floor)) {
case 341: //繁茂
type = "繁茂洞穴";
break;
case 305: //深层
type = "深层洞穴";
break;
case 339: //水晶
type = "水晶洞穴";
break;
case 340: //普通
type = "普通洞穴";
break;
case 343: //砂岩
type = "砂岩洞穴";
break;
case 344: //陶瓦
type = "陶瓦洞穴";
break;
}
block = core.plugin.Caveblock(type, 1);
core.setBgFgBlock('bg', block, i, j, floor);
block = core.plugin.Caveblock(type, 2);
core.setBlock(block, i, j, floor);
}
}
}
} //根据区块生成资源组
this.GenerateResourceGroup = function (floor, formation) {
var b1 = 305; // 浅草地
var b2 = 339; // 森林草地
var b3 = 340; // 丛林草地
var b4 = 341; // 针叶林草地
var b5 = 342; // 雪地
var b6 = 343; // 沙子
var b7 = 344; // 红沙
var b8 = 345; // 深水
var b9 = 346; // 石头
var b10 = 347; // 菌丝
var b11 = 348; // 浅水
var r1 = 350; // 橡树
var r2 = 351; // 白桦树
var r3 = 352; // 云杉树
var r4 = 353; // 丛林树
var r5 = 354; // 金合欢树
var r6 = 372; // 小草丛
var r7 = 373; // 大草丛
var r8 = 374; // 向日葵
var r9 = 375; // 玫瑰
var r10 = 377; // 蜂巢
var r11 = 379; // 南瓜
var r12 = 381; // 西瓜
var r13 = 383; // 竹子
var r14 = 386; // 枯萎灌木
var r15 = 387; // 仙人掌
var r16 = 388; // 仙人掌花
var r17 = 393; // 海草
var r18 = 394; // 海带
var r19 = 395; // 红珊瑚
var r20 = 396; // 黄珊瑚
var r21 = 397; // 蓝珊瑚
var r22 = 398; // 粉珊瑚
var r23 = 399; // 红珊瑚块
var r24 = 400; // 黄珊瑚块
var r25 = 401; // 蓝珊瑚块
var r26 = 402; // 粉珊瑚块
var r27 = 916; // 圆石
var r28 = 403; // 煤矿
var r29 = 404; // 铁矿
var r30 = 405; // 铜矿
var r31 = 389; // 红色蘑菇
var r32 = 390; // 棕色蘑菇
var r33 = 349; // 沙砾
var weight = 1;
if (flags.worldlist["0"]["世界选项"][3] == "小" || flags.worldlist["0"]["世界选项"][3] == "中") {
weight = 1.5;
} else if (flags.worldlist["0"]["世界选项"][3] == "大") {
weight = 1;
}
if (formation == "平原") {
var tile = flags.worldlist["0"]["地形"]["平原"][0];
core.plugin.GenerateResource(floor, b1, 50 / tile, r6); // 小草丛
core.plugin.GenerateResource(floor, b1, 50 / tile, r7); // 大草丛
core.plugin.GenerateResource(floor, b1, 50 / tile, r9); // 玫瑰
core.plugin.GenerateResource(floor, b1, 60 / tile, r8); // 向日葵
core.plugin.GenerateResource(floor, b1, 100 / tile, r1); // 橡树
core.plugin.GenerateResource(floor, b1, 60 / tile, r5); // 金合欢树
core.plugin.GenerateResource(floor, b1, 100 / tile, r11); // 南瓜
core.plugin.GenerateResource(floor, b1, 500 / tile, r10); // 蜂巢
core.plugin.GenerateStructure(floor, b1, weight * 3000 / flags.worldlist["0"]["结构"]["岩浆池"][0], "岩浆池");
core.plugin.GenerateStructure(floor, b1, weight * 6000 / flags.worldlist["0"]["结构"]["废弃传送门"][0], "废弃传送门");
core.plugin.GenerateStructure(floor, b1, weight * 8000 / flags.worldlist["0"]["结构"]["前哨站"][0], "前哨站");
core.plugin.GenerateStructure(floor, b1, weight * 3000 / flags.worldlist["0"]["结构"]["村庄"][0], "村庄");
} else if (formation == "森林") {
var tile = flags.worldlist["0"]["地形"]["森林"][0];
core.plugin.GenerateResource(floor, b2, 10 / tile, r6); // 小草丛
core.plugin.GenerateResource(floor, b2, 10 / tile, r7); // 大草丛
core.plugin.GenerateResource(floor, b2, 10 / tile, r1); // 橡树
core.plugin.GenerateResource(floor, b2, 10 / tile, r2); // 白桦树
core.plugin.GenerateResource(floor, b2, 30 / tile, r11); // 南瓜
core.plugin.GenerateResource(floor, b2, 50 / tile, r9); // 玫瑰
core.plugin.GenerateResource(floor, b2, 200 / tile, r10); // 蜂巢
core.plugin.GenerateStructure(floor, b2, weight * 1500 / flags.worldlist["0"]["结构"]["废墟"][0], "废墟");
} else if (formation == "丛林") {
var tile = flags.worldlist["0"]["地形"]["丛林"][0];
core.plugin.GenerateResource(floor, b3, 100 / tile, r11); // 南瓜
core.plugin.GenerateResource(floor, b3, 50 / tile, r12); // 西瓜
core.plugin.GenerateResource(floor, b3, 7 / tile, r13); // 竹子
core.plugin.GenerateResource(floor, b3, 7 / tile, r4); // 丛林树
core.plugin.GenerateStructure(floor, b3, weight * 1500 / flags.worldlist["0"]["结构"]["废墟"][0], "废墟");
core.plugin.GenerateStructure(floor, b3, weight * 3500 / flags.worldlist["0"]["结构"]["丛林神庙"][0], "丛林神庙");
} else if (formation == "针叶林") {
var tile = flags.worldlist["0"]["地形"]["针叶林"][0];
core.plugin.GenerateResource(floor, b4, 8 / tile, r3); // 云杉树
core.plugin.GenerateResource(floor, b4, 50 / tile, r11); // 南瓜
core.plugin.GenerateStructure(floor, b4, weight * 3000 / flags.worldlist["0"]["结构"]["村庄"][0], "村庄");
} else if (formation == "雪原") {
var tile = flags.worldlist["0"]["地形"]["雪原"][0];
core.plugin.GenerateResource(floor, b5, 20 / tile, r3); // 云杉树
core.plugin.GenerateStructure(floor, b5, weight * 3000 / flags.worldlist["0"]["结构"]["雪屋"][0], "雪屋");
core.plugin.GenerateStructure(floor, b5, weight * 3000 / flags.worldlist["0"]["结构"]["前哨站"][0], "前哨站");
} else if (formation == "沙漠") {
var tile = flags.worldlist["0"]["地形"]["沙漠"][0];
core.plugin.GenerateResource(floor, b6, 30 / tile, r14); // 枯萎灌木
core.plugin.GenerateResource(floor, b6, 40 / tile, r15); // 仙人掌
core.plugin.GenerateResource(floor, b6, 5000, r16); // 仙人掌花
core.plugin.GenerateStructure(floor, b6, 800 / flags.worldlist["0"]["结构"]["水井"][0], "水井");
core.plugin.GenerateStructure(floor, b6, weight * 2500 / flags.worldlist["0"]["结构"]["村庄"][0], "村庄");
core.plugin.GenerateStructure(floor, b6, weight * 3500 / flags.worldlist["0"]["结构"]["沙漠神殿"][0], "沙漠神殿");
} else if (formation == "恶地") {
var tile = flags.worldlist["0"]["地形"]["恶地"][0];
core.plugin.GenerateResource(floor, b7, 20 / tile, r14); // 枯萎灌木
core.plugin.GenerateStructure(floor, b7, weight * 2000 / flags.worldlist["0"]["结构"]["岩浆池"][0], "岩浆池");
core.plugin.GenerateStructure(floor, b7, weight * 3000 / flags.worldlist["0"]["结构"]["废弃传送门"][0], "废弃传送门");
core.plugin.GenerateStructure(floor, b7, weight * 3000 / flags.worldlist["0"]["结构"]["前哨站"][0], "前哨站");
core.plugin.GenerateStructure(floor, b7, weight * 3000 / flags.worldlist["0"]["结构"]["沙漠神殿"][0], "沙漠神殿");
} else if (formation == "海洋") {
var tile = flags.worldlist["0"]["地形"]["海洋"][0];
core.plugin.GenerateResource(floor, b8, 50 / tile, r33); // 沙砾
core.plugin.GenerateResource(floor, b8, 50 / tile, r17); // 海草
core.plugin.GenerateResource(floor, b8, 30 / tile, r19); // 红珊瑚
core.plugin.GenerateResource(floor, b8, 30 / tile, r20); // 黄珊瑚
core.plugin.GenerateResource(floor, b8, 30 / tile, r21); // 蓝珊瑚
core.plugin.GenerateResource(floor, b8, 30 / tile, r22); // 粉珊瑚
core.plugin.GenerateResource(floor, b8, 10 / tile, r18); // 海带
core.plugin.GenerateStructure(floor, b8, weight * 1500 / flags.worldlist["0"]["结构"]["废墟"][0], "废墟");
core.plugin.GenerateStructure(floor, b8, weight * 3000 / flags.worldlist["0"]["结构"]["沉船"][0], "沉船");
} else if (formation == "海底神殿") {
core.plugin.CreateRate("正在生成海底神殿");
var r1 = core.plugin.rand3(24) + 2;
var r2 = core.plugin.rand3(24) + 2;
if (floor in Object.keys(flags.nearstr)) {
flags.nearstr[floor].push([r1 + 17, r2 + 17, 20, "海底神殿"]);
} else {
flags.nearstr[floor] = [[r1 + 17, r2 + 17, 20, "海底神殿"],];
}
for (var i = 1; i < 62; i++) {
for (var j = 1; j < 62; j++) {
if (i == r1 && j == r2) {
for (var y = 0; y < flags.structure["海底神殿"].length; y++) {
for (var x = 0; x < flags.structure["海底神殿"][y].length; x++) {
if (flags.structure["海底神殿"] && i + x < 62 && j + y < 62) {
if (flags.structure["海底神殿"][y][x] == 900) {
var rand1 = core.plugin.rand3(100);
if (rand1 < 90) {
core.setBlock(900, i + x, j + y, floor);
flags.maplist[floor][j + y][i + x] = 900;
} else if (rand1 < 98) {
core.setBlock(902, i + x, j + y, floor);
flags.maplist[floor][j + y][i + x] = 902;
} else {
core.setBlock(905, i + x, j + y, floor);
flags.maplist[floor][j + y][i + x] = 905;
}
} else {
core.setBlock(flags.structure["海底神殿"][y][x], i + x, j + y, floor);
flags.maplist[floor][j + y][i + x] = flags.structure["海底神殿"][y][x];
}
}
}
}
return;
}
}
}
} else if (formation == "丘陵") {
var tile = flags.worldlist["0"]["地形"]["丘陵"][0];
core.plugin.GenerateResource(floor, b9, 10 / tile, r27); // 圆石
core.plugin.GenerateResource(floor, b9, 50 / tile, r33); // 沙砾
core.plugin.GenerateResource(floor, b9, 50 / tile, r28); // 煤矿
core.plugin.GenerateResource(floor, b9, 80 / tile, r30); // 铜矿
core.plugin.GenerateResource(floor, b9, 100 / tile, r29); // 铁矿
core.plugin.GenerateStructure(floor, b9, weight * 1000 / flags.worldlist["0"]["结构"]["岩浆池"][0], "岩浆池");
core.plugin.GenerateStructure(floor, b9, weight * 2500 / flags.worldlist["0"]["结构"]["废弃传送门"][0], "废弃传送门");
} else if (formation == "蘑菇岛") {
var tile = flags.worldlist["0"]["地形"]["蘑菇岛"][0];
core.plugin.GenerateResource(floor, b10, 30 / tile, r31); // 红色蘑菇
core.plugin.GenerateResource(floor, b10, 30 / tile, r32); // 棕色蘑菇
} else if (formation == "河流") {
var tile = flags.worldlist["0"]["地形"]["河流"][0];
core.plugin.GenerateResource(floor, b11, 10 / tile, r17); // 海草
core.plugin.GenerateResource(floor, b11, 10 / tile, r33); // 沙砾
}
} //根据ID生成资源
this.GenerateResource = function (floor, bg, rDense, resource) {
core.plugin.CreateRate("正在生成资源");
//生成资源
for (var i = 1; i < 62; i++) {
for (var j = 1; j < 62; j++) {
if (core.getBgNumber(i, j, floor) == bg && !core.getBlockId(i, j, floor)) {
var rand1 = core.plugin.rand3(rDense);
if (rand1 == 0) {
core.setBlock(resource, i, j, floor);
flags.maplist[floor][j][i] = resource;
}
}
}
}
} //生成结构
this.GenerateStructure = function (floor, bg, weight, stru) {
core.plugin.CreateRate("正在生成结构");
if (flags.worldlist["0"]["世界选项"][1] == "关") return;
var end = [0, 0];
var s1 = 0, s2 = 0, s3 = 0, s4 = 0;
function Stru1(s1, s2, s3, s4) {
for (var i = 4; i < 62; i++) {
for (var j = 4; j < 62; j++) {
if (core.getBgNumber(i - 1, j - 1, floor) == bg &&
core.getBgNumber(i - 1, j, floor) == bg &&
core.getBgNumber(i - 1, j + 1, floor) == bg &&
core.getBgNumber(i, j - 1, floor) == bg &&
core.getBgNumber(i, j, floor) == bg &&
core.getBgNumber(i, j + 1, floor) == bg &&
core.getBgNumber(i + 1, j - 1, floor) == bg &&
core.getBgNumber(i + 1, j, floor) == bg &&
core.getBgNumber(i + 1, j + 1, floor) == bg) {
if (core.plugin.rand3(weight) == 0 && i + end[0] < 62 && j + end[1] < 62) {
//console.log(s1)
var skin = "";
switch (bg) {
case 341:
if (stru == "村庄") {
skin = "云杉皮肤";
}
break;
case 343:
if (stru == "村庄") {
skin = "砂岩皮肤";
}
break;
case 345:
if (stru == "废墟") {
skin = "海底废墟皮肤";
}
break;
case 344:
if (stru == "沙漠神殿") {
skin = "红沙神殿皮肤";
}
break;
}
function Str(str) {
if (skin == "云杉皮肤") {
if (str == 360) return 362;
} else if (skin == "砂岩皮肤") {
if (str == 360) return 928;
} else if (skin == "红沙神殿皮肤") {
if (str == 928) return 929;
if (str == 897) return 930;
}
return str;
}
function Strbg(strbg) {
if (skin == "云杉皮肤") {
if (strbg == 365) return 367;
} else if (skin == "砂岩皮肤") {
if (strbg == 365) return 343;
} else if (skin == "海底废墟皮肤") {
return 345;
}
return strbg;
}
function isbox(s1, str, x, y) {
if (s1 == "村庄小屋") {
if (str == 414 || str == 419 || str == 415 || str == 420) {
var r = core.plugin.rand3(12);
if (r == 0) {
core.setBlock(414, x, y, floor);
flags.maplist[floor][y][x] = 414;
} else if (r == 1) {
core.setBlock(419, x, y, floor);
flags.maplist[floor][y][x] = 419;
} else if (r == 2) {
core.setBlock(415, x, y, floor);
flags.maplist[floor][y][x] = 415;
} else if (r == 3) {
core.setBlock(420, x, y, floor);
flags.maplist[floor][y][x] = 420;
if (skin == "") {
core.plugin.Chestloot("平原村庄宝箱", (x * 1000 + y).toString().padStart(6, '0') + floor, 36);
} else if (skin == "云杉皮肤") {
core.plugin.Chestloot("针叶林村庄宝箱", (x * 1000 + y).toString().padStart(6, '0') + floor, 36);
} else if (skin == "砂岩皮肤") {
core.plugin.Chestloot("沙漠村庄宝箱", (x * 1000 + y).toString().padStart(6, '0') + floor, 36);
}
}
return;
}
} else if (s1 == "村庄农田") {
if (str == 918 || str == 919 || str == 920) {
var r = core.plugin.rand3(4);
if (r == 0) {
core.setBlock(918, x, y, floor);
flags.maplist[floor][y][x] = 918;
} else if (r == 1) {
core.setBlock(919, x, y, floor);
flags.maplist[floor][y][x] = 919;
} else if (r == 2) {
core.setBlock(920, x, y, floor);
flags.maplist[floor][y][x] = 920;
}
return;
}
} else if (s1 == "村庄铁匠铺") {
if (str == 420) {
core.setBlock(420, x, y, floor);
flags.maplist[floor][y][x] = 420;
core.plugin.Chestloot("铁匠铺宝箱", (x * 1000 + y).toString().padStart(6, '0') + floor, 42);
return;
}
} else if (s1 == "前哨站") {
if (str == 420) {
core.setBlock(420, x, y, floor);
flags.maplist[floor][y][x] = 420;
core.plugin.Chestloot("前哨站宝箱", (x * 1000 + y).toString().padStart(6, '0') + floor, 48);
return;
}
} else if (s1 == "雪屋") {
if (str == 372 || str == 375 || str == 373) {
var r = core.plugin.rand3(3);
if (r == 0) {
core.setBlock(372, x, y, floor);
flags.maplist[floor][y][x] = 372;
} else if (r == 1) {
core.setBlock(375, x, y, floor);
flags.maplist[floor][y][x] = 375;
} else if (r == 2) {
core.setBlock(373, x, y, floor);
flags.maplist[floor][y][x] = 373;
}
return;
} else if (str == 414 || str == 419 || str == 415 || str == 424) {
var r = core.plugin.rand3(16);
if (r < 3) {
core.setBlock(414, x, y, floor);
flags.maplist[floor][y][x] = 414;
} else if (r < 6) {
core.setBlock(419, x, y, floor);
flags.maplist[floor][y][x] = 419;
} else if (r < 9) {
core.setBlock(415, x, y, floor);
flags.maplist[floor][y][x] = 415;
} else if (r < 12) {
core.setBlock(424, x, y, floor);
flags.maplist[floor][y][x] = 424;
}
return;
}
} else if (s1 == "沉船") {
if (str == 362 || str == 360) {
var r = core.plugin.rand3(3);
if (r == 0) {
core.setBlock(362, x, y, floor);
flags.maplist[floor][y][x] = 362;
} else if (r == 1) {
core.setBlock(360, x, y, floor);
flags.maplist[floor][y][x] = 360;
}
return;
}
} else if (s1 == "丛林神庙") {
if (str == 420) {
core.setBlock(420, x, y, floor);
flags.maplist[floor][y][x] = 420;
core.plugin.Chestloot("丛林神庙宝箱", (x * 1000 + y).toString().padStart(6, '0') + floor, 54);
return;
}
} else if (s1 == "沉船") {
if (str == 420) {
core.setBlock(420, x, y, floor);
flags.maplist[floor][y][x] = 420;
core.plugin.Chestloot("沉船宝箱", (x * 1000 + y).toString().padStart(6, '0') + floor, 48);
return;
}
}
var block1 = Str(str)
core.setBlock(block1, x, y, floor);
flags.maplist[floor][y][x] = block1;
}
if (s1 == "废墟") {
var r1 = 0; //空气
var r2 = 349; //沙砾
var r3 = 916; //圆石
var r4 = 404; //铁矿
var r5 = 405; //铜矿
var r6 = 406; //金矿
var box = 0;
for (var y = 0; y < 7; y++) {
for (var x = 0; x < 7; x++) {
if (i + x < 62 && j + y < 62) {
function set() {
var rand1 = core.plugin.rand3(50);
var r;
if (rand1 < 30) {
r = r1;
} else if (rand1 < 36) {
r = r2;
} else if (rand1 < 45) {
r = r3;
} else if (rand1 < 47) {
r = r4;
} else if (rand1 < 49) {
r = r5;
} else {
r = r6;
}
return r;
}
var block1 = set()
core.setBlock(block1, i + x, j + y, floor);
flags.maplist[floor][j + y][i + x] = block1;
var b1 = set();
if (b1 != 0) {
var block3 = Strbg(b1);
core.setBgFgBlock('bg', block3, i + x, j + y, floor);
flags.bglist[floor][j + y][i + x] = block3;
}
if (box == 0 && x >= 2 && x <= 4 && y >= 2 && y <= 4 && core.plugin.rand3(40) == 0) {
core.setBlock(420, i + x, j + y, floor);
flags.maplist[floor][j + y][i + x] = 420;
if (skin == "海底废墟皮肤") {
core.plugin.Chestloot("海底废墟宝箱", ((i + x) * 1000 + j + y).toString().padStart(6, '0') + floor, 39);
} else {
core.plugin.Chestloot("陆地废墟宝箱", ((i + x) * 1000 + j + y).toString().padStart(6, '0') + floor, 36);
}
box = 1;
}
}
}
}
} else if (s1 == "岩浆池") {
var r1 = 0; //空气
var r2 = 916; //圆石
var r3 = 910; //岩浆
var rand1 = core.plugin.rand3(2) + 2;
for (var y = -rand1; y <= rand1; y++) {
for (var x = -rand1; x <= rand1; x++) {
if (i + x < 62 && j + y < 62) {
core.setBgFgBlock('bg', r3, i + x, j + y, floor);
flags.bglist[floor][j + y][i + x] = r3;
core.setBlock(r1, i + x, j + y, floor);
flags.maplist[floor][j + y][i + x] = r1;
}
}
}
for (var y = -rand1; y <= rand1; y++) {
for (var x = -rand1; x <= rand1; x++) {
if (x >= -1 && x <= 1 && y >= -1 && y <= 1) continue;
if (core.getBgNumber(i + x + 1, j + y, floor) != r3) {
var rand2 = core.plugin.rand3(2);
if (rand2 == 0) {
core.setBgFgBlock('bg', core.getBgNumber(i + x + 1, j + y, floor), i + x, j + y, floor);
flags.bglist[floor][j + y][i + x] = core.getBgNumber(i + x + 1, j + y, floor);
} else {
core.setBgFgBlock('bg', r3, i + x + 1, j + y, floor);
flags.bglist[floor][j + y][i + x + 1] = r3;
core.setBlock(r1, i + x + 1, j + y, floor);
flags.maplist[floor][j + y][i + x + 1] = r1;
}
} else if (core.getBgNumber(i + x - 1, j + y, floor) != r3) {
var rand2 = core.plugin.rand3(2);
if (rand2 == 0) {
core.setBgFgBlock('bg', core.getBgNumber(i + x - 1, j + y, floor), i + x, j + y, floor);
flags.bglist[floor][j + y][i + x] = core.getBgNumber(i + x - 1, j + y, floor);
} else {
core.setBgFgBlock('bg', r3, i + x - 1, j + y, floor);
flags.bglist[floor][j + y][i + x - 1] = r3;
core.setBlock(r1, i + x - 1, j + y, floor);
flags.maplist[floor][j + y][i + x - 1] = r1;
}
} else if (core.getBgNumber(i + x, j + y + 1, floor) != r3) {
var rand2 = core.plugin.rand3(2);
if (rand2 == 0) {
core.setBgFgBlock('bg', core.getBgNumber(i + x, j + y + 1, floor), i + x, j + y, floor);
flags.bglist[floor][j + y][i + x] = core.getBgNumber(i + x, j + y + 1, floor);
} else {
core.setBgFgBlock('bg', r3, i + x, j + y + 1, floor);
flags.bglist[floor][j + y + 1][i + x] = r3;
core.setBlock(r1, i + x, j + y + 1, floor);
flags.maplist[floor][j + y + 1][i + x] = r1;
}
} else if (core.getBgNumber(i + x, j + y - 1, floor) != r3) {
var rand2 = core.plugin.rand3(2);
if (rand2 == 0) {
core.setBgFgBlock('bg', core.getBgNumber(i + x, j + y - 1, floor), i + x, j + y, floor);
flags.bglist[floor][j + y][i + x] = core.getBgNumber(i + x, j + y - 1, floor);
} else {
core.setBgFgBlock('bg', r3, i + x, j + y - 1, floor);
flags.bglist[floor][j + y - 1][i + x] = r3;
core.setBlock(r1, i + x, j + y - 1, floor);
flags.maplist[floor][j + y - 1][i + x] = r1;
}
}
}
}
} else if (s1 == "废弃传送门") {
var r1 = 0; //空气
var r2 = 922; //石砖
var r3 = 923; //苔石砖
var r4 = 927; //裂纹石砖
var r5 = 924; //下界岩
var r6 = 896; //黑曜石
var r7 = 910; //岩浆
var rand1 = core.plugin.rand3(3) + 3;
var w1 = 0, w2 = 0;
var box = 0;
do {
for (var y = -w1; y <= w1; y++) {
for (var x = -w2; x <= w2; x++) {
if (x != -w2 && x != w2 && y != -w1 && y != w1) continue;
if (i + x < 62 && j + y < 62) {
if (Math.abs(w1) <= 2 && core.plugin.rand3(3) == 0) {
core.setBlock(r6, i + x, j + y, floor);
flags.maplist[floor][j + y][i + x] = r6;
} else if (Math.abs(w1) > 2 && core.plugin.rand3(2) == 0) {
function set() {
var rand2 = core.plugin.rand3(44);
var r;
if (rand2 < 20) {
r = r1;
} else if (rand2 < 26) {
r = r2;
} else if (rand2 < 32) {
r = r3;
} else if (rand2 < 38) {
r = r4;
} else {
r = r5;
}
return r;
}
var block2 = set();
core.setBlock(block2, i + x, j + y, floor);
flags.maplist[floor][j + y][i + x] = block2;
if (core.plugin.rand3(25) < 15) {
core.setBgFgBlock('bg', r7, i + x, j + y, floor);
flags.bglist[floor][j + y][i + x] = r7;
}
if (box == 0 && core.plugin.rand3(30) == 0) {
core.setBlock(420, i + x, j + y, floor);
flags.maplist[floor][j + y][i + x] = 420;
core.plugin.Chestloot("废弃传送门宝箱", ((i + x) * 1000 + j + y).toString().padStart(6, '0') + floor, 54);
box = 1;
}
}
}
}
}
w1 += 1;
w2 += 1;
} while (w1 <= rand1);
} else {
var r1 = core.plugin.rand3(4) + 2;
var r2 = core.plugin.rand3(5) - 3;
var r3 = core.plugin.rand3(5) - 3;
var r4 = core.plugin.rand3(4) + 2;
var r5 = core.plugin.rand3(4) + 2;
var r6 = core.plugin.rand3(4) + 2;
if (flags.structure[s1]) {
if (s1 == "前哨站") {
if (floor in Object.keys(flags.nearstr)) {
flags.nearstr[floor].push([i + x + 6, j + y + 6, 9, "前哨站"]);
} else {
flags.nearstr[floor] = [[i + x + 6, j + y + 6, 9, "前哨站"],];
}
}
for (var y = 0; y < flags.structure[s1].length; y++) {
for (var x = 0; x < flags.structure[s1][y].length; x++) {
if (i + x < 62 && j + y < 62) {
var str = flags.structure[s1][y][x];
var strbg;
if (flags.structurebg[s1] && flags.structurebg[s1][y][x] != 0) {
strbg = flags.structurebg[s1][y][x];
var block4 = Strbg(strbg);
core.setBgFgBlock('bg', block4, i + x, j + y, floor);
flags.bglist[floor][j + y][i + x] = block4;
}
isbox(s1, str, i + x, j + y);
}
}
}
}
if (flags.structure[s2]) {
for (var y = 0; y < flags.structure[s2].length; y++) {
for (var x = 0; x < flags.structure[s2][y].length; x++) {
if (i + x + flags.structure[s1][0].length + r1 < 62 && j + y + flags.structure[s1].length + r2 < 62) {
var str = flags.structure[s2][y][x];
var strbg;
if (flags.structurebg[s2] && flags.structurebg[s2][y][x] != 0) {
strbg = flags.structurebg[s2][y][x];
var block5 = Strbg(strbg);
core.setBgFgBlock('bg', block5, i + x + flags.structure[s1][0].length + r1, j + y + r2, floor);
flags.bglist[floor][j + y + r2][i + x + flags.structure[s1][0].length + r1] = block5;
}
isbox(s2, str, i + x + flags.structure[s1][0].length + r1, j + y + r2);
}
}
}
}
if (flags.structure[s3]) {
for (var y = 0; y < flags.structure[s3].length; y++) {
for (var x = 0; x < flags.structure[s3][y].length; x++) {
if (i + x + flags.structure[s1][0].length + r3 < 62 && j + y + flags.structure[s1].length + r4 < 62) {
var str = flags.structure[s3][y][x];
var strbg;
if (flags.structurebg[s3] && flags.structurebg[s3][y][x] != 0) {
strbg = flags.structurebg[s3][y][x];
var block6 = Strbg(strbg);
core.setBgFgBlock('bg', block6, i + x + r3, j + y + flags.structure[s1].length + r4, floor);
flags.bglist[floor][j + y + flags.structure[s1].length + r4][i + x + r3] = block6;
}
isbox(s3, str, i + x + r3, j + y + flags.structure[s1].length + r4);
}
}
}
}
if (flags.structure[s4]) {
for (var y = 0; y < flags.structure[s4].length; y++) {
for (var x = 0; x < flags.structure[s4][y].length; x++) {
if (i + x + flags.structure[s1][0].length + r5 < 62 && j + y + flags.structure[s1].length + r6 < 62) {
var str = flags.structure[s4][y][x];
var strbg;
if (flags.structurebg[s4] && flags.structurebg[s4][y][x] != 0) {
strbg = flags.structurebg[s4][y][x];
var block7 = Strbg(strbg);
core.setBgFgBlock('bg', block7, i + x + flags.structure[s1][0].length + r5, j + y + flags.structure[s1].length + r6, floor);
flags.bglist[floor][j + y + flags.structure[s1].length + r6][i + x + flags.structure[s1][0].length + r5] = block7;
}
isbox(s4, str, i + x + flags.structure[s1][0].length + r5, j + y + flags.structure[s1].length + r6);
}
}
}
}
//接下来一定范围内不能生成该结构
i += end[0];
j += end[1];
}
}
}
}
}
}
switch (stru) {
case "水井":
end = [4, 4];
s1 = "水井";
break;
case "村庄":
end = [15, 15];
var st = ["村庄小屋", "村庄小屋", "村庄小屋", "村庄小屋", "村庄小屋", "村庄农田", "村庄农田", "村庄铁匠铺", "",];
var r1 = core.plugin.rand3(8);
s1 = st[r1];
st.splice(r1, 1);
r1 = core.plugin.rand3(8);
s2 = st[r1];
st.splice(r1, 1);
r1 = core.plugin.rand3(7);
s3 = st[r1];
st.splice(r1, 1);
r1 = core.plugin.rand3(6);
s4 = st[r1];
break;
case "雪屋":
end = [10, 10];
s1 = "雪屋";
break;
case "前哨站":
end = [15, 15];
s1 = "前哨站";
break;
case "沉船":
end = [30, 15];
s1 = "沉船";
break;
case "废墟":
end = [5, 5];
s1 = "废墟";
break;
case "岩浆池":
end = [5, 5];
s1 = "岩浆池";
break;
case "废弃传送门":
end = [5, 5];
s1 = "废弃传送门";
break;
case "沙漠神殿":
end = [30, 30];
s1 = "沙漠神殿";
break;
case "丛林神庙":
end = [20, 20];
s1 = "丛林神庙";
break;
}
Stru1(s1, s2, s3, s4);
} //生成基岩
this.GenerateBedrock = function () {
core.plugin.CreateRate("正在生成基岩");
for (var id in core.floorIds) {
if (core.floors[core.floorIds[id]].width >= 63) {
var floor = core.floorIds[id];
for (var i = 0; i < 63; i++) {
for (var j = 0; j < 63; j++) {
if (i == 0 || i == 63 - 1 || j == 0 || j == 63 - 1) {
if (core.getBlockNumber(i, j, floor) != 91 && core.getBlockNumber(i, j, floor) != 92 && core.getBlockNumber(i, j, floor) != 93 && core.getBlockNumber(i, j, floor) != 94) {
core.setBlock(302, i, j, floor);
flags.maplist[floor][j][i] = 302;
}
}
}
}
}
}
var floors1 = ["zhu7", "zhu8", "zhu9", "zhu12", "zhu13", "zhu14", "zhu17", "zhu18", "zhu19"];
for (var id = 0; id < floors1.length; id++) {
var dir = [];//上下左右
if (flags.worldlist["0"]["世界选项"][3] == "小" || flags.worldlist["0"]["世界选项"][3] == "中") {
switch (id) {
case 0:
dir = [0, 1, 0, 1];
break;
case 1:
dir = [0, 1, 1, 1];
break;
case 2:
dir = [0, 1, 1, 0];
break;
case 3:
dir = [1, 1, 0, 1];
break;
case 4:
dir = [1, 1, 1, 1];
break;
case 5:
dir = [1, 1, 1, 0];
break;
case 6:
dir = [1, 0, 0, 1];
break;
case 7:
dir = [1, 0, 1, 1];
break;
case 8:
dir = [1, 0, 1, 0];
break;
}
} else if (flags.worldlist["0"]["世界选项"][3] == "大") {
dir = [1, 1, 1, 1];
}
if (dir[0]) {
core.setBlock(91, 31, 0, floors1[id]);
flags.maplist[floors1[id]][0][31] = 91;
}
if (dir[1]) {
core.setBlock(93, 31, 62, floors1[id]);
flags.maplist[floors1[id]][62][31] = 93;
}
if (dir[2]) {
core.setBlock(92, 0, 31, floors1[id]);
flags.maplist[floors1[id]][31][0] = 92;
}
if (dir[3]) {
core.setBlock(94, 62, 31, floors1[id]);
flags.maplist[floors1[id]][31][62] = 94;
}
}
var floors2 = ["dong1", "dong2", "dong3", "dong4", "dong5", "dong6", "dong7", "dong8", "dong9",];
for (var id = 0; id < floors2.length; id++) {
var dir = [];//上下左右
switch (id) {
case 0:
dir = [0, 1, 0, 1];
break;
case 1:
dir = [0, 1, 1, 1];
break;
case 2:
dir = [0, 1, 1, 0];
break;
case 3:
dir = [1, 1, 0, 1];
break;
case 4:
dir = [1, 1, 1, 1];
break;
case 5:
dir = [1, 1, 1, 0];
break;
case 6:
dir = [1, 0, 0, 1];
break;
case 7:
dir = [1, 0, 1, 1];
break;
case 8:
dir = [1, 0, 1, 0];
break;
}
if (dir[0]) {
core.setBlock(91, 31, 0, floors2[id]);
flags.maplist[floors2[id]][0][31] = 91;
}
if (dir[1]) {
core.setBlock(93, 31, 62, floors2[id]);
flags.maplist[floors2[id]][62][31] = 93;
}
if (dir[2]) {
core.setBlock(92, 0, 31, floors2[id]);
flags.maplist[floors2[id]][31][0] = 92;
}
if (dir[3]) {
core.setBlock(94, 62, 31, floors2[id]);
flags.maplist[floors2[id]][31][62] = 94;
}
}
} //填充战利品箱
this.Chestloot = function (ch, po, grid = 54) {
core.plugin.CreateRate("正在生成宝藏");
var c1 = flags.chestloot[ch];
var weight1 = 0;
var weight2 = 0;
for (var i = 1; i < c1.length; i++) {
weight1 += c1[i][2];
}
var rand2 = core.plugin.rand3(c1[0][1] - c1[0][0] + 1) + c1[0][0];
var num = 0;
flags.boxlist[po] = [["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0], ["", 0],];
do {
var rand1 = core.plugin.rand3(weight1);
box: for (var i = 1; i < c1.length; i++) {
var c = c1[i];
if (rand1 <= c[2] + weight2) {
var n;
var rand3 = core.plugin.rand3(grid);
while (flags.boxlist[po][rand3][0] != ""/* && n < 100*/) {
rand3 = core.plugin.rand3(grid);
n += 1;
}
flags.boxlist[po][rand3][0] = c[0];
flags.boxlist[po][rand3][1] = core.plugin.rand3(c[1][1] - c[1][0] + 1) + c[1][0];
weight2 = 0;
break box;
} else {
weight2 += c[2];
}
}
num += 1;
} while (num < rand2)
} //根据地图数组放置图块
this.Maplist = function () {
if (!flags.maplist) return;
for (var floor in flags.maplist) {
for (var y = 0; y < flags.maplist[floor].length; y++) {
for (var x = 0; x < flags.maplist[floor][y].length; x++) {
if (flags.maplist[floor][y][x] != undefined && flags.maplist[floor][y][x] != 0) {
core.setBlock(flags.maplist[floor][y][x], x, y, floor);
}
}
}
}
if (!flags.bglist) return;
for (var floor in flags.bglist) {
for (var y = 0; y < flags.bglist[floor].length; y++) {
for (var x = 0; x < flags.bglist[floor][y].length; x++) {
if (flags.bglist[floor][y][x] != undefined) {
core.setBgFgBlock('bg', flags.bglist[floor][y][x], x, y, floor);
} else {
core.setBgFgBlock('bg', 0, x, y, floor);
}
}
}
}
} //世界生成进度
this.CreateRate = function (text = "") {
var ctx = document.getElementById("title").getContext('2d');
core.clearMap(ctx);
core.drawImage(ctx, "jz4.png", 0, 0);
core.setAlpha(ctx, 0.6);
core.fillRect(ctx, 0, 350, 554, 100, "black");
core.setAlpha(ctx, 1);
core.fillRoundRect(ctx, 50, 390, 450, 10, 3, "#a1a1a1");
core.fillRoundRect(ctx, 50, 390, 450 * (flags.createrate / 100), 10, 3, "#5bfb62");
core.fillText(ctx, text, 60, 380, "white", ui.prototype._buildFont(20, false), 400);
core.fillText(ctx, flags.createrate + " %", 440, 380, "white", ui.prototype._buildFont(20, false), 400);
} //随机洞穴层图块
this.Caveblock = function (type, isbg) {
if (isbg != 1 && core.plugin.rand3(2) == 0) return 0;
var c1 = flags.cavelayer[type];
var weight1 = 0;
var weight2 = 0;
for (var i = 0; i < c1.length; i++) {
weight1 += c1[i][1];
}
var r1 = core.plugin.rand3(weight1);
for (var i = 0; i < c1.length; i++) {
var c = c1[i];
if (r1 <= c[1] + weight2) {
// if (maps_90f36752_8815_4be8_b32b_d7fad1d0542e[c[0]].name in flags.a) {
// flags.a[maps_90f36752_8815_4be8_b32b_d7fad1d0542e[c[0]].name] +=1;
// }
// else {
// flags.a[maps_90f36752_8815_4be8_b32b_d7fad1d0542e[c[0]].name] = 0;
// }
return c[0];
} else {
weight2 += c[1];
}
}
}
},
"20-加载图": function () {
this.jiazaitu = function (name, time) {
//显示加载图
if (!core.getContextByName("jzt")) {
core.createCanvas("jzt", 0, 0, 416, 416, 136);
core.drawImage("jzt", name, 0, 0, 416, 416);
flags.interface = "锁定";
}
setTimeout(function () {
//加载图累减
if (time > 0) {
time -= 100;
core.plugin.jiazaitu(name, time);
} else {
core.deleteCanvas("jzt");
flags.interface = "物品栏";
return;
}
}, 100);
}
},
"21-出生点设置": function () {
this.chushengdian = function (floor) {
//出生点设置
flags.revive[0] = floor;
flags.revive[1] = core.rand(core.status.maps[floor].width - 18) + 9;
flags.revive[2] = core.rand(core.status.maps[floor].height - 18) + 9;
}
this.chongshengdian = function (x, y, floor) {
if (flags.revive[3] != floor || flags.revive[4] != x || flags.revive[5] != y) {
flags.revive[3] = floor;
flags.revive[4] = x;
flags.revive[5] = y;
flags.tip[0] = "重生点已设置";
core.ui.drawStatusBar();
}
}
},
"22-角色死亡检测": function () {
this.siwangjiance = function () {
//角色死亡事件
if (core.status.hero.hp <= 0 && !core.getContextByName("die")) {
core.status.hero.hp = 0;
flags.interface = "物品栏";
core.plugin.drawMC();
flags.interface = "锁定";
flags.tech = 0;
flags.CustomKey = 0;
core.status.event.id = null;
//core.ui._createUIEvent();
if (core.getContextByName("die") == null) {
core.createCanvas("die", 0, 0, 416, 416, 150);
} else {
core.clearMap('die');
}
core.ui.setAlpha("die", 0.6);
core.ui.fillRect("die", 0, 0, 416, 416);
core.ui.setAlpha("die", 1);
core.ui.fillText("die", "你死了!", 160, 128 + 8, "white", ui.prototype._buildFont(30, false), 160);
core.fillRect("die", 128, 224, 160, 32, "#53534b");
core.ui.fillText("die", "重生", 160 + 26, 224 + 22, "white", ui.prototype._buildFont(20, false), 160);
core.fillRect("die", 128, 288, 160, 32, "#53534b");
core.ui.fillText("die", "返回标题界面", 146, 288 + 22, "white", ui.prototype._buildFont(20, false), 160);
for (var en in flags.enemylist) {
core.plugin.delenemy(en, 0);
}
if (flags.worldlist["0"]["游戏规则"][0] == "开") {
if (flags.worldlist["0"]["难度"] == "简单") {
flags.level[0] = Math.floor(flags.level[0] / 4 * 3);
} else if (flags.worldlist["0"]["难度"] == "普通") {
flags.level[0] = Math.floor(flags.level[0] / 2);
} else if (flags.worldlist["0"]["难度"] == "困难") {
flags.level[0] = 0;
}
flags.level[1] = 0;
core.plugin.jingyandengji();
}
}
}
},
"23-敌怪": function () {
//刷怪选取
function refEnemy(land) {
var world = "前期";
if (flags.worldlevel <= 3) {
world = "前期";
} else if (flags.worldlevel <= 7) {
world = "中期";
} else {
world = "后期";
}
var re = flags.refenemy[world][land][flags.timePeriod == "夜晚" ? "夜晚" : "白天"];
var weight1 = 0;
var weight2 = 0;
for (var i = 0; i < re.length; i++) {
weight1 += re[i][1];
}
var r1 = core.rand2(weight1);
for (var i = 0; i < re.length; i++) {
var r = re[i];
if (r1 <= r[1] + weight2) {
return r[0];
} else {
weight2 += r[1];
}
}
}//需要刷怪时,选择合适的位置刷不同的怪
this.shuaguai = function () {
//确定坐标点
var ex, ey, ex1, ey1;
var x = core.status.hero.loc.x;
var y = core.status.hero.loc.y;
function area() {
var x, y;
x = core.rand2(19) - 9;
if (core.rand2(2) == 0) y = core.rand2(3) + 7;
else y = core.rand2(3) - 9;
ex = x;
ey = y;
}
area();
if (core.rand2(2) == 0) {
ex1 = x + ex;
ey1 = y + ey;
} else {
ex1 = x + ey;
ey1 = y + ex;
}
if (core.getBlockId(ex1, ey1) || ex1 <= 0 || ex1 >= 63 || ey1 <= 0 || ey1 >= 63) return;
var enemy = "E1";
//确定维度
if (flags.dimension[0] == "主世界") {
if (core.status.floorId in flags.nearstr) {
var near = flags.nearstr[core.status.floorId];
for (var i = 0; i < near.length; i++) {
if (Math.abs(ex1 - near[i][0]) <= near[i][2] || Math.abs(ey1 - near[i][1]) <= near[i][2]) {
if (near[i][3] == "前哨站") {
if (core.rand2(2) == 0) enemy = "E57";
else enemy = "E69";
} else if (near[i][3] == "海底神殿") {
enemy = "E45";
}
}
}
} else if (flags.sleep >= 4320 && flags.timePeriod == "夜晚" && core.rand2(3) != 0) {
enemy = "E53";
} else {
//确定背景块
switch (core.getBgNumber(ex1, ey1)) {
case 921:
case 339:
case 340:
case 305:
enemy = refEnemy("草地");
break;
case 341:
case 342:
enemy = refEnemy("雪林");
break;
case 343:
case 344:
enemy = refEnemy("沙漠");
break;
case 345:
case 348:
enemy = refEnemy("水下");
break;
case 347:
enemy = refEnemy("蘑菇岛");
break;
default:
enemy = refEnemy("其他");
break;
}
}
}
//生成一只敌怪
if (enemy == undefined) return;
core.setBlock(enemy, ex1, ey1);
var eid = (ex1 * 1000 + ey1).toString().padStart(6, '0') + core.status.floorId;
var hp1 = flags.enemyGuide[enemy][0][0];
if (flags.worldlevel <= 3) {
hp1 *= 30;
} else if (flags.worldlevel <= 7) {
hp1 *= 50;
} else {
hp1 *= 100;
}
hp1 = Math.round(hp1);
var hpmax1 = hp1;
if ((enemy == "E33" || enemy == "E41") && flags.timePeriod == "夜晚") hp1 -= 1;
if (core.getBlockCls(ex1, ey1, core.status.floorId, true) == 'enemys' ||
core.getBlockCls(ex1, ey1, core.status.floorId, true) == 'enemy48') {
flags.enemylist[eid] = {
id: enemy,
hp: hp1,
hpmax: hpmax1,
state: ["stand", "stand", "move", "chase", "attack", "observe", "flash", "bomb",],//flash闪现bomb自爆
move: [3, 0],
}
}
core.plugin.enemystate(eid, ex1, ey1, core.status.floorId);
}//敌怪当前生命为0就删除找不到敌怪也删除
this.delenemy = function (po, isget, x = parseInt(po.substr(0, 3)), y = parseInt(po.substr(3, 3)), floor = po.substr(6)) {
if (isget) {
var item = flags.enemyGuide[flags.enemylist[po].id];
if (item[1] && item[1][2] > core.rand2(100)) {
var r1 = core.rand2(item[1][1][1] - item[1][1][0] + 1) + item[1][1][0];
core.addItem(item[1][0], r1);
core.playSound("pop.ogg");
}
if (item[2] && item[2][2] > core.rand2(100)) {
var r1 = core.rand2(item[2][1][1] - item[2][1][0] + 1) + item[2][1][0];
core.addItem(item[2][0], r1);
core.playSound("pop.ogg");
}
var cop = item[0][8];
var exp = item[0][9];
if (flags.worldlevel <= 3) {
cop *= 18;
exp *= 12;
} else if (flags.worldlevel <= 7) {
cop *= 22;
exp *= 15;
} else {
cop *= 25;
exp *= 18;
}
cop = Math.round(cop);
exp = Math.round(exp);
core.plugin.beibaocunchu();
flags.coppernum += cop;
flags.level[1] += exp + flags.property.exp;
core.playSound("orb.ogg");
core.plugin.jingyandengji();
core.plugin.enemydiesound(flags.enemylist[po].id);
}
if (core.getBlockCls(x, y, floor, true) == 'enemys' ||
core.getBlockCls(x, y, floor, true) == 'enemy48') {
core.removeBlock(x, y, floor);
}
delete flags.enemylist[po];
}//敌怪状态
this.enemystate = function (po, ex = parseInt(po.substr(0, 3)), ey = parseInt(po.substr(3, 3)), ef = po.substr(6)) {
if (!flags.enemylist[po]) return;
// 获取主角的位置
var hx = core.getHeroLoc('x');
var hy = core.getHeroLoc('y');
var hf = core.status.floorId;
if (ef == hf && Math.abs(ex - hx) <= 15 && Math.abs(ey - hy) <= 15) {
function move(dir, ex1, ey1) {
if (document.visibilityState === 'visible' &&
Math.abs(core.status.hero.loc.x - ex) <= 6 &&
Math.abs(core.status.hero.loc.y - ey) <= 6) {
if (core.status.hero.loc.x != -1 && core.status.hero.loc.y != -1) core.moveBlock(ex, ey, [dir], 200, true);
core.removeBlock(ex, ey, ef);
} else {
core.removeBlock(ex, ey, ef);
setTimeout(function () {
if (flags.enemylist[po]) {
core.setBlock(flags.enemylist[po].id, ex1, ey1, ef);
}
}, 200);
}
//core.deleteCanvas("xietiao" + po);
var eid = (ex1 * 1000 + ey1).toString().padStart(6, '0') + ef;
flags.enemylist[eid] = core.clone(flags.enemylist[po]);
if (flags.rightstatus[0] == "敌怪" && flags.rightstatus[1] == po) {
flags.rightstatus[1] = eid;
}
delete flags.enemylist[po];
po = eid;
ex = ex1;
ey = ey1;
}
function move2(r = core.rand2(4) + 1) {
if (r == 1 && !core.getBlockCls(ex - 1, ey, ef) &&
core.getMapNumber(ex - 1, ey) != 371 && core.getMapNumber(ex - 1, ey) != 383) {
move("left", ex - 1, ey);
} else if (r == 2 && !core.getBlockCls(ex + 1, ey, ef) &&
core.getMapNumber(ex + 1, ey) != 371 && core.getMapNumber(ex + 1, ey) != 383) {
move("right", ex + 1, ey);
} else if (r == 3 && !core.getBlockCls(ex, ey - 1, ef) &&
core.getMapNumber(ex, ey - 1) != 371 && core.getMapNumber(ex, ey - 1) != 383) {
move("up", ex, ey - 1);
} else if (r == 4 && !core.getBlockCls(ex, ey + 1, ef) &&
core.getMapNumber(ex, ey + 1) != 371 && core.getMapNumber(ex, ey + 1) != 383) {
move("down", ex, ey + 1);
}
}
if (flags.enemylist[po].id == "E37" && core.rand2(16) == 0) {
//末影人闪现
flags.enemylist[po].state[0] = flags.enemylist[po].state[6];
} else if (core.nearHero(ex, ey, flags.enemyGuide[flags.enemylist[po].id][0][5]) &&
(!flags.enemyGuide[flags.enemylist[po].id][0][10] || (
flags.enemyGuide[flags.enemylist[po].id][0][10] &&
flags.enemylist[po].hp < flags.enemylist[po].hpmax))) {
//攻击
flags.enemylist[po].state[0] = flags.enemylist[po].state[4];
if (flags.enemylist[po].id == "E25") {
flags.enemylist[po].state[0] = flags.enemylist[po].state[7];
}
} else if (core.nearHero(ex, ey, flags.enemyGuide[flags.enemylist[po].id][0][6]) &&
(!flags.enemyGuide[flags.enemylist[po].id][0][10] || (
flags.enemyGuide[flags.enemylist[po].id][0][10] &&
flags.enemylist[po].hp < flags.enemylist[po].hpmax))) {
//追击
flags.enemylist[po].state[0] = flags.enemylist[po].state[3];
} else if (flags.enemylist[po].move[0] <= 0) {
//移动
flags.enemylist[po].state[0] = flags.enemylist[po].state[2];
} else if (flags.enemylist[po].move[0] > 0) {
//站立
flags.enemylist[po].state[0] = flags.enemylist[po].state[1];
}
if (flags.enemylist[po].state[0] == flags.enemylist[po].state[7]) {
//flags.bombcenter.push([ef, ex, ey]);
core.playSound("E25_4.ogg");
setTimeout(function () {
if (flags.enemylist[po]) {
if (core.rand2(2) == 0) core.playSound("E25_5.ogg");
else core.playSound("E25_6.ogg");
if (core.status.floorId == ef &&
Math.abs(core.status.hero.loc.x - ex) <= 5 &&
Math.abs(core.status.hero.loc.y - ey) <= 5) {
core.plugin.gethurt(po, ex, ey);
}
core.removeBlock(ex, ey, ef);
delete flags.enemylist[po];
}
}, 2800);
} else if (flags.enemylist[po].state[0] == flags.enemylist[po].state[6]) {
var fla = 0;
var ex1 = 0, ey1 = 0;
do {
ex1 = core.rand2(11) - 5;
ey1 = core.rand2(11) - 5;
fla += 1;
} while (fla < 10 && (ex + ex1 <= 0 || ex + ex1 >= 63 || ey + ey1 <= 0 || ey + ey1 >= 63 || core.getMapNumber(ex + ex1, ey + ey1)))
if (ex1 != 0 && ey1 != 0) {
ex1 += ex;
ey1 += ey;
core.removeBlock(ex, ey, ef);
core.setBlock(flags.enemylist[po].id, ex1, ey1, ef);
if (ef == core.status.floorId &&
Math.abs(ex1 - core.status.hero.loc.x) <= 8 &&
Math.abs(ey1 - core.status.hero.loc.y) <= 8) {
if (core.rand2(2) == 0) core.playSound("E37_9.ogg");
else core.playSound("E37_10.ogg");
}
var eid = (ex1 * 1000 + ey1).toString().padStart(6, '0') + ef;
flags.enemylist[eid] = core.clone(flags.enemylist[po]);
if (flags.rightstatus[0] == "敌怪" && flags.rightstatus[1] == po) {
flags.rightstatus[1] = eid;
}
delete flags.enemylist[po];
po = eid;
ex = ex1;
ey = ey1;
}
} else if (flags.enemylist[po].state[0] == flags.enemylist[po].state[5]) {
if (ex > hx && ey >= hy) {
move2(2);
} else if (ex >= hx && ey < hy) {
move2(3);
} else if (ex <= hx && ey > hy) {
move2(4);
} else if (ex < hx && ey <= hy) {
move2(1);
}
flags.enemylist[po].move[0] -= 1;
} else if (flags.enemylist[po].state[0] == flags.enemylist[po].state[4]) {
if (document.visibilityState === 'visible') {
core.plugin.gethurt(po, ex, ey);
}
} else if (flags.enemylist[po].state[0] == flags.enemylist[po].state[3]) {
// 使用 BFS广度优先搜索算法找到从敌怪到主角的路径
var path = core.maps._automaticRoute_bfs(ex, ey, hx, hy, hf);
var ans = [], nowX = hx, nowY = hy;
while (nowX != ex || nowY != ey) {
var dir = path[nowX + "," + nowY];
if (!dir) break;//敌怪无法直接走到主角处
ans.push({ 'direction': dir, 'x': nowX, 'y': nowY });
nowX -= core.utils.scan[dir].x;
nowY -= core.utils.scan[dir].y;
}
ans.reverse(dir);
if (ans.length > 0 && ans.length < 20) {
var ex1, ey1;
switch (ans[0].direction) {
case "up":
ex1 = ex;
ey1 = ey - 1;
break;
case "down":
ex1 = ex;
ey1 = ey + 1;
break;
case "left":
ex1 = ex - 1;
ey1 = ey;
break;
case "right":
ex1 = ex + 1;
ey1 = ey;
break;
}
if (core.getMapNumber(ex1, ey1) != 371 && core.getMapNumber(ex1, ey1) != 383) {
move(ans[0].direction, ex1, ey1);
flags.enemylist[po].move[0] = 3;
} else {
move2();
flags.enemylist[po].move[0] = 1;
}
} else {
move2();
flags.enemylist[po].move[0] = 1;
}
} else if (flags.enemylist[po].state[0] == flags.enemylist[po].state[2]) {
if (flags.enemylist[po].move[1] < 20) {
move2();
flags.enemylist[po].move[0] = 3;
flags.enemylist[po].move[1] += 1;
} else {
core.plugin.delenemy(po, 0, ex, ey, ef);
return;
}
} else if (flags.enemylist[po].state[0] == flags.enemylist[po].state[1]) {
flags.enemylist[po].move[0] -= 1;
}
//core.plugin.enemyHP(po, ex, ey);
} else {
if (flags.enemylist[po].move[1] < 20) {
flags.enemylist[po].move[1] += 1;
} else {
core.removeBlock(ex, ey, ef);
delete flags.enemylist[po];
return;
}
}
var movespeed;
if (flags.enemylist[po].state[0] == flags.enemylist[po].state[7]) {
movespeed = 5000;
} else if (flags.enemylist[po].state[0] == flags.enemylist[po].state[6]) {
movespeed = 1000;
} else if (flags.enemylist[po].state[0] == flags.enemylist[po].state[5]) {
movespeed = 1000;
} else if (flags.enemylist[po].state[0] == flags.enemylist[po].state[4]) {
movespeed = ((flags.enemyGuide[flags.enemylist[po].id][0][3] - 110) / -20 * 1000);
} else if (flags.enemylist[po].state[0] == flags.enemylist[po].state[3]) {
movespeed = ((flags.enemyGuide[flags.enemylist[po].id][0][4] - 110) / -20 * 1000);
} else if (flags.enemylist[po].state[0] == flags.enemylist[po].state[2]) {
movespeed = ((flags.enemyGuide[flags.enemylist[po].id][0][4] - 110) / -20 * 1000);
} else if (flags.enemylist[po].state[0] == flags.enemylist[po].state[1]) {
movespeed = ((flags.enemyGuide[flags.enemylist[po].id][0][4] - 110) / -20 * 1000);
movespeed = Math.max(1000, movespeed);
} else {
movespeed = 1000;
}
setTimeout(function () {
if (!flags.enemylist[po]) return;
if (core.rand2(20) == 0 &&
ef == core.status.floorId &&
Math.abs(ex - core.status.hero.loc.x) <= 10 &&
Math.abs(ey - core.status.hero.loc.y) <= 10) {
core.plugin.enemymovesound(flags.enemylist[po].id);
}
core.plugin.enemystate(po, ex, ey, ef);
}, movespeed);
}//敌怪血条
this.enemyHP = function (po, ex, ey) {
var name = "xietiao" + po;
if (core.nearHero(ex, ey, flags.enemyGuide[flags.enemylist[po].id][0][6])) {
var x = ex * 32 + 3 - core.bigmap.offsetX;
var y = ey * 32 - core.bigmap.offsetY;
if (core.getContextByName(name) == null) {
core.createCanvas(name, 0, 0, 416, 416, 100);
} else {
core.clearMap(name);
}
core.fillRect(name, x, y, 26, 3, "#2b2b2b");
core.fillRect(name, x, y, Math.ceil((flags.enemylist[po].hp / flags.enemylist[po].hpmax) * 26), 3, "#f97524");
} else {
core.deleteCanvas(name);
}
}//敌怪死亡音效
this.enemydiesound = function (enemy) {
var sound = 0;
switch (enemy) {
case "E9":
case "E13":
case "E17":
sound = "E9_1";
break;
case "E21":
sound = "E21_1";
break;
case "E25":
case "E29":
sound = "E25_1";
break;
case "E33":
sound = "E33_1";
break;
case "E37":
sound = "E37_1";
break;
case "E41":
sound = "E41_1";
break;
case "E45":
sound = "E45_1";
break;
case "E53":
sound = "E53_1";
break;
case "E57":
sound = "E57_1";
break;
case "E69":
sound = "E69_1";
break;
}
if (sound != 0) core.playSound(sound + ".ogg");
}//敌怪受伤音效
this.enemyhitsound = function (enemy) {
var sound = 0;
switch (enemy) {
case "E9":
case "E13":
case "E17":
var r1 = core.rand2(2) + 2;
sound = "E9_" + r1;
break;
case "E21":
var r1 = core.rand2(4) + 2;
sound = "E21_" + r1;
break;
case "E25":
case "E29":
var r1 = core.rand2(2) + 2;
sound = "E25_" + r1;
break;
case "E37":
var r1 = core.rand2(2) + 2;
sound = "E37_" + r1;
break;
case "E41":
var r1 = core.rand2(3) + 2;
sound = "E41_" + r1;
break;
case "E53":
var r1 = core.rand2(3) + 2;
sound = "E53_" + r1;
break;
case "E57":
var r1 = core.rand2(3) + 2;
sound = "E57_" + r1;
break;
case "E69":
var r1 = core.rand2(2) + 2;
sound = "E69_" + r1;
break;
}
if (sound != 0) core.playSound(sound + ".ogg");
}//敌怪移动音效
this.enemymovesound = function (enemy) {
var sound = 0;
switch (enemy) {
case "E1":
case "E5":
var r1 = core.rand2(4) + 1;
sound = "E1_" + r1;
break;
case "E9":
case "E13":
case "E17":
var r1 = core.rand2(3) + 4;
sound = "E9_" + r1;
break;
case "E21":
case "E29":
sound = "E21_6";
break;
case "E33":
var r1 = core.rand2(4) + 2;
sound = "E33_" + r1;
break;
case "E37":
var r1 = core.rand2(5) + 4;
sound = "E37_" + r1;
break;
case "E45":
var r1 = core.rand2(2) + 2;
sound = "E45_" + r1;
break;
case "E53":
var r1 = core.rand2(3) + 5;
sound = "E53_" + r1;
break;
case "E57":
var r1 = core.rand2(4) + 5;
sound = "E57_" + r1;
break;
case "E69":
var r1 = core.rand2(2) + 4;
sound = "E69_" + r1;
break;
}
if (sound != 0) core.playSound(sound + ".ogg");
}
},
"24-跳字": function () {
this.tiaozi = function (neirong, yanse, x, y) { //跳字
if (!core.status.replay.replaying) {
var shangsheng = 1;
var gaodu = 0;
var tiaozizhong = 0;
var name = "tiaozi" + Math.floor(Math.random() * 1000000); //如不需要连续跳字可不加随机数
core.createCanvas(name, (x - 1) * 32 + 8 - core.bigmap.offsetX, (y - 1) * 32 + gaodu - core.bigmap.offsetY, 96, 64, 74);
core.fillText(name, neirong, 32, 32, yanse, "bold 17px Verdana");
var fade = setInterval(function () {
if (gaodu >= -6 && shangsheng == 1) {
gaodu = gaodu - 1;
if (gaodu == -6) { shangsheng = 0 }
} else if (gaodu <= 12) {
gaodu = gaodu + 1;
if (gaodu == 12) { tiaozizhong = 1; }
}
core.relocateCanvas(name, (x - 1) * 32 + 8 - core.bigmap.offsetX, (y - 1) * 32 + gaodu - core.bigmap.offsetY);
if (tiaozizhong == 1) {
delete core.animateFrame.asyncId[fade];
clearInterval(fade);
core.deleteCanvas(name);
}
}, 16);
core.animateFrame.asyncId[fade] = true;
}
}
},
"25-植物生长": function () {
this.plantgrow = function (cr) {
if (!flags.crops[cr]) return;
if (flags.crops[cr][1] >= flags.crops[cr][2]) {
core.setBlock(flags.cropslist[flags.crops[cr][0]][1][1], parseInt(cr.substr(0, 3)), parseInt(cr.substr(3, 3)), cr.substr(6));
delete flags.crops[cr];
return;
}
setTimeout(function () {
if (!flags.crops[cr]) return;
flags.crops[cr][1] += core.rand2(21) + flags.extraGrow;
core.plugin.plantgrow(cr);
}, 10000);
}
},
"26-自动农田": function () {
this.zidongnongtian = function () {
//自动农田
flags.farmUI = 1;
flags.interface = "锁定";
core.drawImage("uievent", "nongtian.png", 0, 0, 416, 416);
if (flags.farmland2[flags.box_xy][1] < 10) {
core.ui._uievent_drawTextContent({ ctx: "uievent", text: (flags.farmland2[flags.box_xy][1] + "级" + "->" + (flags.farmland2[flags.box_xy][1] + 1) + "级"), left: 166, top: 160, maxWidth: 224, fontSize: 15, color: "black", align: "center" });
} else {
core.ui._uievent_drawTextContent({ ctx: "uievent", text: ("10级"), left: 166, top: 160, maxWidth: 224, fontSize: 15, color: "black", align: "center" });
}
core.ui._uievent_drawTextContent({ ctx: "uievent", text: (flags.farmland1[flags.farmland2[flags.box_xy][0]][flags.farmland2[flags.box_xy][1] - 1 + 10]), left: 166, top: 200, maxWidth: 224, fontSize: 15, color: "black", align: "center" });
core.ui._uievent_drawTextContent({ ctx: "uievent", text: (flags.farmland1[flags.farmland2[flags.box_xy][0]][flags.farmland2[flags.box_xy][1] - 1 + 20]), left: 166, top: 220, maxWidth: 224, fontSize: 15, color: "black", align: "center" });
core.ui._uievent_drawTextContent({ ctx: "uievent", text: (flags.farmland1[flags.farmland2[flags.box_xy][0]][flags.farmland2[flags.box_xy][1] - 1 + 30]), left: 166, top: 240, maxWidth: 224, fontSize: 15, color: "black", align: "center" });
core.fillText("uievent", "(铜币:" + flags.farmland1[flags.farmland2[flags.box_xy][0]][flags.farmland2[flags.box_xy][1] - 1] + "", 230, 284, "black", ui.prototype._buildFont(15, false), 120);
core.fillText("uievent", flags.crops[flags.box_xy][1] + "/" + flags.crops[flags.box_xy][2], 110, 200, "black", ui.prototype._buildFont(15, false), 120);
core.fillText("uievent", "存储位1" + flags.farmland2[flags.box_xy][2], 100, 240, "black", ui.prototype._buildFont(15, false), 120);
core.fillText("uievent", "存储位2" + flags.farmland2[flags.box_xy][3], 100, 260, "black", ui.prototype._buildFont(15, false), 120);
// 120 292 48 24 224, 292, 48, 24 288, 292, 48, 24
}
},
"27-伤害计算": function () {
this.makehurt = function (x, y, dir) {
if (flags.property.atkSpeed[1] == 1) {
flags.property.atkSpeed[1] = 0;
var sound1 = "attack1.ogg";
for (var we in flags.weapon) {
if (core.getEquip(0) == we) {
switch (flags.weapon[we][4]) {
case 2:
sound1 = "attack2.ogg";
break;
case 3:
sound1 = "attack3.ogg";
break;
}
break;
}
}
core.playSound(sound1);
if (core.getEquip(0) != "I614") {
if (dir == 1) {
core.drawAnimate("atk_u", core.status.hero.loc.x, core.status.hero.loc.y);
} else if (dir == 2) {
core.drawAnimate("atk_r", core.status.hero.loc.x, core.status.hero.loc.y);
} else if (dir == 3) {
core.drawAnimate("atk_d", core.status.hero.loc.x, core.status.hero.loc.y);
} else if (dir == 4) {
core.drawAnimate("atk_l", core.status.hero.loc.x, core.status.hero.loc.y);
}
}
var id = core.getBlockInfo(core.getBlockNumber(x, y)).id;
var eid = (x * 1000 + y).toString().padStart(6, '0') + core.status.floorId;
var damage = 1;
var atk = core.status.hero.atk;
var atkSea = flags.property.atkSea;
var atkFly = flags.property.atkFly;
var igdef1 = flags.property.igdef1;
var igdef2 = flags.property.igdef2;
var crit = flags.property.crit;
if (flags.enemyGuide[id] == undefined) {
var n = 0;
do {
var E = id.slice(0, 1);
var en = Number(id.slice(1, 5));
if (flags.enemyGuide[E + (en - 1)] != undefined) {
id = E + (en - 1);
break;
}
n += 1;
if (n >= 3) {
id = "E1";
break;
}
} while (flags.enemyGuide[id] == undefined);
}
var Edef = flags.enemyGuide[id][0][2];
if (flags.worldlevel <= 3) {
Edef *= 2;
} else if (flags.worldlevel <= 7) {
Edef *= 15;
} else {
Edef *= 25;
}
Edef = Math.round(Edef);
var Etype = core.enemys.enemys[id].type;
if (igdef1 == 0 || igdef1 > 1) {
if (Etype == 0) {
damage = (atk - Edef) * crit + igdef1;
} else if (Etype == 1) {
damage = (atk + atkSea - Edef) * crit + igdef1;
} else if (Etype == 2) {
damage = (atk + atkFly - Edef) * crit + igdef1;
}
if (igdef2 != 0) {
for (var i = -1; i < 2; i++) {
for (var j = -1; j < 2; j++) {
if (core.getBlockCls(x + i, y + j) == "enemys" ||
core.getBlockCls(x + i, y + j) == "enemy48") {
if (i != 0 || j != 0) {
//var id1 = core.getBlockInfo(core.getBlockNumber(x + i, y + j)).id;
var id1 = ((x + i) * 1000 + y + j).toString().padStart(6, '0') + core.status.floorId;
flags.enemylist[id1].hp -= igdef2;
if (flags.enemylist[id1].hp <= 0) {
core.plugin.delenemy(id1, 1);
}
core.plugin.tiaozi(igdef2, "#ecf127", x + i, y + j);
}
}
}
}
}
} else {
damage = atk * crit;
}
damage = Math.max(1, damage);
if (core.getEquip(0) == "I614") {
if (core.itemCount("I615") > 0) {
core.addItem("I615", -1);
} else {
damage = 1;
}
}
flags.enemylist[eid].hp -= damage;
if (flags.enemylist[eid].hp <= 0) {
core.plugin.delenemy(eid, 1);
} else {
core.plugin.enemyhitsound(id);
}
core.plugin.atkSpeedBar(0);
if (crit > 1) core.plugin.tiaozi(damage, "#c1180b", x, y);
else core.plugin.tiaozi(damage, "#ecf127", x, y);
core.plugin.reduceDur("wea");
core.plugin.reduceDur("tool");
core.plugin.baoshidu(1);
flags.rightstatus = ["敌怪", eid];
}
if (flags.property.atkSpeed[1] == 0 && flags.property.atkSpeed[2] == 0) {
flags.property.atkSpeed[2] = 1;
setTimeout(function () {
flags.property.atkSpeed[1] = 1;
flags.property.atkSpeed[2] = 0;
}, (flags.property.atkSpeed[0] - 110) / -20 * 1000);
}
}
this.gethurt = function (po, ex, ey) {
var rand1 = core.rand2(3);
if (rand1 == 0) {
core.playSound("hit1.ogg");
} else if (rand1 == 1) {
core.playSound("hit2.ogg");
} else if (rand1 == 2) {
core.playSound("hit3.ogg");
}
var undead = flags.property.undead;
if (undead == 1) return;
var id = flags.enemylist[po].id;
var Edamage = 1;
var ErealHurt = flags.enemyGuide[id][0][8];
var Eatk = flags.enemyGuide[id][0][1];
if (flags.worldlevel <= 3) {
Eatk *= 8;
} else if (flags.worldlevel <= 7) {
Eatk *= 24;
} else {
Eatk *= 40;
}
Eatk = Math.round(Eatk);
var Erange = flags.enemyGuide[id][0][5];
var def = core.status.hero.def;
var reduceDa = flags.property.reduceDa;
var reduceBoom = flags.property.reduceBoom;
var reduceBul = flags.property.reduceBul;
var backDa = flags.property.backDa;
if (ErealHurt == 1) {
Edamage = Eatk;
} else {
if (id == "E25" || id == "E29") {
Edamage = (Eatk - def) * (1 - reduceBoom - reduceDa);
} else if (Erange > 1) {
Edamage = (Eatk - def) * (1 - reduceBul - reduceDa);
} else {
Edamage = (Eatk - def) * (1 - reduceDa);
}
}
core.status.hero.hp -= Math.max(1, Edamage);
if (backDa != 0) {
flags.enemylist[po].hp -= backDa;
core.plugin.tiaozi(backDa, "#ecf127", ex, ey);
if (flags.enemylist[po].hp <= 0) {
core.plugin.delenemy(po, 1);
}
}
core.plugin.hpBar(2);
core.plugin.reduceDur("equ", Math.max(1, Edamage));
core.plugin.siwangjiance();
}
},
"28-角色状态": function () {
//绘制血条
this.hpBar = function (state = 0, time = 0) {
//state状态1为治疗2为受伤3为刷新
var ctx = "hpbar";
var heartpic = [];
var goldheartpic = ["goldheart.png", "goldheart3.png", "goldheart2.png", "goldheartw.png", "goldheartw3.png", "goldheartw2.png"];
if (flags.buff["凋零"] > 0) {
heartpic = ["blackheart.png", "blackheart3.png", "blackheart2.png", "blackheartw.png", "blackheartw3.png", "blackheartw2.png"];
} else if (flags.buff["中毒"] > 0) {
heartpic = ["greenheart.png", "greenheart3.png", "greenheart2.png", "greenheartw.png", "greenheartw3.png", "greenheartw2.png"];
} else {
heartpic = ["heart.png", "heart3.png", "heart2.png", "heartw.png", "heartw3.png", "heartw2.png"];
}
if (core.getContextByName(ctx) == null) {
for (var i = 1; i < 21; i++) {
core.createCanvas(ctx + i, 64 + ((i - 1) * 13) - (130 * Math.floor((i - 1) / 10)), 361 - (14 * Math.floor((i - 1) / 10)), 14, 14, 101);
}
}
function showheart(whole, half, empty, whole1, half1, empty1,) {
for (var i = 1; i < 21; i++) {
core.clearMap(ctx + i);
}
var hp = core.status.hero.hp;
var hpmax = core.status.hero.hpmax;
for (var i = 1; i < 21; i++) {
var pic = empty;
if (hp >= 2 && hpmax >= 2) {
pic = whole;
hp -= 2;
hpmax -= 2;
} else if (hp >= 1 && hpmax >= 2) {
pic = half;
hp -= 1;
hpmax -= 2;
} else if (hp == 0 && hpmax >= 2) {
pic = empty;
hpmax -= 2;
} else {
pic = "";
}
core.drawImage(ctx + i, pic, 0, 0);
}
if (hp > 0) {
for (var i = 1; i < 21; i++) {
var pic = empty1;
if (hp >= 2 && hpmax >= 2) {
pic = whole1;
hp -= 2;
hpmax -= 2;
} else if (hp >= 1 && hpmax >= 2) {
pic = half1;
hp -= 1;
hpmax -= 2;
} else if (hp == 0 && hpmax >= 2) {
pic = "";
hpmax -= 2;
} else {
pic = "";
}
core.drawImage(ctx + i, pic, 0, 0);
}
}
}
function showlight(i) {
if (i <= 0) return;
setTimeout(function () {
showheart(heartpic[3], heartpic[4], heartpic[5], goldheartpic[3], goldheartpic[4], goldheartpic[5]);
setTimeout(function () {
showheart(heartpic[0], heartpic[1], heartpic[2], goldheartpic[0], goldheartpic[1], goldheartpic[2]);
showlight(i - 1);
}, 100);
}, 100);
}
function jumpheart1(num, a, b, rate) {
var end = 0;
var gaodu = 0;
var up = 1;
var jump = setInterval(function () {
if (gaodu >= a && up == 1) {
gaodu = gaodu - 1;
if (gaodu == a) up = 0;
} else if (gaodu <= b) {
gaodu = gaodu + 1;
if (gaodu == b) end = 1;
}
core.relocateCanvas(ctx + num, 64 + ((num - 1) * 13) - (130 * Math.floor((num - 1) / 10)), 361 - (14 * Math.floor((num - 1) / 10)) + gaodu);
if (end == 1) {
clearInterval(jump);
}
}, rate);
}
function jumpheart2(i) {
if (i > 20) {
setTimeout(function () {
time -= 1000;
if (time > 0) jumpheart2(1);
else core.plugin.buffma("生命恢复", 0);
}, 1000);
return;
}
setTimeout(function () {
jumpheart1(i, -6, 0, 3);
jumpheart2(i + 1);
}, 40);
}
function jumpheart3(arr = []) {
if (core.status.hero.hp / core.status.hero.hpmax > 0.2 || flags.buff["生命恢复"] > 0) {
flags.dying = 0;
return;
}
setTimeout(function () {
if (arr.length == 0) arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
var i = core.rand2(arr.length);
jumpheart1(arr[i], -3, 1, 12);
arr.splice(i, 1);
jumpheart3(arr);
}, 100);
}
showheart(heartpic[0], heartpic[1], heartpic[2], goldheartpic[0], goldheartpic[1], goldheartpic[2]);
if (flags.buff["生命恢复"] > 0 && time != 0) {
jumpheart2(1);
} else if (state != 3 && core.status.hero.hp / core.status.hero.hpmax <= 0.2 && flags.dying == 0) {
flags.dying = 1;
jumpheart3();
}
if (state == 1 && core.rand2(3) == 0) {
showlight(core.rand2(3) + 2);
} else if (state == 2) {
showlight(1);
}
}//绘制经验条
this.expBar = function () {
var ctx = "expbar";
if (core.getContextByName(ctx) == null) {
core.createCanvas(ctx, 0, 0, 416, 416, 101);
} else {
core.clearMap(ctx);
}
core.setAlpha(ctx, 0.6);
core.fillRoundRect(ctx, 64, 375, 288, 5, 3, "#2b2b2b");
core.fillRoundRect(ctx, 64, 375, Math.max(4, ((flags.level[1] / flags.level[2]) * 288)), 5, 3, "#0bef15");
core.drawTextContent(
ctx,
flags.level[0].toString(),
{ left: 158, top: 358, color: "white", fontSize: 15, maxWidth: 100, align: "center" }
);
}//绘制饥饿条
this.hungerBar = function () {
var ctx = "hungerbar";
var hungerpic = ["hunger.png", "hunger3.png", "hunger2.png", "hungerw.png", "hungerw3.png", "hungerw2.png"];
if (core.getContextByName(ctx) == null) {
for (var i = 11; i > 1; i--) {
core.createCanvas(ctx + (12 - i), 210 + ((i - 1) * 13), 361, 14, 14, 101);
}
} else {
for (var i = 1; i < 11; i++) {
core.clearMap(ctx + i);
}
}
function showhunger(n, whole, half, empty) {
var hunger;
if (flags.hunger[0] > 100 && n == 1) {
hunger = 100;
}
else {
hunger = flags.hunger[0] % 100;
if (hunger == 0) hunger = 100;
}
for (var i = 1; i < 11; i++) {
var pic = empty;
if (hunger <= 0) {
pic = empty;
}
else if (hunger > 0 && hunger <= 5) {
pic = half;
hunger -= 5;
} else if (hunger > 5) {
pic = whole;
hunger -= 10;
}
core.drawImage(ctx + i, pic, 0, 0);
}
}
showhunger(1, hungerpic[0], hungerpic[1], hungerpic[2]);
if (flags.hunger[0] / 100 > 1) showhunger(2, hungerpic[3], hungerpic[4], hungerpic[5]);
}//显示角色攻击范围
this.atkRange = function () {
if (flags.playerAr == 1 && !core.isMoving()) {
if (core.getContextByName("fw1") == null) {
core.createCanvas("fw1", 0, 0, 416, 416, 100);
} else {
core.clearMap('fw1');
}
if (core.status.hero.loc.x < 6 ||
core.status.hero.loc.y < 6 ||
core.status.hero.loc.x > core.bigmap.width - 6 ||
core.status.hero.loc.y > core.bigmap.width - 6) {
core.strokeRect("fw1",
(core.status.hero.loc.x - flags.property.touchRange[0]) * 32 - Math.round(core.bigmap.offsetX / 32) * 32,
(core.status.hero.loc.y - flags.property.touchRange[0]) * 32 - Math.round(core.bigmap.offsetY / 32) * 32,
(flags.property.touchRange[0] * 2 + 1) * 32,
(flags.property.touchRange[0] * 2 + 1) * 32, "yellow", 1);
} else {
core.strokeRect("fw1",
32 * (6 - flags.property.touchRange[0]),
32 * (6 - flags.property.touchRange[0]),
(flags.property.touchRange[0] * 2 + 1) * 32,
(flags.property.touchRange[0] * 2 + 1) * 32, "yellow", 1);
}
} else {
core.deleteCanvas("fw1");
}
}//显示角色攻速条
this.atkSpeedBar = function (bar) {
if (flags.property.atkSpeed[1] == 0) {
if (core.getContextByName("gst1") == null) {
core.createCanvas("gst1", 56, 384, 4, 30, 100);
} else {
core.clearMap('gst1');
}
core.fillRect("gst1", 0, 0, 4, 30, "#fffe61");
core.fillRect("gst1", 0, 0, 4, 30 - ((bar / ((flags.property.atkSpeed[0] - 110) / -20 * 1000)) * 30), "#2b2b2b");
} else {
core.deleteCanvas("gst1");
return;
}
setTimeout(function () {
bar += 100;
if (bar < ((flags.property.atkSpeed[0] - 110) / -20 * 1000)) {
core.plugin.atkSpeedBar(bar);
} else {
core.clearMap('gst1');
}
}, 100);
}//绘制呼吸值
this.breBar = function () {
if (flags.breathe[0] <= 0 || flags.breathe[0] == flags.breathe[1]) {
var ctx = "brebar";
for (var i = 1; i < 11; i++) {
core.clearMap(ctx + i);
}
return;
}
var ctx = "brebar";
var pic = "breathe.png";
if (core.getContextByName(ctx) == null) {
for (var i = 11; i > 1; i--) {
core.createCanvas(ctx + (12 - i), 210 + ((i - 1) * 13), 361 - 14, 14, 14, 101);
}
} else {
for (var i = 1; i < 11; i++) {
core.clearMap(ctx + i);
}
}
var bre = flags.breathe[0];
for (var i = 1; i < 11; i++) {
if (bre > 0) {
bre -= 1;
core.drawImage(ctx + i, pic, 0, 0);
}
}
}//脚步声
this.step = function () {
if (flags.step == 2) {
flags.step = 0;
} else {
flags.step += 1;
return;
}
var { x, y } = core.status.hero.loc;
var number1 = core.getBgNumber(x, y);
if (!number1) return;
var type = core.getBlockInfo(number1).blocktype;
if (type == 1 || type == 6) {
if (number1 == 910) {
var sound = "lava.ogg";
core.playSound(sound);
} else if (number1 == 345 || number1 == 348) {
var rand1 = core.rand2(4);
var sound = "step_swim1.ogg";
switch (rand1) {
case 0:
sound = "step_swim1.ogg";
break;
case 1:
sound = "step_swim2.ogg";
break;
case 2:
sound = "step_swim3.ogg";
break;
case 3:
sound = "step_swim4.ogg";
break;
}
core.playSound(sound);
} else {
var rand1 = core.rand2(6);
var sound = "step_stone1.ogg";
switch (rand1) {
case 0:
sound = "step_stone1.ogg";
break;
case 1:
sound = "step_stone2.ogg";
break;
case 2:
sound = "step_stone3.ogg";
break;
case 3:
sound = "step_stone4.ogg";
break;
case 4:
sound = "step_stone5.ogg";
break;
case 5:
sound = "step_stone6.ogg";
break;
}
core.playSound(sound);
}
} else if (type == 2) {
var rand1 = core.rand2(6);
var sound = "step_wood1.ogg";
switch (rand1) {
case 0:
sound = "step_wood1.ogg";
break;
case 1:
sound = "step_wood2.ogg";
break;
case 2:
sound = "step_wood3.ogg";
break;
case 3:
sound = "step_wood4.ogg";
break;
case 4:
sound = "step_wood5.ogg";
break;
case 5:
sound = "step_wood6.ogg";
break;
}
core.playSound(sound);
} else if (type == 3) {
if (number1 == 349) { //沙砾
var rand1 = core.rand2(4);
var sound = "step_gravel1.ogg";
switch (rand1) {
case 0:
sound = "step_gravel1.ogg";
break;
case 1:
sound = "step_gravel2.ogg";
break;
case 2:
sound = "step_gravel3.ogg";
break;
case 3:
sound = "step_gravel4.ogg";
break;
}
core.playSound(sound);
} else if (number1 == 342) { //雪
var rand1 = core.rand2(4);
var sound = "";
switch (rand1) {
case 0:
sound = "step_snow1.ogg";
break;
case 1:
sound = "step_snow2.ogg";
break;
case 2:
sound = "step_snow3.ogg";
break;
case 3:
sound = "step_snow4.ogg";
break;
}
core.playSound(sound);
} else if (number1 == 343 || number1 == 344) { //沙子
var rand1 = core.rand2(5);
var sound = "";
switch (rand1) {
case 0:
sound = "step_sand1.ogg";
break;
case 1:
sound = "step_sand2.ogg";
break;
case 2:
sound = "step_sand3.ogg";
break;
case 3:
sound = "step_sand4.ogg";
break;
case 4:
sound = "step_sand5.ogg";
break;
}
core.playSound(sound);
} else { //草地和其他
var rand1 = core.rand2(6);
var sound = "step_grass1.ogg";
switch (rand1) {
case 0:
sound = "step_grass1.ogg";
break;
case 1:
sound = "step_grass2.ogg";
break;
case 2:
sound = "step_grass3.ogg";
break;
case 3:
sound = "step_grass4.ogg";
break;
case 4:
sound = "step_grass5.ogg";
break;
case 5:
sound = "step_grass6.ogg";
break;
}
core.playSound(sound);
}
}
}
},
"29-buff管理": function () {
this.buffma = function (buff, time) {
flags.buff[buff] = time;
if (time <= 0) return;
switch (buff) {
case "生命恢复":
core.plugin.hpBar(0, time);
break;
case "中毒":
core.plugin.hpBar(0, time);
setTimeout(function () {
flags.buff[buff] = 0;
core.plugin.hpBar(0, time);
}, time);
break;
case "凋零":
core.plugin.hpBar(0, time);
setTimeout(function () {
flags.buff[buff] = 0;
core.plugin.hpBar(0, time);
}, time);
break;
}
}
},
"30-右侧状态栏扩展": function () {
// 使用了古祠佬的sprite化插件(有微改) 拓展栏内容请下拉 看注释操作
// 已经用了sprite插件可以只把拓展栏部分放到sprite插件下面
// 基于canvas的sprite化摘编整理自万宁魔塔
//
// ---------------------------------------- 第一部分 js代码 --------------------------------------- //
/* ---------------- ---------------- *
* 1. 创建sprite: var sprite = new Sprite(x, y, w, h, z, reference, name);
* 其中x y w h为画布的横纵坐标及长宽reference为参考系只能填game相对于游戏画面和window相对于窗口
* 且当为相对游戏画面时长宽与坐标将会乘以放缩比例相当于用createCanvas创建
* z为纵深表示不同元素之间的覆盖关系大的覆盖小的
* name为自定义名称可以不填
* 2. 删除: sprite.destroy();
* 3. 设置css特效: sprite.setCss(css);
* 其中css直接填 box-shadow: 0px 0px 10px black;的形式即可与style标签与css文件内写法相同
* 对于已设置的特效如果之后不需要再次设置可以不填
* 4. 添加事件监听器: sprite.addEventListener(); 用法与html元素的addEventListener完全一致
* 5. 移除事件监听器: sprite.removeEventListener(); 用法与html元素的removeEventListener完全一致
* 6. 属性列表
* (1) sprite.x | sprite.y | sprite.width | sprite.height | sprite.zIndex | sprite.reference 顾名思义
* (2) sprite.canvas 该sprite的画布
* (3) sprite.context 该画布的CanvasRenderingContext2d对象即样板中常见的ctx
* (4) sprite.count 不要改这个玩意
* 7. 使用样板api进行绘制
* 示例
* var ctx = sprite.context;
* core.fillText(ctx, 'xxx', 100, 100);
* core.fillRect(ctx, 0, 0, 50, 50);
* 当然也可以使用原生js
* ctx.moveTo(0, 0);
* ctx.bezierCurveTo(50, 50, 100, 0, 100, 50);
* ctx.stroke();
* ---------------- 用法说明 ---------------- */
var count = 0;
/** sprite
* @param {number} x
* @param {number} y
* @param {number} w
* @param {number} h
* @param {number} z
* @param {'game' | 'window'} reference 参考系游戏画面或者窗口
* @param {string} name 可选sprite的名称方便通过core.dymCanvas获取
*/
function Sprite(x, y, w, h, z, reference, name) {
this.x = x;
this.y = y;
this.width = w;
this.height = h;
this.zIndex = z;
this.reference = reference;
this.canvas = null;
this.context = null;
this.count = 0;
this.name = name;
/** 初始化 */
this.init = function () {
if (reference === 'window') {
var canvas = document.createElement('canvas');
this.canvas = canvas;
this.context = canvas.getContext('2d');
canvas.width = devicePixelRatio * w * core.domStyle.scale;
// canvas.width = w;
canvas.height = devicePixelRatio * h * core.domStyle.scale;
// canvas.height = h;
//canvas.style.width = w * core.domStyle.scale + 'px';
canvas.style.width = w * core.domStyle.scale + 'px';
//canvas.style.height = h * core.domStyle.scale + 'px';
canvas.style.height = h * core.domStyle.scale + 'px';
canvas.style.position = 'absolute';
canvas.style.top = y + 'px';
canvas.style.left = x + 'px';
canvas.style.zIndex = z.toString();
document.body.appendChild(canvas);
} else {
this.context = core.createCanvas(this.name || '_sprite_' + count, x, y, w, h, z);
this.canvas = this.context.canvas;
this.count = count;
this.canvas.style.pointerEvents = 'auto';
count++;
}
}
this.init();
/** css
* @param {string} css
*/
this.setCss = function (css) {
css = css.replace('\n', ';').replace(';;', ';');
var effects = css.split(';');
var self = this;
effects.forEach(function (v) {
var content = v.split(':');
var name = content[0];
var value = content[1];
name = name.trim().split('-').reduce(function (pre, curr, i, a) {
if (i === 0 && curr !== '') return curr;
if (a[0] === '' && i === 1) return curr;
return pre + curr.toUpperCase()[0] + curr.slice(1);
}, '');
var canvas = self.canvas;
if (name in canvas.style) canvas.style[name] = value;
});
return this;
}
/**
* 移动sprite
* @param {boolean} isDelta 是否是相对位置如果是那么sprite会相对于原先的位置进行移动
*/
this.move = function (x, y, isDelta) {
if (x !== undefined && x !== null) this.x = x;
if (y !== undefined && y !== null) this.y = y;
if (this.reference === 'window') {
var ele = this.canvas;
ele.style.left = x + (isDelta ? parseFloat(ele.style.left) : 0) + 'px';
ele.style.top = y + (isDelta ? parseFloat(ele.style.top) : 0) + 'px';
} else core.relocateCanvas(this.context, x, y, isDelta);
return this;
}
/**
* 重新设置sprite的大小
* @param {boolean} styleOnly 是否只修改css效果如果是那么将会不高清如果不是那么会清空画布
*/
this.resize = function (w, h, styleOnly) {
if (w !== undefined && w !== null) this.w = w;
if (h !== undefined && h !== null) this.h = h;
if (reference === 'window') {
var ele = this.canvas;
ele.style.width = w + 'px';
ele.style.height = h + 'px';
if (!styleOnly) {
ele.width = w;
ele.height = h;
}
} else core.resizeCanvas(this.context, x, y, styleOnly);
return this;
}
/** 删除 */
this.destroy = function () {
if (this.reference === 'window') {
if (this.canvas) document.body.removeChild(this.canvas);
} else {
core.deleteCanvas(this.name || '_sprite_' + this.count);
}
}
/** 添加事件监听器 */
this.addEventListener = function () {
this.canvas.addEventListener.apply(this.canvas, arguments);
}
/** 移除事件监听器 */
this.removeEventListener = function () {
this.canvas.removeEventListener.apply(this.canvas, arguments);
}
}
window.Sprite = Sprite;
/* ---------- *
* 在玩家有可能拉伸或放缩的情况下拓展栏大小与游戏界面大小(指不包括拓展栏包括状态栏工具栏和地图)按某个比例相关
* 这个比例 = 拓展栏的宽或高 : 游戏界面的宽或高
* 横屏下默认宽度比为0.237(相当于与状态栏等宽 约151px) 高度等于1(即与游戏界面等高)
* 竖屏的话默认宽度比为1 高为0.055(缩放比例1的设置下约等于36px意为比一格略大)
* 过宽或过高玩家有可能遇到显示不全的问题
* 游戏过程中需要动态变化请使用extend.resetScale(type, w, h)
* type=1代表横屏 =2代表竖屏 如extend.resetScale(2, 1, 0.11)将拓展栏高度在竖屏下变为默认值的两倍
* 如果更改完这里的值读档拓展栏大小不变 请手动resetScale一下
* -----拓展栏说明----- */
var scale = { // 需要改的有三个地方 这里的scale影响拓展栏大小
hpos: { // 横屏
width: 0.237,
height: 1
},
vpos: { // 竖屏
width: 1,
height: 0.165
}
}
function makedamage(po) {
var id = flags.enemylist[po].id;
var damage = 1;
var atk = core.status.hero.atk;
var atkSea = flags.property.atkSea;
var atkFly = flags.property.atkFly;
var igdef1 = flags.property.igdef1;
var crit = flags.property.crit;
var Edef = flags.enemyGuide[id][0][2];
if (flags.worldlevel <= 3) {
Edef *= 2;
} else if (flags.worldlevel <= 7) {
Edef *= 15;
} else {
Edef *= 25;
}
Edef = Math.round(Edef);
var Etype = core.enemys.enemys[id].type;
if (igdef1 == 0 || igdef1 > 1) {
if (Etype == 0) {
damage = (atk - Edef) * crit + igdef1;
} else if (Etype == 1) {
damage = (atk + atkSea - Edef) * crit + igdef1;
} else if (Etype == 2) {
damage = (atk + atkFly - Edef) * crit + igdef1;
}
} else {
damage = atk * crit;
}
if (core.getEquip(0) == "I614" && core.itemCount("I615") <= 0) {
damage = 1;
}
return Math.ceil(flags.enemylist[po].hp / Math.max(1, damage));
}
function getdamage(po) {
var id = flags.enemylist[po].id;
var Edamage = 1;
var ErealHurt = flags.enemyGuide[id][0][8];
var Eatk = flags.enemyGuide[id][0][1];
if (flags.worldlevel <= 3) {
Eatk *= 8;
} else if (flags.worldlevel <= 7) {
Eatk *= 24;
} else {
Eatk *= 40;
}
Eatk = Math.round(Eatk);
var Erange = flags.enemyGuide[id][0][5];
var def = core.status.hero.def;
var reduceDa = flags.property.reduceDa;
var reduceBoom = flags.property.reduceBoom;
var reduceBul = flags.property.reduceBul;
if (ErealHurt == 1) {
Edamage = Eatk;
} else {
if (id == "E440" || id == "E441") {
Edamage = (Eatk - def) * (1 - reduceBoom - reduceDa);
} else if (Erange > 1) {
Edamage = (Eatk - def) * (1 - reduceBul - reduceDa);
} else {
Edamage = (Eatk - def) * (1 - reduceDa);
}
}
return Math.ceil(core.status.hero.hpmax / Math.max(1, Edamage));
}
function update() {
if (extend.values.hidden) return;
var ctx = extend.context,
canvas = extend.canvas;
var width = canvas.width,
height = canvas.height;
ctx.clearRect(0, 0, width, height);
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.scale(devicePixelRatio * core.domStyle.scale, devicePixelRatio * core.domStyle.scale);
if (!canvas.style.background) canvas.style.background = 'url("project/materials/wood1.png") repeat';
// 背景设置
//if (flags.dimension == undefined) flags.dimension = ["主世界", "地表"];
// if (flags.dimension[0] == "主世界" && flags.dimension[1] == "地表") {
// canvas.style.background = 'url("project/materials/wood1.png") repeat';
// } else if (flags.dimension[0] == "主世界" && flags.dimension[1] == "洞穴") {
// canvas.style.background = 'url("project/materials/stone1.png") repeat';
// }
//extend.setBorder(); // 注释这句可以删掉边框
var ctx, fill = function (text, x, y, style, strokeStyle, font, maxWidth) {
core.ui.setFont(ctx, (/\w+/.test(text) ? 'italic ' : '') + 'bold 12px Verdana');
core.ui.fillBoldText(ctx, text, x, y, style, strokeStyle, font, maxWidth);
};
if (!core.domStyle.isVertical) { // 横屏
//图块信息展示
core.setAlpha(ctx, 0.6);
core.fillRoundRect(ctx, 4, 4, 122, 70, 3, "#6198ff");
core.setAlpha(ctx, 1);
if (!flags.rightstatus) flags.rightstatus = ["", ""];
if (flags.rightstatus[0] == "图块") {
//图块信息
core.drawIcon(ctx, flags.rightstatus[1], 8, 10, 20, 20);
//图块名称
var inf = core.getBlockInfo(flags.rightstatus[1]);
fill(inf.name, 32, 24, "white", "", ui.prototype._buildFont(12, false), 100);
//挖掘信息
var lx = inf.blocktype;
var yd = inf.hardness;
var num = 0;
var dig1 = 0;
for (var to in flags.tool) {
if (core.getEquip(0) == to) {
if (lx == 1 || lx == 2 || lx == 3) {
if (lx == flags.tool[to][2]) {
num = flags.digLevel[lx][flags.tool[to][1]][yd - 1][0];
dig1 = 1;
}
} else if (lx == 4 || lx == 5 || lx == 6) {
num = flags.digLevel[lx][0];
dig1 = 1;
}
break;
}
}
if (dig1 == 0) {
if (lx == 1 || lx == 2 || lx == 3) {
num = flags.digLevel[lx][1][yd - 1][0];
} else if (lx == 4 || lx == 5 || lx == 6) {
num = flags.digLevel[lx][0];
}
}
function dig() {
if (!flags.wfk[flags.rightstatus[1]]) return;
fill("挖掘掉落:", 12, 64, "white", "", ui.prototype._buildFont(10, false), 100);
var n1 = 0;
for (var i = 0; i < flags.wfk[flags.rightstatus[1]].length; i++) {
if (i == 0 && flags.wfk[flags.rightstatus[1]][i][2] != 0) {
core.drawIcon(ctx, flags.wfk[flags.rightstatus[1]][i][0], 60 + (n1 * 22), 50, 20, 20);
n1 += 1;
} else if ((i == 1 && flags.wfk[flags.rightstatus[1]][0][0] != flags.wfk[flags.rightstatus[1]][1][0]) ||
(i == 2 && flags.wfk[flags.rightstatus[1]][0][0] != flags.wfk[flags.rightstatus[1]][2][0]
&& flags.wfk[flags.rightstatus[1]][1][0] != flags.wfk[flags.rightstatus[1]][2][0]
)) {
if (flags.wfk[flags.rightstatus[1]][i][2] != 0) {
core.drawIcon(ctx, flags.wfk[flags.rightstatus[1]][i][0], 60 + (n1 * 22), 50, 20, 20);
n1 += 1;
}
}
}
}
if (num > 0) {
if (flags.rightstatus[2] != undefined) {
fill("生长时间:" + flags.crops[flags.rightstatus[2]][1] + "/" + flags.crops[flags.rightstatus[2]][2],
12, 44, "white", "", ui.prototype._buildFont(10, false), 200);
} else {
fill("挖掘次数:", 12, 44, "white", "", ui.prototype._buildFont(10, false), 100);
fill(num, 64, 44, "#ffb599", "", ui.prototype._buildFont(20, false), 100);
}
dig();
} else {
var n = 0;
dig: for (var i = 2; i < 6; i++) {
if (lx == 1 || lx == 2 || lx == 3) {
if (flags.digLevel[lx][i][yd - 1][0] > 0) {
for (var to in flags.tool) {
if (flags.tool[to][1] == i && flags.tool[to][2] == lx) {
fill("需要:", 12, 44, "white", "", ui.prototype._buildFont(10, false), 100);
core.drawIcon(ctx, to, 40, 34, 14, 14);
fill(core.getBlockInfo(to).name, 56, 44, "white", "", ui.prototype._buildFont(10, false), 100);
dig();
n = 1;
break dig;
}
}
}
} else if (lx == 6) {
break dig;
}
}
if (n == 0) fill("不可挖掘", 12, 44, "white", "", ui.prototype._buildFont(10, false), 100);
}
} else if (flags.rightstatus[0] == "敌怪" && flags.enemylist[flags.rightstatus[1]]) {
//怪物信息
var po = flags.rightstatus[1];
var inf = core.getBlockInfo(flags.enemylist[po].id);
core.drawIcon(ctx, flags.enemylist[po].id, 8, 0, 20, 30);
fill(inf.name, 32, 24, "white", "", ui.prototype._buildFont(12, false), 60);
//危险程度
if (flags.enemyGuide[flags.enemylist[po].id][0][10] &&
flags.enemylist[po].hp == flags.enemylist[po].hpmax) {
fill("中立", 100, 24, "white", "", ui.prototype._buildFont(12, false), 40);
} else if ((!flags.enemyGuide[flags.enemylist[po].id][0][10]) ||
(flags.enemyGuide[flags.enemylist[po].id][0][10] &&
flags.enemylist[po].hp < flags.enemylist[po].hpmax)) {
if (getdamage(po) < 5) {
fill("致命", 100, 24, "#ff5647", "", ui.prototype._buildFont(12, false), 40);
} else if (getdamage(po) < 10) {
fill("危险", 100, 24, "#ffcb47", "", ui.prototype._buildFont(12, false), 40);
} else if (getdamage(po) < 20) {
fill("轻微", 100, 24, "#ffcb47", "", ui.prototype._buildFont(12, false), 40);
} else {
fill("无害", 100, 24, "#f3e03f", "", ui.prototype._buildFont(12, false), 40);
}
}
//击杀所需次数
fill("击杀:", 12, 44, "white", "", ui.prototype._buildFont(10, false), 100);
fill(makedamage(po), 42, 44, "#ffb599", "", ui.prototype._buildFont(20, false), 100);
core.drawIcon(ctx, "I571", 70, 34, 14, 14);
//掉落
fill("击杀掉落:", 12, 64, "white", "", ui.prototype._buildFont(10, false), 100);
var item1 = flags.enemyGuide[flags.enemylist[po].id][1];
var item2 = flags.enemyGuide[flags.enemylist[po].id][2];
if (item1) core.drawIcon(ctx, item1[0], 60, 50, 20, 20);
if (item2) core.drawIcon(ctx, item2[0], 82, 50, 20, 20);
}
//维度、层
core.setAlpha(ctx, 0.6);
core.fillRoundRect(ctx, 2, 80, 127, 240, 3, "#dbdbdb");
core.setAlpha(ctx, 1);
core.drawIcon(ctx, 331, 8, 86, 20, 20);
var text, color1;
if (core.status.event.id == 'viewMaps') {
text = core.status.maps[core.status.event.data.floorId || "MT0"]["title"];
color1 = "yellow";
} else {
text = core.status.maps[core.status.floorId || "MT0"]["title"];
color1 = "white";
}
fill(text, 32, 100, color1, "black", ui.prototype._buildFont(12, false), 90);
//坐标
core.drawIcon(ctx, 306, 8, 108, 20, 20);
if (core.status.event.id == 'viewMaps') {
fill("正在预览...", 32, 122, "yellow", "", ui.prototype._buildFont(12, false), 100);
} else {
fill("( " + " , " + " )", 32, 122, "", "", ui.prototype._buildFont(12, false), 100);
if (core.status.hero.loc.x == Math.floor(core.bigmap.width / 2)) {
fill(core.status.hero.loc.x, 40, 122, "yellow", "", ui.prototype._buildFont(12, false), 100);
} else {
fill(core.status.hero.loc.x, 40, 122, "white", "", ui.prototype._buildFont(12, false), 100);
}
if (core.status.hero.loc.y == Math.floor(core.bigmap.height / 2)) {
fill(core.status.hero.loc.y, 64, 122, "yellow", "", ui.prototype._buildFont(12, false), 100);
} else {
fill(core.status.hero.loc.y, 64, 122, "white", "", ui.prototype._buildFont(12, false), 100);
}
}
for (var i = 0; i < 6; i++) {
core.drawLine(ctx, 6, 136 + (i * 24), 126, 136 + (i * 24));
core.drawLine(ctx, 6 + (i * 24), 136, 6 + (i * 24), 256);
}
//小地图
function floornum(id) {
var floor;
switch (id) {
case "zhu1":
floor = 1;
break;
case "zhu2":
floor = 2;
break;
case "zhu3":
floor = 3;
break;
case "zhu4":
floor = 4;
break;
case "zhu5":
floor = 5;
break;
case "zhu6":
floor = 6;
break;
case "zhu7":
case "dong1":
floor = 7;
break;
case "zhu8":
case "dong2":
floor = 8;
break;
case "zhu9":
case "dong3":
floor = 9;
break;
case "zhu10":
floor = 10;
break;
case "zhu11":
floor = 11;
break;
case "zhu12":
case "dong4":
floor = 12;
break;
case "zhu13":
case "dong5":
floor = 13;
break;
case "zhu14":
case "dong6":
floor = 14;
break;
case "zhu15":
floor = 15;
break;
case "zhu16":
floor = 16;
break;
case "zhu17":
case "dong7":
floor = 17;
break;
case "zhu18":
case "dong8":
floor = 18;
break;
case "zhu19":
case "dong9":
floor = 19;
break;
case "zhu20":
floor = 20;
break;
case "zhu21":
floor = 21;
break;
case "zhu22":
floor = 22;
break;
case "zhu23":
floor = 23;
break;
case "zhu24":
floor = 24;
break;
case "zhu25":
floor = 25;
break;
default:
floor = 13;
break;
}
return floor;
}
core.setAlpha(ctx, 0.6);
core.fillRoundRect(ctx, 8 + (Math.floor((floornum(core.status.floorId) - 1) % 5) * 24),
138 + (Math.floor((floornum(core.status.floorId) - 1) / 5) * 24), 20, 20, 1, "#6bff7a");
if (core.status.event.id == 'viewMaps') {
core.fillRoundRect(ctx, 8 + (Math.floor((floornum(core.status.event.data.floorId) - 1) % 5) * 24) + 2,
138 + (Math.floor((floornum(core.status.event.data.floorId) - 1) / 5) * 24) + 2, 16, 16, 1, "#6198ff");
}
core.setAlpha(ctx, 1);
if (flags.mapicon) {
if (flags.dimension[0] == "主世界" && flags.dimension[1] == "地表") {
for (var i = 1; i < 26; i++) {
var pic = 0;
if (("zhu" + i) in flags.mapicon["zhu"]) {
switch (flags.mapicon["zhu"][("zhu" + i)]) {
case 1:
pic = 932;
break;
case 2:
pic = 933;
break;
case 3:
pic = 934;
break;
case 4:
pic = 935;
break;
}
} else {
pic = 931;
}
if (pic != 0) core.drawIcon(ctx, pic, 8 + (Math.floor((i - 1) % 5) * 24) + 3,
138 + (Math.floor((i - 1) / 5) * 24) + 3, 14, 14);
}
} else if (flags.dimension[0] == "主世界" && flags.dimension[1] == "洞穴") {
for (var i = 1; i < 10; i++) {
var pic = 0;
if (("dong" + i) in flags.mapicon["dong"]) {
switch (flags.mapicon["dong"][("dong" + i)]) {
case 1:
pic = 932;
break;
case 2:
pic = 933;
break;
case 3:
pic = 934;
break;
case 4:
pic = 935;
break;
}
} else {
pic = 931;
}
var ii;
switch (i) {
case 1:
ii = 7;
break;
case 2:
ii = 8;
break;
case 3:
ii = 9;
break;
case 4:
ii = 12;
break;
case 5:
ii = 13;
break;
case 6:
ii = 14;
break;
case 7:
ii = 17;
break;
case 8:
ii = 18;
break;
case 9:
ii = 19;
break;
}
if (pic != 0) core.drawIcon(ctx, pic, 8 + (Math.floor((ii - 1) % 5) * 24) + 3,
138 + (Math.floor((ii - 1) / 5) * 24) + 3, 14, 14);
}
}
}
for (var i = 0; i < 3; i++) {
core.drawLine(ctx, 6, 264 + (i * 24), 126, 264 + (i * 24));
}
for (var i = 0; i < 6; i++) {
core.drawLine(ctx, 6 + (i * 24), 264, 6 + (i * 24), 312);
}
core.drawIcon(ctx, 932, 8 + (24 * 0), 266, 20, 20);
core.drawIcon(ctx, 933, 8 + (24 * 1), 266, 20, 20);
core.drawIcon(ctx, 934, 8 + (24 * 2), 266, 20, 20);
core.drawIcon(ctx, 935, 8 + (24 * 3), 266, 20, 20);
//core.fillRoundRect(ctx, 0, 0, 129, 416, 3, "#dbdbdb");
}
}
function map(x, y) {
for (var i = 0; i < 5; i++) {
for (var j = 0; j < 5; j++) {
if (x > 8 + (i * 24) - 3 && x < 8 + (i * 24) + 20 + 3 && y > 138 + (j * 24) - 3 && y < 138 + (j * 24) + 20 + 3) {
var floor;
if (flags.dimension[0] == "主世界" && flags.dimension[1] == "地表") {
floor = "zhu" + (i + 1 + (j * 5));
return floor;
} else if (flags.dimension[0] == "主世界" && flags.dimension[1] == "洞穴") {
switch (i + 1 + (j * 5)) {
case 7:
floor = "dong1";
break;
case 8:
floor = "dong2";
break;
case 9:
floor = "dong3";
break;
case 12:
floor = "dong4";
break;
case 13:
floor = "dong5";
break;
case 14:
floor = "dong6";
break;
case 17:
floor = "dong7";
break;
case 18:
floor = "dong8";
break;
case 19:
floor = "dong9";
break;
}
return floor;
}
}
}
}
}
function mapicon(x, y) {
for (var i = 0; i < 5; i++) {
for (var j = 0; j < 2; j++) {
if (x > 8 + (i * 24) - 3 && x < 8 + (i * 24) + 20 + 3 && y > 264 + (j * 24) - 3 && y < 264 + (j * 24) + 20 + 3) {
var floor = (i + 1 + (j * 5));
return floor;
}
}
}
}
function registerAction_extend() {
// 键盘操作还是建议在脚本编辑onkeyup中写
// 如果点击是有效操作 记得core.status.route.push(replayAction) 配合registerReplayAction实现
// 不要注册"extendClick"这种根据点击坐标触发的录像行为 在录像检测环境中不会生成拓展栏
extend.addEventListener("click", function (e) {
e.stopPropagation();
var x = e.clientX,
y = e.clientY;
var loc = getClickLoc(x, y),
x = loc.x,
y = loc.y;
//console.log(x, y);
if (!core.domStyle.isVertical) { //横屏
if (x > 1 && x < 128 && y > 1 && y < 70) {
flags.tip[0] = "右键一个图块/敌怪试试吧";
core.ui.drawStatusBar();
} else if (x > 1 && x < 128 && y > 80 && y < 108) {
flags.tip[0] = "显示当前维度、层和区域信息";
core.ui.drawStatusBar();
} else if (x > 1 && x < 128 && y > 108 && y < 130) {
flags.tip[0] = "显示当前坐标,\r[#61fff3]高亮\r时意味着尽头存在楼梯";
core.ui.drawStatusBar();
} else if (x > 6 && x < 128 && y > 134 && y < 255) {
flags.tip[0] = "显示当前区域的小地图,只能预览\r[#61fff3]已探索区域\r点击任意位置返回";
core.ui.drawStatusBar();
} else if (x > 1 && x < 128 && y > 263 && y < 311) {
flags.tip[0] = "在预览时,可以标记正在预览的区域";
core.ui.drawStatusBar();
}
if (core.status.event.id == 'viewMaps') {
if (x > 8 && x < 124 && y > 138 && y < 254) {
if (map(x, y) != undefined && core.hasVisitedFloor(map(x, y))) {
flags.interface = "锁定";
ui.prototype._drawViewMaps(core.floorIds.indexOf(map(x, y)));
extend.update();
}
} else if (x > 8 && x < 124 && y > 264 && y < 308) {
if (mapicon(x, y) != undefined) {
if (flags.dimension[0] == "主世界" && flags.dimension[1] == "地表") {
flags.mapicon["zhu"][core.status.event.data.floorId] = mapicon(x, y);
} else if (flags.dimension[0] == "主世界" && flags.dimension[1] == "洞穴") {
flags.mapicon["dong"][core.status.event.data.floorId] = mapicon(x, y);
}
extend.update();
}
} else {
core.closePanel();
core.drawMap();
core.playSound('取消');
flags.interface = "物品栏";
}
} else if (flags.interface == "物品栏" &&
flags.tech == 0 &&
flags.CustomKey == 0 &&
core.status.event.id == null &&
map(x, y) != undefined &&
core.hasVisitedFloor(map(x, y))) {
flags.interface = "锁定";
ui.prototype._drawViewMaps(core.floorIds.indexOf(map(x, y)));
extend.update();
}
}
});
extend.addEventListener("dblclick", function (e) {
e.stopPropagation();
var x = e.clientX,
y = e.clientY;
var loc = getClickLoc(x, y),
x = loc.x,
y = loc.y;
//console.log("双击的位置是" + x + "," + y);
});
}
function getClickLoc(x, y) {
return {
x: Math.round((x - extend.canvas.offsetLeft) / core.domStyle.scale),
y: Math.round((y - extend.canvas.offsetTop) / core.domStyle.scale)
}
}
function getPosData() {
var gpos = {
left: cssToPixel(core.dom.gameGroup.style.left),
top: cssToPixel(core.dom.gameGroup.style.top),
width: cssToPixel(core.dom.gameGroup.style.width),
height: cssToPixel(core.dom.gameGroup.style.height)
};
var extendScale = Sprite.prototype.__extendScale;
if (window.extend) extendScale = extend.values.scale
var scale = !core.domStyle.isVertical ? extendScale.hpos : extendScale.vpos;
var expos = {
x: gpos.left + gpos.width,
y: gpos.top,
}
if (core.domStyle.isVertical) {
expos = {
x: gpos.left,
y: gpos.top + gpos.height,
}
}
expos.width = gpos.width * scale.width;
expos.height = gpos.height * scale.height;
return expos;
}
function resetScale(type, w, h) {
if (!type) type = core.domStyle.isVertical ? 2 : 1;
var scale = extend.values.scale.hpos;
if (type == 2) scale = extend.values.scale.vpos;
scale.width = w || scale.width;
scale.height = h || scale.height;
extend.resize_extend();
core.resize();
}
function setBorder() {
extend.setCss("box-sizing: border-box;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;");
var border = [
"border-left: 0;border-bottom: 3px solid rgb(204, 204, 204);border-top: 3px solid rgb(204, 204, 204);border-right: 3px solid rgb(204, 204, 204);",
"border-left: 3px solid rgb(204, 204, 204);border-right: 3px solid rgb(204, 204, 204);border-top: 0;border-bottom: 3px solid rgb(204, 204, 204);"
]
if (extend.values.border[0]) border[0] = extend.values.border[0];
if (extend.values.border[1]) border[1] = extend.values.border[1];
if (!core.domStyle.isVertical) {
extend.setCss(border[0])
} else {
extend.setCss(border[1])
}
}
function changeBorder(border, border_vertical) {
if (border) extend.values.border[0] = border;
if (border_vertical) extend.values.border[1] = border_vertical;
extend.setBorder()
}
function resize_extend(noRefresh) {
var data = extend.getPosData();
extend.resize(data.width, data.height, true);
if (!noRefresh) extend.update();
}
function changePos(noRefresh) {
var extendPos = extend.getPosData();
extend.move(extendPos.x, extendPos.y);
if (!noRefresh) extend.update();
}
function hide() {
extend.values.hidden = true;
extend.canvas.style.display = "none";
}
function show() {
extend.values.hidden = false;
extend.canvas.style.display = "block";
extend.resize_extend();
core.resize();
}
function cssToPixel(css) {
return parseFloat(css.replace("px", ""));
}
function initExtend() {
if (window.extend) {
extend.update();
return;
}
var pos = getPosData();
window.extend = new Sprite(pos.x, pos.y, pos.width / core.domStyle.scale, pos.height / core.domStyle.scale, 220, "window", "extend");
extend.values = {
scale: Sprite.prototype.__extendScale,
border: [],
hideInVertical: false,
hidden: true
}
extend.update = update;
extend.getPosData = getPosData;
extend.resetScale = resetScale;
extend.setBorder = setBorder;
extend.changeBorder = changeBorder;
extend.resize_extend = resize_extend;
extend.changePos = changePos;
extend.hide = hide;
extend.show = show;
registerAction_extend();
}
if (main.replayChecking) return;
Sprite.prototype.__extendScale = core.clone(scale);
var _up = core.control.updateStatusBar;
core.control.updateStatusBar = function (d, i) {
_up.call(core.control, d, i);
if (window.extend && (core.domStyle.isVertical && extend.values.hideInVertical)) return extend.hide();
if (core.getFlag("showExtend")) {
if (!window.extend) {
initExtend();
}
if (extend.values.hidden) extend.show();
else extend.update();
} else if (window.extend && !extend.values.hidden) {
window.extend.hide();
core.resize();
}
}
var _loadData = core.control.loadData,
_saveData = core.control.saveData;
core.control.saveData = function () {
var data = _saveData.call(core.control);
if (!extend) return;
data._extend_values = extend.values;
return data;
}
core.control.loadData = function (data, callback) {
_loadData.call(core.control, data, callback);
if (!data._extend_values) return;
extend.values = data._extend_values;
extend.resetScale()
}
var _resetGame = core.events.resetGame;
core.events.resetGame = function (hero, hard, floorId, maps, values) {
_resetGame.call(core.events, hero, hard, floorId, maps, values);
initExtend();
/*if (flags.showExtend)*/ extend.show();
};
var resize_gameGroup;
for (var i = 0; i < core.control.resizes.length; i++) {
if (core.control.resizes[i].name == "gameGroup") resize_gameGroup = core.control.resizes[i];
}
if (resize_gameGroup == null) alert("没有检测到resize_gameGroup也许该插件兼容的版本与你并不相同请去h5造塔群95939661问问吧");
resize_gameGroup.func = function (obj) {
var startBackground = core.domStyle.isVertical ? (main.styles.startVerticalBackground || main.styles.startBackground) : main.styles.startBackground;
if (main.dom.startBackground.getAttribute('__src__') != startBackground) {
main.dom.startBackground.setAttribute('__src__', startBackground);
main.dom.startBackground.src = startBackground;
}
var gameGroup = core.dom.gameGroup;
var totalWidth, totalHeight;
if (core.domStyle.isVertical) {
totalWidth = obj.outerWidth;
totalHeight = obj.outerHeight + obj.statusBarHeightInVertical + obj.toolbarHeightInVertical
} else {
totalWidth = obj.outerWidth + obj.BAR_WIDTH * core.domStyle.scale + (obj.hideLeftStatusBar ? 0 : obj.BORDER);
totalHeight = obj.outerHeight + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0);
}
gameGroup.style.width = totalWidth + "px";
gameGroup.style.height = totalHeight + "px";
// extend resize
if (window.extend && !extend.values.hidden) {
extend.resize_extend(true);
var extendPos = extend.getPosData();
if (!core.domStyle.isVertical) totalWidth += extendPos.width;
else totalHeight += extendPos.height;
}
gameGroup.style.left = (obj.clientWidth - totalWidth) / 2 + "px";
gameGroup.style.top = (obj.clientHeight - totalHeight) / 2 + "px";
if (window.extend && !extend.values.hidden) extend.changePos();
// floorMsgGroup
var floorMsgGroup = core.dom.floorMsgGroup;
floorMsgGroup.style = obj.globalAttribute.floorChangingStyle;
floorMsgGroup.style.width = obj.outerWidth - 2 * obj.BORDER + "px";
floorMsgGroup.style.height = totalHeight - 2 * obj.BORDER + "px";
floorMsgGroup.style.fontSize = 16 * core.domStyle.scale + "px";
// startPanel
core.dom.startPanel.style.fontSize = 16 * core.domStyle.scale + "px";
// musicBtn
if (core.domStyle.isVertical || core.domStyle.scale < 1) {
core.dom.musicBtn.style.right = core.dom.musicBtn.style.bottom = "3px";
} else {
core.dom.musicBtn.style.right = (obj.clientWidth - totalWidth) / 2 + "px";
core.dom.musicBtn.style.bottom = (obj.clientHeight - totalHeight) / 2 - 27 + "px";
}
}
},
"31-角色属性界面": function () {
this.attrshow = function () {
if (flags.attrui == 1) {
var ctx = "uievent";
flags.interface = "锁定";
if (core.getContextByName(ctx) == null) {
core.createCanvas(ctx, 0, 0, 416, 416, 130);
} else {
core.clearMap(ctx);
core.createCanvas(ctx, 0, 0, 416, 416, 130);
}
core.drawImage(ctx, "attribute.png", 0, 0, 416, 416);
core.fillBoldText(ctx, "退出", 280, 362, "#ff6661", "black", ui.prototype._buildFont(18, false), 416);
core.fillBoldText(ctx, "角色属性", 168, 80, "white", "black", ui.prototype._buildFont(20, false), 416);
var initx = 90;
var addx = 140;
var inity = 122;
var addy = 20;
core.fillText(ctx, "生命值:\r[#00a808]" + core.status.hero.hp + "/" + core.status.hero.hpmax + "\r",
initx + (addx * 0), inity + (addy * 0), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "饱食度:\r[#00a808]" + flags.hunger[0] + "/" + flags.hunger[1] + "\r",
initx + (addx * 0), inity + (addy * 1), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "攻速:\r[#00a808]" + flags.property.atkSpeed[0] + " (" + ((flags.property.atkSpeed[0] - 110) / -20) + "s)" + "\r",
initx + (addx * 0), inity + (addy * 2), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "触碰范围:\r[#00a808]" + flags.property.touchRange[1] + "\r", initx + (addx * 1), inity + (addy * 0), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "攻击范围:\r[#00a808]" + flags.property.touchRange[0] + "\r", initx + (addx * 1), inity + (addy * 1), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "经验加成:\r[#00a808]" + flags.property.exp + "\r", initx + (addx * 1), inity + (addy * 2), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "攻击:\r[#00a808]" + core.status.hero.atk + "\r", initx + (addx * 0), inity + (addy * 4), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "海洋攻击:\r[#00a808]" + flags.property.atkSea + "\r", initx + (addx * 0), inity + (addy * 5), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "飞行攻击:\r[#00a808]" + flags.property.atkFly + "\r", initx + (addx * 0), inity + (addy * 6), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "无视防御:\r[#00a808]" + flags.property.igdef1 + "\r", initx + (addx * 0), inity + (addy * 7), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "横扫之刃:\r[#00a808]" + flags.property.igdef2 + "\r", initx + (addx * 0), inity + (addy * 8), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "暴击:\r[#00a808]" + flags.property.crit + "\r", initx + (addx * 0), inity + (addy * 9), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "防御:\r[#00a808]" + core.status.hero.def + "\r", initx + (addx * 1), inity + (addy * 4), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "减伤:\r[#00a808]" + flags.property.reduceDa + "\r", initx + (addx * 1), inity + (addy * 5), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "爆炸减伤:\r[#00a808]" + flags.property.reduceBoom + "\r", initx + (addx * 1), inity + (addy * 6), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "弹射物减伤:\r[#00a808]" + flags.property.reduceBul + "\r", initx + (addx * 1), inity + (addy * 7), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "反伤:\r[#00a808]" + flags.property.backDa + "\r", initx + (addx * 1), inity + (addy * 8), "black", ui.prototype._buildFont(14, false), 200);
core.fillText(ctx, "无敌:\r[#00a808]" + flags.property.undead + "\r", initx + (addx * 1), inity + (addy * 9), "black", ui.prototype._buildFont(14, false), 200);
}
}
},
"32-委托界面": function () {
this.taskshow = function () {
if (flags.taskui == 1) {
var ctx = "uievent";
flags.interface = "锁定";
if (core.getContextByName(ctx) == null) {
core.createCanvas(ctx, 0, 0, 416, 416, 130);
} else {
core.clearMap(ctx);
core.createCanvas(ctx, 0, 0, 416, 416, 130);
}
core.drawImage(ctx, "task.png", 0, 0, 416, 416);
core.fillBoldText(ctx, "退出", 340, 370, "#ff6661", "black", ui.prototype._buildFont(18, false), 416);
core.fillBoldText(ctx, "村民的委托", 158, 76, "white", "black", ui.prototype._buildFont(20, false), 416);
core.fillBoldText(ctx, "委托点:10", 300, 76, "white", "black", ui.prototype._buildFont(14, false), 416);
function tasktext(num) {
var n = 0;
if (num == 1) {
n = 0;
} else if (num == 2) {
n = 81;
} else if (num == 3) {
n = 166;
}
core.drawIcon(ctx, "I555", 47, 127 + n, 32, 32);
core.fillText(ctx, "砍伐树木", 110, 132 + n, "black", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "0 / 50", 200, 132 + n, "black", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "委托奖励:", 110, 164 + n, "black", ui.prototype._buildFont(16, false), 400);
core.fillText(ctx, "橡木原木 * 5", 200, 164 + n, "black", ui.prototype._buildFont(16, false), 400);
core.fillBoldText(ctx, "刷新委托", 320, 132 + n, "white", "black", ui.prototype._buildFont(16, false), 416);
core.fillBoldText(ctx, "领取奖励", 320, 164 + n, "white", "black", ui.prototype._buildFont(16, false), 416);
}
tasktext(1);
tasktext(2);
tasktext(3);
}
}
},
"33-成就界面": function () {
this.achishow = function () {
if (flags.achiui == 1) {
var ctx = "uievent";
flags.interface = "锁定";
if (core.getContextByName(ctx) == null) {
core.createCanvas(ctx, 0, 0, 416, 416, 130);
} else {
core.clearMap(ctx);
core.createCanvas(ctx, 0, 0, 416, 416, 130);
}
core.setTextAlign(ctx, "left");
core.drawImage(ctx, "achi.png", 0, 0, 416, 416);
core.fillBoldText(ctx, "退出", 340, 394, "#ff6661", "black", ui.prototype._buildFont(18, false), 416);
core.fillBoldText(ctx, "成就", 188, 38, "white", "black", ui.prototype._buildFont(20, false), 416);
core.fillBoldText(ctx, "上一页", 284, 60, "white", "black", ui.prototype._buildFont(14, false), 416);
core.fillBoldText(ctx, "下一页", 354, 60, "white", "black", ui.prototype._buildFont(14, false), 416);
core.fillText(ctx, "1", 336, 60, "black", ui.prototype._buildFont(16, false), 400);
core.fillBoldText(ctx, "提交成绩", 36, 354, "white", "black", ui.prototype._buildFont(14, false), 416);
core.setTextAlign(ctx, "center");
core.fillBoldText(ctx, "--历程类--", 62, 88, "#fdff61", "black", ui.prototype._buildFont(14, false), 416);
core.fillBoldText(ctx, "收集类", 62, 114, "white", "black", ui.prototype._buildFont(14, false), 416);
core.fillBoldText(ctx, "挑战类", 62, 140, "white", "black", ui.prototype._buildFont(14, false), 416);
core.fillBoldText(ctx, "彩蛋类", 62, 166, "white", "black", ui.prototype._buildFont(14, false), 416);
for (var i = 1; i < 4; i++) {
for (var j = 0; j < 6; j++) {
if (i == 1) {
core.drawIcon(ctx, "I555", 120, 84 + (47 * j), 32, 32);
core.drawTextContent(
ctx, "Minecraft 用下界合金锭升级一把锄,然后重新考虑你的人生抉择",
{ left: 168, top: 84 + (47 * j), color: "white", fontSize: 13, maxWidth: 220 }
);
core.drawTextContent(
ctx, "100000/1000000",
{ left: 352, top: 101 + (47 * j), color: "white", fontSize: 12, maxWidth: 60 }
);
}
}
}
}
}
},
"34-LCG随机数生成器": function () {
this.LCGrand = function () {
// 线性同余生成器算法的参数
const a = 1664525;
const c = 1013904223;
const m = Math.pow(2, 32);
flags.seed2 = flags.seed1;
return function () {
// 计算下一个随机数
flags.seed2 = (a * flags.seed2 + c) % m;
return Math.floor(flags.seed2 / m * flags.limit);
};
}
this.rand3 = function (limit) {
if (limit) flags.limit = limit;
return flags.rand3();
}
},
}