fix:调整装备和道具的属性排序规则

This commit is contained in:
ShakeFlower 2025-03-19 21:11:37 +08:00
parent c3efc938f0
commit dcb4d220eb
2 changed files with 7 additions and 7 deletions

View File

@ -69,12 +69,12 @@ ActionParser.prototype.parse = function (obj,type) {
return MotaActionBlocks['floorPartition_m'].xmlText([text_choices]); return MotaActionBlocks['floorPartition_m'].xmlText([text_choices]);
case 'equip': case 'equip':
if(!obj) obj={}; if (!obj) obj = {};
var buildEquip = function (obj) { var buildEquip = function (obj) {
obj = obj || {}; obj = obj || {};
var text_choices = null; var text_choices = null;
var knownEquipListKeys = MotaActionBlocks['Equip_List'].options.map(function (one) {return one[1];}) var knownEquipListKeys = MotaActionBlocks['Equip_List'].options.map(function (one) { return one[1]; })
Object.keys(obj).sort().forEach(function (key) { Object.keys(obj).sort((a, b) => b.localeCompare(a)).forEach(function (key) {
var one = knownEquipListKeys.indexOf(key) >= 0 ? 'equipKnown' : 'equipUnknown'; var one = knownEquipListKeys.indexOf(key) >= 0 ? 'equipKnown' : 'equipUnknown';
text_choices = MotaActionBlocks[one].xmlText([ text_choices = MotaActionBlocks[one].xmlText([
key, obj[key], text_choices key, obj[key], text_choices
@ -83,7 +83,7 @@ ActionParser.prototype.parse = function (obj,type) {
return text_choices; return text_choices;
} }
return MotaActionBlocks['equip_m'].xmlText([obj.type, obj.animate, buildEquip(obj.value), buildEquip(obj.percentage), return MotaActionBlocks['equip_m'].xmlText([obj.type, obj.animate, buildEquip(obj.value), buildEquip(obj.percentage),
this.parseList(obj.equipEvent), this.parseList(obj.unequipEvent)]); this.parseList(obj.equipEvent), this.parseList(obj.unequipEvent)]);
case 'itemEffect': case 'itemEffect':
if (!obj) obj = {}; if (!obj) obj = {};
@ -91,7 +91,7 @@ ActionParser.prototype.parse = function (obj,type) {
obj = obj || {}; obj = obj || {};
var text_choices = null; var text_choices = null;
var knownItemListKeys = MotaActionBlocks['ItemEffect_List'].options.map(function (one) { return one[1]; }) var knownItemListKeys = MotaActionBlocks['ItemEffect_List'].options.map(function (one) { return one[1]; })
Object.keys(obj).sort().forEach(function (key) { Object.keys(obj).sort((a, b) => b.localeCompare(a)).forEach(function (key) {
var addValue = obj[key]; var addValue = obj[key];
var noNeed = key.endsWith(':o'); var noNeed = key.endsWith(':o');
if (noNeed) key = key.substring(0, key.length - 2); if (noNeed) key = key.substring(0, key.length - 2);

View File

@ -113,9 +113,9 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"itemEffectEvent": { "itemEffectEvent": {
"sound": "gem.mp3", "sound": "gem.mp3",
"value": { "value": {
"mdef:o": "core.values.greenGem", "atk:o": "core.values.redGem",
"def:o": "core.values.blueGem", "def:o": "core.values.blueGem",
"atk:o": "core.values.redGem" "mdef:o": "core.values.greenGem"
} }
} }
}, },