查看: 11949|回复: 11

[有事请教] 求个地图导出插件orangemapshot

[复制链接]
梦石
0
星屑
1049
在线时间
29 小时
注册时间
2017-5-1
回帖
24
发表于 2018-9-23 18:11:00 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
或者其他能原分辨率导出的也可以
梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

发表于 2018-9-23 19:31:31 | 显示全部楼层
  1. /*=============================================================================
  2. * Orange - Mapshot
  3. * By Hudell - [url]www.hudell.com[/url]
  4. * OrangeMapshot.js
  5. * Version: 1.7
  6. * Free for commercial and non commercial use.
  7. *=============================================================================*/
  8. /*:
  9. * @plugindesc This plugin will save a picture of the entire map on a Mapshots folder when you press a key. <OrangeMapshot>
  10. * @author Hudell
  11. *
  12. * @param useMapName
  13. * @desc if true, the filename will be the name of the map. If false it will be the number.
  14. * @default true
  15. *
  16. * @param layerType
  17. * @desc 0 = all, 1 = upper and lower, 2 = separate everything
  18. * @default 0
  19. *
  20. * @param drawAutoShadows
  21. * @desc set this to false to disable autoshadows on the map shot
  22. * @default true
  23. *
  24. * @param drawEvents
  25. * @desc set this to false to stop drawing the events on the full bitmap
  26. * @default true
  27. *
  28. * @param keyCode
  29. * @desc code of the key that will be used (44 = printscreen). [url]http://link.hudell.com/js-keys[/url]
  30. * @default 44
  31. *
  32. * @param imageType
  33. * @desc What type of image should be generated. Can be png, jpeg or webp
  34. * @default png
  35. *
  36. * @param imageQuality
  37. * @desc If the imageType is jpeg or webp, you can set this to a number between 0 and 100 indicating the quality of the image
  38. * @default 70
  39. *
  40. * @param imagePath
  41. * @desc The path where the images will be saved
  42. * @default ./Mapshots
  43. *
  44. * @help
  45. * Check keycodes at  [url]http://link.hudell.com/js-keys[/url]
  46. */
  47. var Imported = Imported || {};

  48. var OrangeMapshot = OrangeMapshot || {};

  49. (function($) {
  50.   "use strict";

  51.   var parameters = $plugins.filter(function(plugin) {
  52.     return plugin.description.indexOf('<OrangeMapshot>') >= 0;
  53.   });
  54.   if (parameters.length === 0) {
  55.     throw new Error("Couldn't find OrangeMapshot parameters.");
  56.   }
  57.   $.Parameters = parameters[0].parameters;

  58.   $.Param = {};
  59.   $.Param.useMapName = $.Parameters.useMapName !== "false";
  60.   $.Param.drawAutoShadows = $.Parameters.drawAutoShadows !== "false";
  61.   $.Param.drawEvents = $.Parameters.drawEvents !== "false";
  62.   $.Param.layerType = Number($.Parameters.layerType || 0);
  63.   $.Param.imageType = $.Parameters.imageType || 'png';
  64.   $.Param.imagePath = $.Parameters.imagePath || './Mapshots';
  65.   $.Param.imageQuality = Number($.Parameters.imageQuality || 70);

  66.   $.Param.keyCode = Number($.Parameters.keyCode || 44);

  67.   $.imageType = function() {
  68.     if ($.Param.imageType == 'webp') return 'image/webp';
  69.     if ($.Param.imageType == 'jpeg' || $.Param.imageType == 'jpg') return 'image/jpeg';
  70.     return 'image/png';
  71.   };

  72.   $.imageRegex = function() {
  73.     if ($.Param.imageType == 'webp') return (/^data:image\/webp;base64,/);
  74.     if ($.Param.imageType == 'jpeg' || $.Param.imageType == 'jpg') return (/^data:image\/jpeg;base64,/);

  75.     return (/^data:image\/png;base64,/);
  76.   };

  77.   $.fileExtension = function() {
  78.     if ($.Param.imageType == 'webp') return '.webp';
  79.     if ($.Param.imageType == 'jpeg' || $.Param.imageType == 'jpg') return '.jpg';
  80.     return '.png';
  81.   };

  82.   $.imageQuality = function() {
  83.     if ($.fileExtension() == '.jpg' || $.fileExtension() == '.webp') {
  84.       return Math.min($.Param.imageQuality, 100) / 100;
  85.     }

  86.     return 1;
  87.   };

  88.   $.baseFileName = function() {
  89.     var mapName = ($gameMap._mapId).padZero(3);
  90.     if ($.Param.useMapName) {
  91.       mapName = $dataMapInfos[$gameMap._mapId].name;
  92.     } else {
  93.       mapName = 'Map' + mapName;
  94.     }

  95.     return mapName;
  96.   };

  97.   $.getMapshot = function() {
  98.     var lowerBitmap;
  99.     var upperBitmap;

  100.     switch($.Param.layerType) {
  101.       case 1 :
  102.         lowerBitmap = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  103.         upperBitmap = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  104.         SceneManager._scene._spriteset._tilemap._paintEverything(lowerBitmap, upperBitmap);

  105.         return [lowerBitmap, upperBitmap];
  106.       case 2 :
  107.         var groundBitmap = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  108.         var ground2Bitmap = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  109.         var lowerBitmapLayer = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  110.         var upperBitmapLayer = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  111.         var shadowBitmap = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  112.         var lowerEvents = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  113.         var normalEvents = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  114.         var upperEvents = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());

  115.         SceneManager._scene._spriteset._tilemap._paintLayered(groundBitmap, ground2Bitmap, lowerBitmapLayer, upperBitmapLayer, shadowBitmap, lowerEvents, normalEvents, upperEvents);
  116.         return [groundBitmap, ground2Bitmap, lowerBitmapLayer, upperBitmapLayer, shadowBitmap, lowerEvents, normalEvents, upperEvents];
  117.       default :
  118.         lowerBitmap = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  119.         upperBitmap = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  120.         SceneManager._scene._spriteset._tilemap._paintEverything(lowerBitmap, upperBitmap);

  121.         var bitmap = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  122.         bitmap.blt(lowerBitmap, 0, 0, lowerBitmap.width, lowerBitmap.height, 0, 0, lowerBitmap.width, lowerBitmap.height);
  123.         bitmap.blt(upperBitmap, 0, 0, upperBitmap.width, upperBitmap.height, 0, 0, upperBitmap.width, upperBitmap.height);
  124.         return [bitmap];
  125.     }
  126.   };

  127.   function MapShotTileMap() {
  128.   }

  129.   MapShotTileMap.prototype = Object.create(Tilemap.prototype);
  130.   MapShotTileMap.prototype.constructor = MapShotTileMap;

  131.   MapShotTileMap.prototype._drawAutotile = function(bitmap, tileId, dx, dy) {
  132.     var autotileTable = Tilemap.FLOOR_AUTOTILE_TABLE;
  133.     var kind = Tilemap.getAutotileKind(tileId);
  134.     var shape = Tilemap.getAutotileShape(tileId);
  135.     var tx = kind % 8;
  136.     var ty = Math.floor(kind / 8);
  137.     var bx = 0;
  138.     var by = 0;
  139.     var setNumber = 0;
  140.     var isTable = false;

  141.     if (Tilemap.isTileA1(tileId)) {
  142.       var waterSurfaceIndex = [0, 1, 2, 1][this.animationFrame % 4];
  143.       setNumber = 0;
  144.       if (kind === 0) {
  145.         bx = waterSurfaceIndex * 2;
  146.         by = 0;
  147.       } else if (kind === 1) {
  148.         bx = waterSurfaceIndex * 2;
  149.         by = 3;
  150.       } else if (kind === 2) {
  151.         bx = 6;
  152.         by = 0;
  153.       } else if (kind === 3) {
  154.         bx = 6;
  155.         by = 3;
  156.       } else {
  157.         bx = Math.floor(tx / 4) * 8;
  158.         by = ty * 6 + Math.floor(tx / 2) % 2 * 3;
  159.         if (kind % 2 === 0) {
  160.           bx += waterSurfaceIndex * 2;
  161.         }
  162.         else {
  163.           bx += 6;
  164.           autotileTable = Tilemap.WATERFALL_AUTOTILE_TABLE;
  165.           by += this.animationFrame % 3;
  166.         }
  167.       }
  168.     } else if (Tilemap.isTileA2(tileId)) {
  169.       setNumber = 1;
  170.       bx = tx * 2;
  171.       by = (ty - 2) * 3;
  172.       isTable = this._isTableTile(tileId);
  173.     } else if (Tilemap.isTileA3(tileId)) {
  174.       setNumber = 2;
  175.       bx = tx * 2;
  176.       by = (ty - 6) * 2;
  177.       autotileTable = Tilemap.WALL_AUTOTILE_TABLE;
  178.     } else if (Tilemap.isTileA4(tileId)) {
  179.       setNumber = 3;
  180.       bx = tx * 2;
  181.       by = Math.floor((ty - 10) * 2.5 + (ty % 2 === 1 ? 0.5 : 0));
  182.       if (ty % 2 === 1) {
  183.         autotileTable = Tilemap.WALL_AUTOTILE_TABLE;
  184.       }
  185.     }

  186.     var table = autotileTable[shape];
  187.     var source = this.bitmaps[setNumber];

  188.     if (table && source) {
  189.       var w1 = this._tileWidth / 2;
  190.       var h1 = this._tileHeight / 2;
  191.       for (var i = 0; i < 4; i++) {
  192.         var qsx = table[i][0];
  193.         var qsy = table[i][1];
  194.         var sx1 = (bx * 2 + qsx) * w1;
  195.         var sy1 = (by * 2 + qsy) * h1;
  196.         var dx1 = dx + (i % 2) * w1;
  197.         var dy1 = dy + Math.floor(i / 2) * h1;
  198.         if (isTable && (qsy === 1 || qsy === 5)) {
  199.           var qsx2 = qsx;
  200.           var qsy2 = 3;
  201.           if (qsy === 1) {
  202.             qsx2 = [0,3,2,1][qsx];
  203.           }
  204.           var sx2 = (bx * 2 + qsx2) * w1;
  205.           var sy2 = (by * 2 + qsy2) * h1;
  206.           bitmap.blt(source, sx2, sy2, w1, h1, dx1, dy1, w1, h1);
  207.           dy1 += h1/2;
  208.           bitmap.blt(source, sx1, sy1, w1, h1 / 2, dx1, dy1, w1, h1 / 2);
  209.         } else {
  210.           bitmap.blt(source, sx1, sy1, w1, h1, dx1, dy1, w1, h1);
  211.         }
  212.       }
  213.     }
  214.   };

  215.   MapShotTileMap.prototype._drawNormalTile = function(bitmap, tileId, dx, dy) {
  216.     var setNumber = 0;

  217.     if (Tilemap.isTileA5(tileId)) {
  218.       setNumber = 4;
  219.     } else {
  220.       setNumber = 5 + Math.floor(tileId / 256);
  221.     }

  222.     var w = this._tileWidth;
  223.     var h = this._tileHeight;
  224.     var sx = (Math.floor(tileId / 128) % 2 * 8 + tileId % 8) * w;
  225.     var sy = (Math.floor(tileId % 256 / 8) % 16) * h;

  226.     var source = this.bitmaps[setNumber];
  227.     if (source) {
  228.       bitmap.blt(source, sx, sy, w, h, dx, dy, w, h);
  229.     }
  230.   };

  231.   MapShotTileMap.prototype._drawTableEdge = function(bitmap, tileId, dx, dy) {
  232.     if (Tilemap.isTileA2(tileId)) {
  233.       var autotileTable = Tilemap.FLOOR_AUTOTILE_TABLE;
  234.       var kind = Tilemap.getAutotileKind(tileId);
  235.       var shape = Tilemap.getAutotileShape(tileId);
  236.       var tx = kind % 8;
  237.       var ty = Math.floor(kind / 8);
  238.       var setNumber = 1;
  239.       var bx = tx * 2;
  240.       var by = (ty - 2) * 3;
  241.       var table = autotileTable[shape];

  242.       if (table) {
  243.         var source = this.bitmaps[setNumber];
  244.         var w1 = this._tileWidth / 2;
  245.         var h1 = this._tileHeight / 2;
  246.         for (var i = 0; i < 2; i++) {
  247.           var qsx = table[2 + i][0];
  248.           var qsy = table[2 + i][1];
  249.           var sx1 = (bx * 2 + qsx) * w1;
  250.           var sy1 = (by * 2 + qsy) * h1 + h1/2;
  251.           var dx1 = dx + (i % 2) * w1;
  252.           var dy1 = dy + Math.floor(i / 2) * h1;
  253.           bitmap.blt(source, sx1, sy1, w1, h1/2, dx1, dy1, w1, h1/2);
  254.         }
  255.       }
  256.     }
  257.   };

  258.   Tilemap.prototype._drawTileOldStyle = function(bitmap, tileId, dx, dy) {
  259.     if (Tilemap.isVisibleTile(tileId)) {
  260.       if (Tilemap.isAutotile(tileId)) {
  261.         MapShotTileMap.prototype._drawAutotile.call(this, bitmap, tileId, dx, dy);
  262.       } else {
  263.         MapShotTileMap.prototype._drawNormalTile.call(this, bitmap, tileId, dx, dy);
  264.       }
  265.     }
  266.   };  

  267.   Tilemap.prototype._paintEverything = function(lowerBitmap, upperBitmap) {
  268.     var tileCols = $dataMap.width;
  269.     var tileRows = $dataMap.height;

  270.     for (var y = 0; y < tileRows; y++) {
  271.       for (var x = 0; x < tileCols; x++) {
  272.         this._paintTilesOnBitmap(lowerBitmap, upperBitmap, x, y);
  273.       }
  274.     }

  275.     if ($.Param.drawEvents !== false) {
  276.       this._paintCharacters(lowerBitmap, 0);
  277.       this._paintCharacters(lowerBitmap, 1);
  278.       this._paintCharacters(upperBitmap, 2);   
  279.     }
  280.   };

  281.   Tilemap.prototype._paintLayered = function(groundBitmap, ground2Bitmap, lowerBitmap, upperLayer, shadowBitmap, lowerEvents, normalEvents, upperEvents) {
  282.     var tileCols = $dataMap.width;
  283.     var tileRows = $dataMap.height;

  284.     for (var y = 0; y < tileRows; y++) {
  285.       for (var x = 0; x < tileCols; x++) {
  286.         this._paintTileOnLayers(groundBitmap, ground2Bitmap, lowerBitmap, upperLayer, shadowBitmap, x, y);
  287.       }
  288.     }

  289.     this._paintCharacters(lowerEvents, 0);
  290.     this._paintCharacters(normalEvents, 1);
  291.     this._paintCharacters(upperEvents, 2);        
  292.   };

  293.   Tilemap.prototype._paintCharacters = function(bitmap, priority) {
  294.     this.children.forEach(function(child) {
  295.       if (child instanceof Sprite_Character) {
  296.         if (child._character !== null) {
  297.           if (child._character instanceof Game_Player || child._character instanceof Game_Follower || child._character instanceof Game_Vehicle) return;
  298.         }

  299.         child.update();

  300.         if (child._characterName === '' && child._tileId === 0) return;
  301.         if (priority !== undefined && child._character._priorityType !== priority) return;

  302.         var x = child.x - child._frame.width / 2 + $gameMap._displayX * $gameMap.tileWidth();
  303.         var y = child.y - child._frame.height + $gameMap._displayY * $gameMap.tileHeight();

  304.         bitmap.blt(child.bitmap, child._frame.x, child._frame.y, child._frame.width, child._frame.height, x, y, child._frame.width, child._frame.height);
  305.       }
  306.     });
  307.   };

  308.   Tilemap.prototype._paintTileOnLayers = function(groundBitmap, ground2Bitmap, lowerBitmap, upperBitmap, shadowBitmap, x, y) {
  309.     var tableEdgeVirtualId = 10000;
  310.     var mx = x;
  311.     var my = y;
  312.     var dx = (mx * this._tileWidth);
  313.     var dy = (my * this._tileHeight);
  314.     var lx = dx / this._tileWidth;
  315.     var ly = dy / this._tileHeight;
  316.     var tileId0 = this._readMapData(mx, my, 0);
  317.     var tileId1 = this._readMapData(mx, my, 1);
  318.     var tileId2 = this._readMapData(mx, my, 2);
  319.     var tileId3 = this._readMapData(mx, my, 3);
  320.     var shadowBits = this._readMapData(mx, my, 4);
  321.     var upperTileId1 = this._readMapData(mx, my - 1, 1);

  322.     if (groundBitmap !== undefined) {
  323.       groundBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight);
  324.     }

  325.     if (ground2Bitmap !== undefined) {
  326.       ground2Bitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight);
  327.     }

  328.     if (lowerBitmap !== undefined) {
  329.       lowerBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight);
  330.     }

  331.     if (upperBitmap !== undefined) {
  332.       upperBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight);
  333.     }

  334.     if (shadowBitmap !== undefined) {
  335.       shadowBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight);
  336.     }

  337.     var me = this;

  338.     function drawTiles(bitmap, tileId, shadowBits, upperTileId1) {
  339.       if (tileId < 0) {
  340.         if ($.Param.drawAutoShadows && shadowBits !== undefined) {
  341.           MapShotTileMap.prototype._drawShadow.call(me, bitmap, shadowBits, dx, dy);
  342.         }
  343.       } else if (tileId >= tableEdgeVirtualId) {
  344.         MapShotTileMap.prototype._drawTableEdge.call(me, bitmap, upperTileId1, dx, dy);
  345.       } else {
  346.         me._drawTileOldStyle(bitmap, tileId, dx, dy);
  347.       }
  348.     }

  349.     if (groundBitmap !== undefined) {
  350.       drawTiles(groundBitmap, tileId0, undefined, upperTileId1);

  351.       if (shadowBitmap !== undefined && tileId0 < 0) {
  352.         drawTiles(shadowBitmap, tileId0, shadowBits, upperTileId1);
  353.       }
  354.     }

  355.     if (ground2Bitmap !== undefined) {
  356.       drawTiles(ground2Bitmap, tileId1, undefined, upperTileId1);

  357.       if (shadowBitmap !== undefined && tileId1 < 0) {
  358.         drawTiles(shadowBitmap, tileId1, shadowBits, upperTileId1);
  359.       }
  360.     }

  361.     if (lowerBitmap !== undefined) {
  362.       drawTiles(lowerBitmap, tileId2, undefined, upperTileId1);

  363.       if (shadowBitmap !== undefined && tileId2 < 0) {
  364.         drawTiles(shadowBitmap, tileId2, shadowBits, upperTileId1);
  365.       }
  366.     }

  367.     if (upperBitmap !== undefined) {
  368.       drawTiles(upperBitmap, tileId3, shadowBits, upperTileId1);

  369.       if (shadowBitmap !== undefined && tileId3 < 0) {
  370.         drawTiles(shadowBitmap, tileId3, shadowBits, upperTileId1);
  371.       }
  372.     }
  373.   };

  374.   Tilemap.prototype._paintTilesOnBitmap = function(lowerBitmap, upperBitmap, x, y) {
  375.     var tableEdgeVirtualId = 10000;
  376.     var mx = x;
  377.     var my = y;
  378.     var dx = (mx * this._tileWidth);
  379.     var dy = (my * this._tileHeight);
  380.     var lx = dx / this._tileWidth;
  381.     var ly = dy / this._tileHeight;
  382.     var tileId0 = this._readMapData(mx, my, 0);
  383.     var tileId1 = this._readMapData(mx, my, 1);
  384.     var tileId2 = this._readMapData(mx, my, 2);
  385.     var tileId3 = this._readMapData(mx, my, 3);
  386.     var shadowBits = this._readMapData(mx, my, 4);
  387.     var upperTileId1 = this._readMapData(mx, my - 1, 1);
  388.     var lowerTiles = [];
  389.     var upperTiles = [];

  390.     if (this._isHigherTile(tileId0)) {
  391.       upperTiles.push(tileId0);
  392.     } else {
  393.       lowerTiles.push(tileId0);
  394.     }
  395.     if (this._isHigherTile(tileId1)) {
  396.       upperTiles.push(tileId1);
  397.     } else {
  398.       lowerTiles.push(tileId1);
  399.     }

  400.     lowerTiles.push(-shadowBits);

  401.     if (this._isTableTile(upperTileId1) && !this._isTableTile(tileId1)) {
  402.       if (!Tilemap.isShadowingTile(tileId0)) {
  403.         lowerTiles.push(tableEdgeVirtualId + upperTileId1);
  404.       }
  405.     }

  406.     if (this._isOverpassPosition(mx, my)) {
  407.       upperTiles.push(tileId2);
  408.       upperTiles.push(tileId3);
  409.     } else {
  410.       if (this._isHigherTile(tileId2)) {
  411.         upperTiles.push(tileId2);
  412.       } else {
  413.         lowerTiles.push(tileId2);
  414.       }
  415.       if (this._isHigherTile(tileId3)) {
  416.         upperTiles.push(tileId3);
  417.       } else {
  418.         lowerTiles.push(tileId3);
  419.       }
  420.     }

  421.     lowerBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight);
  422.     upperBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight);

  423.     for (var i = 0; i < lowerTiles.length; i++) {
  424.       var lowerTileId = lowerTiles[i];
  425.       if (lowerTileId < 0) {
  426.         if ($.Param.drawAutoShadows) {
  427.           MapShotTileMap.prototype._drawShadow.call(this, lowerBitmap, shadowBits, dx, dy);
  428.         }
  429.       } else if (lowerTileId >= tableEdgeVirtualId) {
  430.         MapShotTileMap.prototype._drawTableEdge.call(this, lowerBitmap, upperTileId1, dx, dy);
  431.       } else {
  432.         this._drawTileOldStyle(lowerBitmap, lowerTileId, dx, dy);
  433.       }
  434.     }

  435.     for (var j = 0; j < upperTiles.length; j++) {
  436.       this._drawTileOldStyle(upperBitmap, upperTiles[j], dx, dy);
  437.     }
  438.   };

  439.   $.saveMapshot = function() {
  440.     if (!Utils.isNwjs()) return;

  441.     var fs = require('fs');
  442.     var path = $.Param.imagePath;

  443.     try {
  444.       fs.mkdir(path, function() {
  445.         try{
  446.           var fileName = path + '/' + $.baseFileName();
  447.           var ext = $.fileExtension();
  448.           var names = [fileName + ext];
  449.           var regex = $.imageRegex();

  450.           switch ($.Param.layerType) {
  451.             case 1 :
  452.               names = [
  453.                 fileName + ' Lower' + ext,
  454.                 fileName + ' Upper' + ext
  455.               ];
  456.               break;
  457.             case 2 :
  458.               names = [
  459.                 fileName + ' Ground' + ext,
  460.                 fileName + ' Ground 2' + ext,
  461.                 fileName + ' Lower' + ext,
  462.                 fileName + ' Upper' + ext,
  463.                 fileName + ' Shadows' + ext,
  464.                 fileName + ' Lower Events' + ext,
  465.                 fileName + ' Normal Events' + ext,
  466.                 fileName + ' Upper Events' + ext
  467.               ];

  468.               break;
  469.             default :
  470.               names = [fileName + ext];
  471.               break;
  472.           }

  473.           var snaps = $.getMapshot();

  474.           var callback = function(error) {
  475.             if (error !== undefined && error !== null) {
  476.               console.error('An error occured while saving the mapshot', error);
  477.             }
  478.           };

  479.           for (var i = 0; i < names.length; i++) {
  480.             var urlData = snaps[i].canvas.toDataURL($.imageType(), $.imageQuality());
  481.             var base64Data = urlData.replace(regex, "");

  482.             fs.writeFile(names[i], base64Data, 'base64', callback);
  483.           }
  484.         } catch (error) {
  485.           if (error !== undefined && error !== null) {
  486.             console.error('An error occured while saving the map shot:', error);
  487.           }
  488.         }
  489.       });

  490.       var nodePath = require('path');
  491.       var longPath = nodePath.resolve(path);

  492.       if (process.platform == 'win32' && $._openedFolder === undefined) {
  493.         $._openedFolder = true;

  494.         setTimeout(function(){
  495.           var exec = require('child_process').exec;
  496.           exec('explorer ' + longPath);
  497.         }, 100);
  498.       } else {
  499.         $gameMessage.add('Mapshot saved to \n' + longPath.replace(/\\/g, '\\\\').match(/.{1,40}/g).join('\n'));
  500.       }

  501.     } catch (error) {
  502.       if (error !== undefined && error !== null) {
  503.         console.error('An error occured while saving the mapshot:', error);
  504.       }
  505.     }
  506.   };

  507.   $.onKeyUp = function(event) {
  508.     if (event.keyCode == $.Param.keyCode) {
  509.       if (SceneManager._scene instanceof Scene_Map) {
  510.         $.saveMapshot();
  511.       }
  512.     }
  513.   };

  514.   document.addEventListener('keyup', $.onKeyUp);
  515. })(OrangeMapshot);

  516. Imported.OrangeMapshot = 1.7;
