From 3a50fb93302ab6b6fc1a41b981307524b8d514f8 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Mon, 17 Sep 2018 18:39:53 +0800 Subject: [PATCH] Fix textAttribute in save --- libs/control.js | 2 ++ libs/events.js | 1 + libs/items.js | 1 + 3 files changed, 4 insertions(+) diff --git a/libs/control.js b/libs/control.js index 2596e872..20d4d0bf 100644 --- a/libs/control.js +++ b/libs/control.js @@ -2368,6 +2368,8 @@ control.prototype.loadData = function (data, callback) { } } + core.status.textAttribute = core.getFlag('textAttribute') || core.status.textAttribute || core.initStatus.textAttribute; + // load icons var icon = core.getFlag("heroIcon", "hero.png"); if (core.isset(core.material.images.images[icon])) { diff --git a/libs/events.js b/libs/events.js index f1a585a0..60f4b03c 100644 --- a/libs/events.js +++ b/libs/events.js @@ -356,6 +356,7 @@ events.prototype.doAction = function() { if (core.isset(data.time)) { core.status.textAttribute.time=data.time; } + core.setFlag('textAttribute', core.status.textAttribute); core.events.doAction(); break; case "tip": diff --git a/libs/items.js b/libs/items.js index e5a4118b..3d0fdef6 100644 --- a/libs/items.js +++ b/libs/items.js @@ -113,6 +113,7 @@ items.prototype.getEquip = function (equipType) { ////// 设置某个物品的个数 ////// items.prototype.setItem = function (itemId, itemNum) { itemNum = itemNum || 0; + if (itemNum<=0) itemNum = 0; var itemCls = core.material.items[itemId].cls; if (itemCls == 'items') return; if (!core.isset(core.status.hero.items[itemCls])) {