//This is an example of a Javascript for Photoshop. var sizes=[256,512,1024,2048]; var realms={ Hibernia:{ zones:{ '200':{name:'Lough Derg',offset:[1.5,3]}, '201':{name:'Silvermine Mts.',offset:[1.5,4]}, '202':{name:'Shannon Estuary',offset:[1,5]}, '203':{name:'Cliffs of Moher',offset:[0,2]}, '204':{name:'Lough Gur',offset:[1,6]}, '205':{name:'Bog of Cullen',offset:[2,6.5]}, '206':{name:'Valley of Bri Leith',offset:[2.5,3]}, '207':{name:'Connacht',offset:[1,2]}, '208':{name:'Cursed Forest',offset:[3.5,3]}, '210':{name:'Mount Collory',offset:[2.5,2]}, '211':{name:'Cruachan Gorge',offset:[1.5,1]}, '212':{name:'Breifine',offset:[2.5,1]}, '214':{name:'Emain Macha',offset:[3,0]}, '216':{name:'Sheeroe Hills',offset:[2,5.5]} }, gridData:[ { pre:'images/hibernia/m_', suf:'.jpg', gridSize : [5,8], tileSize : 125, zoneSize : 125 }, { pre:'images/hibernia/25d_', suf:'.jpg', gridSize : [9,15], tileSize : 128, zoneSize : 256 }, { pre:'images/hibernia/5c_', suf:'.jpg', gridSize : [9,15], tileSize : 256, zoneSize : 512 }, { pre:'images/hibernia/1k_', suf:'.jpg', gridSize : [9,15], tileSize : 512, zoneSize : 1024 }, { pre:'images/hibernia/2k_', suf:'.jpg', gridSize : [18,30], tileSize : 512, zoneSize : 2048 } ] }, Albion:{ zones:{ '000':{name:'Camelot Hills',offset:[4,3]}, '001':{name:'Salisbury Plains',offset:[4,4]}, '002':{name:'BlackMtnsSouth',offset:[3,2.25]}, '003':{name:'BlackMtnsNorth',offset:[3,1.25]}, '004':{name:'Dartmoor',offset:[1,6.25]}, '006':{name:'Cornwall',offset:[1,5.25]}, '007':{name:'Llyn Barfog',offset:[2,1.25]}, '008':{name:'Campacorentin Forest',offset:[3,4.5]}, '009':{name:'Avalon Marsh',offset:[2,5]}, '010':{name:'Lyonesse',offset:[0,5.25]}, '011':{name:'Forest Sauvage',offset:[4.25,2]}, '012':{name:'Snowdonia',offset:[3.25,0.25]}, '014':{name:'Pennine Mountains',offset:[4.25,1]}, '015':{name:'Hadrian\'s Wall',offset:[4.75,0]} }, gridData:[ { pre:'images/albion/m_', suf:'.jpg', gridSize : [6,8], tileSize : 128, zoneSize : 128 }, { pre:'images/albion/25d_', suf:'.jpg', gridSize : [6,8], tileSize : 256, zoneSize : 256 }, { pre:'images/albion/5c_', suf:'.jpg', gridSize : [12,15], tileSize : 256, zoneSize : 512 }, { pre:'images/albion/1k_', suf:'.jpg', gridSize : [12,15], tileSize : 512, zoneSize : 1024 }, { pre:'images/albion/2k_', suf:'.jpg', gridSize : [23,29], tileSize : 512, zoneSize : 2048 } ] }, Midgard:{ zones:{ '100':{name:'Vale of Mularn',offset:[2.5,1.5]}, '101':{name:'Svealand East',offset:[2,2.5]}, '102':{name:'Svealand West',offset:[1,2.5]}, '103':{name:'Gotar',offset:[2,3.5]}, '104':{name:'Muspelheim',offset:[3.5,1]}, '105':{name:'Myrkwood Forest',offset:[2.5,4.5]}, '106':{name:'Skona Ravine',offset:[1.5,5]}, '107':{name:'Vanern Swamp',offset:[0.5,4.5]}, '108':{name:'Raumarik',offset:[0,2.5]}, '111':{name:'Uppland',offset:[2,0.5]}, '112':{name:'Yggdra Forest',offset:[1,1.5]}, '113':{name:'Jamtland Mountains',offset:[1,0.5]}, '115':{name:'Odin\'s Gate',offset:[0,0]}, '116':{name:'Malmohus',offset:[1.5,6]} }, gridData:[ { pre:'images/midgard/m_', suf:'.jpg', gridSize : [5,7], tileSize : 125, zoneSize : 125 }, { pre:'images/midgard/25d_', suf:'.jpg', gridSize : [9,14], tileSize : 128, zoneSize : 256 }, { pre:'images/midgard/5c_', suf:'.jpg', gridSize : [9,14], tileSize : 256, zoneSize : 512 }, { pre:'images/midgard/1k_', suf:'.jpg', gridSize : [9,14], tileSize : 512, zoneSize : 1024 }, { pre:'images/midgard/2k_', suf:'.jpg', gridSize : [18,28], tileSize : 512, zoneSize : 2048 } ] }, HyBrasil:{ zones:{ '181':{name:'Domnan',offset:[2,2.5]}, '182':{name:'Caillte Garran',offset:[1,2]}, '183':{name:'Vale of Balor',offset:[0,1.5]}, '184':{name:'Cothrom Gorge',offset:[0.25,0.5]}, '185':{name:'World\'s End',offset:[1.25,0]}, '186':{name:'Vigilant Rock',offset:[1.75,1]} }, gridData:[ { pre:'images/hybrasil/m_', suf:'.jpg', gridSize : [5,7], tileSize : 125, zoneSize : 125 }, { pre:'images/hybrasil/25d_', suf:'.jpg', gridSize : [6,7], tileSize : 128, zoneSize : 256 }, { pre:'images/hybrasil/5c_', suf:'.jpg', gridSize : [6,7], tileSize : 256, zoneSize : 512 }, { pre:'images/hybrasil/1k_', suf:'.jpg', gridSize : [6,7], tileSize : 512, zoneSize : 1024 }, { pre:'images/hybrasil/2k_', suf:'.jpg', gridSize : [12,14], tileSize : 512, zoneSize : 2048 } ] }, Avalon:{ zones:{ '051':{name:'Isle of Glass',offset:[3,2]}, '052':{name:'Avalon Isle',offset:[2,1.25]}, '053':{name:'Dales of Devwy',offset:[1.25,0.25]}, '054':{name:'Caldey',offset:[0.25,0]}, '055':{name:'Plain of Gwyddneau',offset:[0,1]}, '056':{name:'Aldland',offset:[1,1.75]} }, gridData:[ {}, { pre:'images/avalon/25d_', suf:'.jpg', gridSize : [4,3], tileSize : 256, zoneSize : 256 }, { pre:'images/avalon/5c_', suf:'.jpg', gridSize : [8,6], tileSize : 256, zoneSize : 512 }, { pre:'images/avalon/1k_', suf:'.jpg', gridSize : [8,6], tileSize : 512, zoneSize : 1024 }, { pre:'images/avalon/2k_', suf:'.jpg', gridSize : [16,12], tileSize : 512, zoneSize : 2048 } ] }, Aegir:{ zones:{ '151':{name:'Aegir\'s Landing',offset:[0,1]}, '152':{name:'Gripklosa Mountains',offset:[0.5,0]}, '153':{name:'Delling Crater',offset:[1.5,0.25]}, '154':{name:'Faraheim',offset:[1.75,1.25]}, '155':{name:'Munin Sound',offset:[0.75,2]}, '156':{name:'Iarnwood',offset:[2.25,2.25]} //'157':{name:'Dummy Zone',offset:[,]} }, gridData:[ {}, { pre:'images/aegir/25d_', suf:'.jpg', gridSize : [7,7], tileSize : 128, zoneSize : 256 }, { pre:'images/aegir/5c_', suf:'.jpg', gridSize : [7,7], tileSize : 256, zoneSize : 512 }, { pre:'images/aegir/1k_', suf:'.jpg', gridSize : [13,13], tileSize : 256, zoneSize : 1024 }, { pre:'images/aegir/2k_', suf:'.jpg', gridSize : [13,13], tileSize : 512, zoneSize : 2048 } ] } }; var mapBase="d:/daoc/maps/"; var htmlBase="c:/webprojects/daocmapscroller/"; preferences.rulerUnits = Units.PIXELS; displayDialogs = DialogModes.NO; var bgGrey = new SolidColor(); bgGrey.rgb.hexValue='bababa'; function MakeCompilations(){ //For each realm, iterates through all sizes, pulls in all the zone files, and //shoves them into one common zone file, placed according to their offset for (var realmName in realms){ var pathBase = mapBase+realmName+"/"; var realm = realms[realmName]; //Figure out the size for the compilation //...as a multiple of the original files var maxX=0,maxY=0; for (var zoneNumber in realm.zones){ maxX=Math.max(maxX,realm.zones[zoneNumber].offset[0]); maxY=Math.max(maxY,realm.zones[zoneNumber].offset[1]); } for (var i=0,len=sizes.length;i512){ //For the really large files, there happen to be two //source files which need to be merged before the //merged file is placed in the compilation file = new File(pathBase+shortZoneName+"_"+size+"_nc.png"); if (!file.exists){ alert("Uh-oh...where is "+pathBase+shortZoneName+"_"+size+"_nc.png"); break; } var ncdoc = open(file); ncdoc.selection.selectAll(); ncdoc.selection.copy(); ncdoc.close(SaveOptions.DONOTSAVECHANGES); childDoc.selection.selectAll(); childDoc.paste(); childDoc.activeLayer.opacity=80; childDoc.flatten(); } childDoc.selection.selectAll(); childDoc.selection.copy(); childDoc.close(SaveOptions.DONOTSAVECHANGES); var x=zoneInfo.offset[0]; var y=zoneInfo.offset[1]; //preselect a rectangular area in the compilation document //which is the same size as a source file //and placed where the content of the paste should go var bounds = [ [x*size,y*size], [(x+1)*size,y*size], [(x+1)*size,(y+1)*size], [x*size,(y+1)*size] ]; theDoc.selection.select(bounds); theDoc.paste(true); } if (filesFound>0){ var saveOpts = new PNGSaveOptions(); saveOpts.interlaced=false; theDoc.flatten(); purge(PurgeTarget.ALLCACHES); theDoc.saveAs(new File(pathBase+documentName+".png"),saveOpts); } theDoc.close(SaveOptions.DONOTSAVECHANGES); } } } var tileSaveOpts = new JPEGSaveOptions(); tileSaveOpts.formatOptions=FormatOptions.OPTIMIZEDBASELINE; tileSaveOpts.quality=6; function MakeTiles(){ //Opens up each compilation file created with MakeCompilations() and runs //a square selection object through it, saving out as sequentially numbered //files. Done this way rather than ImageReady both for automation of all //realms/sizes and also because ImageReady becomes unreasonable slow for //the 1k files and can't handle the 2k files with my memory allocation. for (var realmName in realms){ var realm = realms[realmName]; var pathBase = mapBase+realmName+"/"; for (var i=0,len=sizes.length;i