您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

230 行
3.5 KiB

  1. const imageSize = require('image-size');
  2. const events = require('../misc/events');
  3. const tos = require('./tos');
  4. const config = {
  5. logoPath: null,
  6. loginBgGeneratorPath: null,
  7. resourceList: [],
  8. textureList: [
  9. 'tiles',
  10. 'walls',
  11. 'mobs',
  12. 'bosses',
  13. 'animBigObjects',
  14. 'bigObjects',
  15. 'objects',
  16. 'characters',
  17. 'attacks',
  18. 'ui',
  19. 'auras',
  20. 'animChar',
  21. 'animMob',
  22. 'animBoss',
  23. 'white',
  24. 'ray'
  25. ],
  26. //Textures that are 24x24. The renderer needs to know this
  27. bigTextures: [
  28. 'animBigObjects',
  29. 'animBoss',
  30. 'bigObjects',
  31. 'bosses',
  32. 'auras'
  33. ],
  34. atlasTextures: [
  35. 'tiles',
  36. 'walls',
  37. 'objects'
  38. ],
  39. tileOpacities: {
  40. default: {
  41. default: 0.4,
  42. max: 1
  43. },
  44. tiles: {
  45. default: 0.4,
  46. max: 0.55,
  47. 5: 0.7,
  48. 6: 0.9,
  49. 23: 0.9,
  50. 24: 0.9,
  51. 25: 0.9,
  52. 50: 1,
  53. 51: 1,
  54. 52: 1,
  55. 53: 0.7,
  56. 54: 0.5,
  57. 57: 1,
  58. 58: 1,
  59. 59: 1,
  60. 60: 0.9,
  61. 61: 0.9,
  62. 62: 0.75,
  63. 76: 0.9,
  64. 80: 1,
  65. 81: 1,
  66. 82: 1,
  67. 83: 1,
  68. 87: 1,
  69. 90: 1,
  70. 95: 1,
  71. 102: 0.9,
  72. 152: 0.9,
  73. 153: 1,
  74. 163: 0.9,
  75. //snow
  76. 176: 0.55,
  77. 184: 0.55,
  78. 185: 0.55
  79. },
  80. objects: {
  81. default: 0.9,
  82. 50: 1
  83. },
  84. walls: {
  85. default: 0.85,
  86. max: 1,
  87. 84: 1,
  88. 103: 0.9,
  89. 107: 0.9,
  90. 116: 1,
  91. 120: 0.9,
  92. 132: 0.9,
  93. 133: 0.9,
  94. 134: 0.85,
  95. 139: 1,
  96. 148: 1,
  97. 150: 0.85,
  98. 156: 1,
  99. 157: 1,
  100. 158: 1,
  101. 159: 1,
  102. 160: 0.9,
  103. 161: 1,
  104. 162: 1,
  105. 163: 1,
  106. 164: 0.8,
  107. 165: 1,
  108. 166: 0.95,
  109. 167: 1,
  110. 168: 1,
  111. 169: 1
  112. }
  113. },
  114. tilesNoFlip: {
  115. tiles: [
  116. //Stairs
  117. 171, 179
  118. ],
  119. walls: [
  120. //Ledges
  121. 156, 158, 162, 163, 167, 168,
  122. //Wall Sign
  123. 189,
  124. //Stone Ledges
  125. 195, 196, 197, 198, 199, 200, 201, 202, 203,
  126. //Ship Edges
  127. 204, 205, 206, 207, 214, 215, 220, 221, 222, 223,
  128. //Gray wall sides and corners
  129. 230, 231, 238, 239
  130. ],
  131. objects: [
  132. //Clotheslines
  133. 96, 101,
  134. //Table Sides
  135. 103, 110, 118, 126,
  136. //Wall-mounted plants
  137. 120, 122, 140,
  138. //Ship oars
  139. 140, 143,
  140. //Ship Cannons
  141. 141, 142,
  142. //Tent Pegs
  143. 168, 169
  144. ]
  145. },
  146. uiLoginList: [
  147. 'login'
  148. ],
  149. uiList: [
  150. 'inventory',
  151. 'equipment',
  152. 'hud',
  153. 'target',
  154. 'menu',
  155. 'spells',
  156. 'online',
  157. 'mainMenu',
  158. 'context',
  159. 'party',
  160. 'help',
  161. 'dialogue',
  162. 'buffs',
  163. 'tooltips',
  164. 'tooltipInfo',
  165. 'tooltipItem',
  166. 'announcements',
  167. 'quests',
  168. 'events',
  169. 'progressBar',
  170. 'stash',
  171. 'talk',
  172. 'trade',
  173. 'overlay',
  174. 'death',
  175. 'leaderboard',
  176. 'reputation',
  177. 'wardrobe',
  178. 'passives',
  179. 'workbench',
  180. 'middleHud',
  181. 'options'
  182. ],
  183. contextMenuActions: {
  184. player: [],
  185. npc: []
  186. },
  187. sounds: {
  188. ui: []
  189. },
  190. tos
  191. };
  192. module.exports = {
  193. config,
  194. atlasTextureDimensions: {},
  195. init: async function () {
  196. events.emit('onBeforeGetClientConfig', config);
  197. //Deprecated
  198. events.emit('onBeforeGetResourceList', config.resourceList);
  199. events.emit('onBeforeGetUiList', config.uiList);
  200. events.emit('onBeforeGetContextMenuActions', config.contextMenuActions);
  201. events.emit('onBeforeGetTermsOfService', config.tos);
  202. events.emit('onBeforeGetTextureList', config.textureList);
  203. await this.calculateAtlasTextureDimensions();
  204. },
  205. //The client needs to know this as well as the map loader
  206. calculateAtlasTextureDimensions: async function () {
  207. for (const tex of config.atlasTextures) {
  208. const path = tex.includes('.png') ? `../${tex}` : `../client/images/${tex}.png`;
  209. const dimensions = await imageSize(path);
  210. delete dimensions.type;
  211. this.atlasTextureDimensions[tex] = dimensions;
  212. }
  213. },
  214. //Used to send to clients
  215. getClientConfig: function (msg) {
  216. msg.callback(config);
  217. }
  218. };