From 105d73e0af8f874dad78f19a05819d9113546bc1 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Tue, 4 Dec 2018 18:57:02 +0800 Subject: [PATCH] non-null in location --- .gitignore | 2 +- _server/editor.js | 9 ++++++--- _server/editor_file.js | 6 +++++- project/maps.js | 4 +++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 928ab591..cd2cdffd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ .vscode -*ce5eec52_2fa1_447b_8dad_764e267a7fab* .DS_Store +MTBuilder.app # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 diff --git a/_server/editor.js b/_server/editor.js index 3da2558c..6a125e2e 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -1009,6 +1009,7 @@ editor.prototype.listen = function () { editor.updateMap(); fields.forEach(function(v){ editor.currentFloorData[v][now.x+','+now.y]=editor.currentFloorData[v][last.x+','+last.y] + if (!core.isset(editor.currentFloorData[v][now.x+','+now.y])) delete editor.currentFloorData[v][now.x+','+now.y]; }) editor.file.saveFloorFile(function (err) { if (err) { @@ -1053,8 +1054,10 @@ editor.prototype.listen = function () { fields.forEach(function(v){ var temp_atsfcytaf=editor.currentFloorData[v][now.x+','+now.y]; - editor.currentFloorData[v][now.x+','+now.y]=editor.currentFloorData[v][last.x+','+last.y]; - editor.currentFloorData[v][last.x+','+last.y]=temp_atsfcytaf + if (!core.isset(editor.currentFloorData[v][last.x+','+last.y])) delete editor.currentFloorData[v][now.x+','+now.y]; + else editor.currentFloorData[v][now.x+','+now.y]=editor.currentFloorData[v][last.x+','+last.y]; + if (!core.isset(temp_atsfcytaf)) delete editor.currentFloorData[v][last.x+','+last.y]; + else editor.currentFloorData[v][last.x+','+last.y]=temp_atsfcytaf }) editor.file.saveFloorFile(function (err) { if (err) { @@ -1078,7 +1081,7 @@ editor.prototype.listen = function () { editor.map[now.y][now.x]=editor.info; editor.updateMap(); fields.forEach(function(v){ - editor.currentFloorData[v][now.x+','+now.y]=null; + delete editor.currentFloorData[v][now.x+','+now.y]; }) editor.file.saveFloorFile(function (err) { if (err) { diff --git a/_server/editor_file.js b/_server/editor_file.js index 3e938917..8178712c 100644 --- a/_server/editor_file.js +++ b/_server/editor_file.js @@ -901,7 +901,11 @@ editor_file = function (editor, callback) { } if (file == 'floors') { actionList.forEach(function (value) { - eval("editor.currentFloorData" + value[1] + '=' + JSON.stringify(value[2])); + // 检测null/undefined + if (core.isset(value[2])) + eval("editor.currentFloorData" + value[1] + '=' + JSON.stringify(value[2])); + else + eval("delete editor.currentFloorData"+value[1]); }); editor_file.saveFloorFile(callback); return; diff --git a/project/maps.js b/project/maps.js index d39bbf77..8056a76c 100644 --- a/project/maps.js +++ b/project/maps.js @@ -79,7 +79,9 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e = '65':{'cls': 'items', 'id': 'hammer'}, // 圣锤 '68':{'cls': 'items', 'id': 'lifeWand'}, // 生命魔杖 '69':{'cls': 'items', 'id': 'jumpShoes'}, // 生命魔杖 - '70':{'cls': 'items', 'id': 'skill1'}, // 技能:二倍斩 + '70':{'cls': 'items', 'id': 'sword0'}, + '71':{'cls': 'items', 'id': 'shield0'}, + '72':{'cls': 'items', 'id': 'skill1'}, // 技能:二倍斩 ////////////////////////// 门、楼梯、传送点部分 //////////////////////////