复制代码
回复

使用道具 举报

梦石
0
星屑
1049
在线时间
29 小时
注册时间
2017-5-1
回帖
24
 楼主| 发表于 2018-10-1 21:10:26 | 显示全部楼层
yang1zhi 发表于 2018-9-23 19:31
/*=============================================================================
* Orange - Mapshot
...

这个怎么用啊,我不会
回复

使用道具 举报

梦石
0
星屑
1049
在线时间
29 小时
注册时间
2017-5-1
回帖
24
 楼主| 发表于 2018-10-1 21:11:06 | 显示全部楼层
有好心人吗?
回复

使用道具 举报

梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

发表于 2018-10-1 21:22:53 | 显示全部楼层
保存为JS文件,放到插件文件夹下。
编辑器里添加为插件。
设置插件设置。
游戏中按键盘上的截图键,截图。
pint screen sysrq
回复 2 0

使用道具 举报

梦石
0
星屑
70
在线时间
8 小时
注册时间
2018-9-27
回帖
1
发表于 2018-10-2 02:19:48 | 显示全部楼层
默认设置是printscreen注意要在游戏运行的时候截图

OrangeMapshot.rar

4.23 KB, 下载次数: 772

回复 1 0

使用道具 举报

梦石
0
星屑
1049
在线时间
29 小时
注册时间
2017-5-1
回帖
24
 楼主| 发表于 2018-10-4 22:52:29 | 显示全部楼层
yang1zhi 发表于 2018-10-1 21:22
保存为JS文件,放到插件文件夹下。
编辑器里添加为插件。
设置插件设置。

你好,我的是Mac电脑没有PintScr 那个键位,那个链接键位网址被墙了打不开,你知道其他数字的键位吗?
还有个问题,那个图片地址要修改的吗? 截图了是在游戏文件的图片保存那里吗?
回复

使用道具 举报

梦石
0
星屑
1049
在线时间
29 小时
注册时间
2017-5-1
回帖
24
 楼主| 发表于 2018-10-4 22:56:37 | 显示全部楼层
雪也yukiya 发表于 2018-10-2 02:19
默认设置是printscreen注意要在游戏运行的时候截图

你好,我的是Mac电脑没有PintScr 那个键位,那个链接键位网址被墙了打不开,你知道其他数字的键位吗?
还有个问题,那个图片地址要修改的吗? 截图了是在游戏文件的图片保存那里吗?
回复

使用道具 举报

梦石
0
星屑
1049
在线时间
29 小时
注册时间
2017-5-1
回帖
24
 楼主| 发表于 2018-10-5 00:38:39 | 显示全部楼层
我的是最新版的MV,你们的是吗?
回复 0 2

使用道具 举报

梦石
0
星屑
16296
在线时间
4017 小时
注册时间
2015-9-14
回帖
1322

开拓者

发表于 2018-10-5 12:03:25 | 显示全部楼层
OrangeMapshot.js鍵位密碼對應表:https://css-tricks.com/snippets/javascript/javascript-keycodes/
圖像保存位置加路徑.例如:   C:\Mapshots

66.png
https://rpg.blue/data/attachment/album/202003/28/021323lltgrsvfytfwuya5.gif
回复 1 0

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部