Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

284 linhas
7.1 KiB

  1. define([
  2. ], function (
  3. ) {
  4. return {
  5. name: `Merrywinter`,
  6. description: `The Winter Man has returned to the isles, bringing gifts, games and snow.`,
  7. distance: -1,
  8. cron: '0 0 2-31 12 *',
  9. disabled: true,
  10. events: {
  11. },
  12. helpers: {
  13. },
  14. phases: [{
  15. type: 'spawnMob',
  16. mobs: {
  17. name: 'The Winter Man',
  18. attackable: false,
  19. level: 20,
  20. cell: 2,
  21. sheetName: 'server/mods/event-xmas/images/mobs.png',
  22. id: 'giftyBags',
  23. hpMult: 1,
  24. pos: {
  25. x: 106,
  26. y: 46
  27. },
  28. dialogue: {
  29. auto: true,
  30. config: {
  31. '1': {
  32. msg: [{
  33. msg: `A visitor, welcome!`,
  34. options: [1.1, 1.2, 1.3]
  35. }],
  36. options: {
  37. '1.1': {
  38. msg: `Who are you?`,
  39. goto: '2'
  40. },
  41. '1.2': {
  42. msg: `I would like to give you some snowflakes.`,
  43. goto: 'giveSnowflakes'
  44. },
  45. '1.3': {
  46. msg: `Do you have anything for sale?`,
  47. goto: 'tradeBuy'
  48. }
  49. }
  50. },
  51. '2': {
  52. msg: [{
  53. msg: `I am the place where snow began, for I am the Winter Man.`,
  54. options: [2.1]
  55. }],
  56. options: {
  57. '2.1': {
  58. msg: `What are you doing here?`,
  59. goto: '3'
  60. }
  61. }
  62. },
  63. '3': {
  64. msg: [{
  65. msg: `I came in the night to bring the cold, have you not heard the story told?`,
  66. options: [3.1]
  67. }],
  68. options: {
  69. '3.1': {
  70. msg: `Could you tell it to me?`,
  71. goto: '4'
  72. }
  73. }
  74. },
  75. '4': {
  76. msg: [{
  77. msg: `On the shortest night each year, the Man of Winter lends an ear<br />To wishes mouthed in quiet ire; injustices or things required<br />He'll send them gifts in the strangest places; fishing lines or fireplaces<br />For the Winter Man has come to give, to the poor and lonely and those who grieve<br /><br />And when the snows have come to pass, the Winter Man only one thing asks<br />That should you sense someone desire, you'll assist as they require<br />Then when winter comes around again, keep an eye out for your icy friend<br />For he is the place where cold began at the start of time; the Winter Man`,
  78. options: [1.2, 1.3]
  79. }]
  80. },
  81. giveSnowflakes: {
  82. msg: [{
  83. msg: `Why, thank you!`,
  84. options: [1.1]
  85. }],
  86. method: function (obj) {
  87. var inventory = obj.inventory;
  88. var snowflakes = inventory.items.find(i => (i.name == 'Snowflake'));
  89. if ((!snowflakes) || (snowflakes.quantity < 15))
  90. return 'Sorry, please come back when you have at least fifteen.'
  91. while (true) {
  92. snowflakes = inventory.items.find(i => (i.name == 'Snowflake'));
  93. if ((!snowflakes) || (snowflakes.quantity < 15))
  94. return;
  95. else if ((!inventory.hasSpace()) && (snowflakes.quantity != 15))
  96. return `Sorry, it seems you don't have enough space to accept my gifts.`;
  97. obj.reputation.getReputation('theWinterMan', 100);
  98. var chances = {
  99. 'Bottomless Eggnog': 3,
  100. 'Sprig of Mistletoe': 50,
  101. 'Merrywinter Play Script': 20,
  102. 'Unique Snowflake': 27
  103. };
  104. var rewards = [{
  105. name: 'Bottomless Eggnog',
  106. type: 'toy',
  107. sprite: [1, 1],
  108. spritesheet: `server/mods/event-xmas/images/items.png`,
  109. description: 'Makes you merry, makes you shine.',
  110. worth: 0,
  111. cdMax: 1714,
  112. noSalvage: true,
  113. noAugment: true
  114. }, {
  115. name: 'Sprig of Mistletoe',
  116. type: 'consumable',
  117. sprite: [3, 1],
  118. spritesheet: `server/mods/event-xmas/images/items.png`,
  119. description: `Blows a kiss to your one true love...or whoever's closest`,
  120. worth: 0,
  121. noSalvage: true,
  122. noAugment: true,
  123. uses: 5
  124. }, {
  125. name: 'Merrywinter Play Script',
  126. type: 'consumable',
  127. sprite: [2, 1],
  128. spritesheet: `server/mods/event-xmas/images/items.png`,
  129. description: 'Recites a line from the Merrywinter play',
  130. quantity: 1,
  131. worth: 0,
  132. noSalvage: true,
  133. noAugment: true
  134. }, {
  135. name: 'Unique Snowflake',
  136. spritesheet: `server/mods/event-xmas/images/items.png`,
  137. material: true,
  138. sprite: [1, 2],
  139. quantity: 1
  140. }];
  141. var pool = [];
  142. Object.keys(chances).forEach(function (c) {
  143. for (var i = 0; i < chances[c]; i++) {
  144. pool.push(c);
  145. }
  146. });
  147. var pick = pool[~~(Math.random() * pool.length)];
  148. var blueprint = rewards.find(r => (r.name == pick));
  149. inventory.getItem(extend(true, {}, blueprint));
  150. inventory.destroyItem(snowflakes.id, 15);
  151. }
  152. }
  153. },
  154. tradeBuy: {
  155. cpn: 'trade',
  156. method: 'startBuy',
  157. args: [{
  158. targetName: 'the winter man'
  159. }]
  160. }
  161. }
  162. },
  163. trade: {
  164. items: {
  165. min: 0,
  166. max: 0
  167. },
  168. forceItems: [{
  169. type: 'skin',
  170. id: '3.1',
  171. infinite: true,
  172. worth: {
  173. currency: `Unique Snowflake`,
  174. amount: 15
  175. },
  176. factions: [{
  177. id: 'theWinterMan',
  178. tier: 4
  179. }]
  180. }, {
  181. name: `Enchanted Wreath`,
  182. spritesheet: `server/mods/event-xmas/images/items.png`,
  183. sprite: [0, 2],
  184. slot: 'neck',
  185. type: 'Necklace',
  186. level: 8,
  187. quality: 3,
  188. worth: {
  189. currency: `Unique Snowflake`,
  190. amount: 4
  191. },
  192. stats: {
  193. magicFind: 35,
  194. castSpeed: 25,
  195. attackSpeed: 25
  196. },
  197. factions: [{
  198. id: 'theWinterMan',
  199. tier: 4
  200. }],
  201. infinite: true,
  202. noAugment: true,
  203. noSalvage: true,
  204. noDrop: true,
  205. noDestroy: true
  206. }],
  207. faction: {
  208. id: 'theWinterMan'
  209. },
  210. level: {
  211. min: 1,
  212. max: 5
  213. },
  214. markup: {
  215. buy: 0.25,
  216. sell: 2.5
  217. }
  218. }
  219. }
  220. }, {
  221. type: 'hookEvents',
  222. events: {
  223. onCompleteQuest: function (quest) {
  224. quest.rewards.push({
  225. name: 'Snowflake',
  226. spritesheet: `server/mods/event-xmas/images/items.png`,
  227. material: true,
  228. sprite: [3, 0],
  229. quantity: 1
  230. });
  231. },
  232. onBeforeBuildMob: function (zone, mobName, blueprint) {
  233. try {
  234. var zoneFile = require('mods/event-xmas/maps/' + zone + '/zone.js');
  235. var override = _.getDeepProperty(zoneFile, ['mobs', mobName]);
  236. if (override)
  237. extend(true, blueprint, override);
  238. } catch (e) {}
  239. },
  240. beforeGatherResource: function (gatherResult, gatherer) {
  241. var itemName = gatherResult.blueprint.itemName;
  242. if ((!itemName) || (itemName.toLowerCase() != 'snowflake'))
  243. return;
  244. gatherer.reputation.getReputation('theWinterMan', 40);
  245. if ((gatherResult.name != 'Gilded Gift') || (Math.random() >= 0.05))
  246. return;
  247. gatherResult.items.push({
  248. name: `Wizard's Vice`,
  249. spritesheet: `server/mods/event-xmas/images/items.png`,
  250. type: 'Reward Card',
  251. description: `Reward: Scented Beard Oil`,
  252. noSalvage: true,
  253. sprite: [0, 1],
  254. quantity: 1,
  255. quality: 2,
  256. setSize: 5
  257. });
  258. }
  259. }
  260. }]
  261. };
  262. });