| 赞 | 37 |
| VIP | |
| 好人卡 | |
| 积分 | 105 |
| 经验 | |
| 最后登录 | 2026-1-6 |
| 在线时间 | 463 小时 |
- 梦石
- 2
- 星屑
- 8479
- 在线时间
- 463 小时
- 注册时间
- 2021-12-4
- 回帖
- 486

|
发表于 2023-1-10 22:36:06
|
显示全部楼层
- /*:
- 2
- * @target MV
- 3
- * @plugindesc v1.0 对物品顺序进行重新排列。
- 4
- * @author 2D_猫
- 5
- * @url [url]https://space.bilibili.com/137028995[/url]
- 6
- *
- 7
- * @help
- 8
- * * 使用方法:在数据库为物品命名时,物品名称前加上“x>”前缀,“x”是一个正整数,代
- 9
- * 表该物品的排列优先级,也就是说,数字越小的物品在物品栏中越靠前。未加“x>”前缀
- 10
- * 的物品,将按照该物品的默认顺序排列在加了“x>”前缀的物品的后面。
- 11
- *
- 12
- * * 使用条款:免费用于任何商业或非商业目的;允许在保留原作者信息的前提下修改代
- 13
- * 码;请在你的项目中致谢“2D_猫”,谢谢!:)
- 14
- *
- 15
- * |\ /| _
- 16
- * |-\____/-| //
- 17
- * | | //
- 18
- * | O O |_______//
- 19
- * \__^___/ \
- 20
- * | |
- 21
- * / __ ______ \
- 22
- * / / \ \ / /\ \
- 23
- * /_/ \_\ /_/ \_\
- 24
- */
- 25
-
- 26
- (() => {
- 27
- Window_ItemList.prototype.makeItemList = function() {
- 28
- this._data = $gameParty.allItems().filter(item => this.includes(item));
- 29
- if (this.includes(null)) {
- 30
- this._data.push(null);
- 31
- }
- 32
-
- 33
- // 按照“x>”顺序重新排序物品
- 34
- this._data.sort((a, b) => {
- 35
- let aOrderNum = parseInt(a.name.split(">")[0]);
- 36
- if (aOrderNum.toString() === 'NaN') aOrderNum = Infinity;
- 37
- let bOrderNum = parseInt(b.name.split(">")[0]);
- 38
- if (bOrderNum.toString() === 'NaN') bOrderNum = Infinity;
- 39
-
- 40
- return aOrderNum - bOrderNum;
- 41
- });
- 42
- };
- 43
- 44
- Window_ItemList.prototype.drawItem = function(index) {
- 45
- const item = this.itemAt(index);
- 46
-
- 47
- if (item) {
- 48
- // 获取物品去掉“x>”后的名称
- 49
- let newItemName = item.name.split(">")[1];
- 50
- if (newItemName) item.newName = newItemName;
- 51
- else item.newName = item.name;
- 52
-
- 53
- const numberWidth = this.numberWidth();
- 54
- const rect = this.itemLineRect(index);
- 55
- this.changePaintOpacity(this.isEnabled(item));
- 56
- this.drawItemName(item, rect.x, rect.y, rect.width - numberWidth);
- 57
- this.drawItemNumber(item, rect.x, rect.y, rect.width);
- 58
- this.changePaintOpacity(1);
- 59
- }
- 60
- };
- 61
- 62
- Window_Base.prototype.drawItemName = function(item, x, y, width) {
- 63
- if (item) {
- 64
- const iconY = y + (this.lineHeight() - ImageManager.iconHeight) / 2;
- 65
- const textMargin = ImageManager.iconWidth + 4;
- 66
- const itemWidth = Math.max(0, width - textMargin);
- 67
- this.resetTextColor();
- 68
- this.drawIcon(item.iconIndex, x, iconY);
- 69
- // 显示物品去掉“x>”后的名称
- 70
- this.drawText(item.newName, x + textMargin, y, itemWidth);
- 71
- }
- 72
- };
- 73
- })();
复制代码
感觉这个可以试试 |
评分
-
查看全部评分
|