rpg-event-generator 1.2.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (436) hide show
  1. package/README.md +548 -4
  2. package/demo.js +705 -460
  3. package/dist/index.js +504 -7
  4. package/package.json +17 -3
  5. package/scripts/event-economy.js +388 -0
  6. package/scripts/export-templates.js +289 -0
  7. package/scripts/generate-templates.js +407 -0
  8. package/templates/cyberpunk/event_100.json +43 -0
  9. package/templates/cyberpunk/event_11.json +42 -0
  10. package/templates/cyberpunk/event_14.json +42 -0
  11. package/templates/cyberpunk/event_15.json +43 -0
  12. package/templates/cyberpunk/event_16.json +43 -0
  13. package/templates/cyberpunk/event_18.json +44 -0
  14. package/templates/cyberpunk/event_2.json +42 -0
  15. package/templates/cyberpunk/event_26.json +42 -0
  16. package/templates/cyberpunk/event_27.json +43 -0
  17. package/templates/cyberpunk/event_3.json +43 -0
  18. package/templates/cyberpunk/event_30.json +42 -0
  19. package/templates/cyberpunk/event_32.json +42 -0
  20. package/templates/cyberpunk/event_36.json +43 -0
  21. package/templates/cyberpunk/event_37.json +42 -0
  22. package/templates/cyberpunk/event_39.json +42 -0
  23. package/templates/cyberpunk/event_4.json +42 -0
  24. package/templates/cyberpunk/event_40.json +42 -0
  25. package/templates/cyberpunk/event_42.json +43 -0
  26. package/templates/cyberpunk/event_46.json +43 -0
  27. package/templates/cyberpunk/event_49.json +44 -0
  28. package/templates/cyberpunk/event_5.json +44 -0
  29. package/templates/cyberpunk/event_50.json +42 -0
  30. package/templates/cyberpunk/event_51.json +42 -0
  31. package/templates/cyberpunk/event_54.json +43 -0
  32. package/templates/cyberpunk/event_55.json +44 -0
  33. package/templates/cyberpunk/event_57.json +42 -0
  34. package/templates/cyberpunk/event_58.json +42 -0
  35. package/templates/cyberpunk/event_61.json +43 -0
  36. package/templates/cyberpunk/event_62.json +43 -0
  37. package/templates/cyberpunk/event_64.json +42 -0
  38. package/templates/cyberpunk/event_65.json +42 -0
  39. package/templates/cyberpunk/event_66.json +42 -0
  40. package/templates/cyberpunk/event_68.json +43 -0
  41. package/templates/cyberpunk/event_69.json +43 -0
  42. package/templates/cyberpunk/event_71.json +42 -0
  43. package/templates/cyberpunk/event_72.json +42 -0
  44. package/templates/cyberpunk/event_73.json +42 -0
  45. package/templates/cyberpunk/event_74.json +42 -0
  46. package/templates/cyberpunk/event_75.json +44 -0
  47. package/templates/cyberpunk/event_76.json +43 -0
  48. package/templates/cyberpunk/event_78.json +43 -0
  49. package/templates/cyberpunk/event_79.json +42 -0
  50. package/templates/cyberpunk/event_8.json +42 -0
  51. package/templates/cyberpunk/event_80.json +43 -0
  52. package/templates/cyberpunk/event_81.json +43 -0
  53. package/templates/cyberpunk/event_83.json +44 -0
  54. package/templates/cyberpunk/event_84.json +43 -0
  55. package/templates/cyberpunk/event_86.json +44 -0
  56. package/templates/cyberpunk/event_88.json +43 -0
  57. package/templates/cyberpunk/event_9.json +42 -0
  58. package/templates/cyberpunk/event_91.json +42 -0
  59. package/templates/cyberpunk/event_92.json +43 -0
  60. package/templates/cyberpunk/event_93.json +42 -0
  61. package/templates/cyberpunk/event_95.json +42 -0
  62. package/templates/cyberpunk/event_96.json +43 -0
  63. package/templates/cyberpunk/event_97.json +43 -0
  64. package/templates/cyberpunk/event_98.json +42 -0
  65. package/templates/cyberpunk/event_99.json +42 -0
  66. package/templates/fantasy/dragon_lair.json +28 -0
  67. package/templates/fantasy/event_1.json +44 -0
  68. package/templates/fantasy/event_10.json +43 -0
  69. package/templates/fantasy/event_11.json +43 -0
  70. package/templates/fantasy/event_12.json +42 -0
  71. package/templates/fantasy/event_13.json +43 -0
  72. package/templates/fantasy/event_16.json +44 -0
  73. package/templates/fantasy/event_20.json +42 -0
  74. package/templates/fantasy/event_21.json +42 -0
  75. package/templates/fantasy/event_22.json +42 -0
  76. package/templates/fantasy/event_23.json +42 -0
  77. package/templates/fantasy/event_24.json +43 -0
  78. package/templates/fantasy/event_27.json +43 -0
  79. package/templates/fantasy/event_29.json +43 -0
  80. package/templates/fantasy/event_3.json +42 -0
  81. package/templates/fantasy/event_30.json +43 -0
  82. package/templates/fantasy/event_31.json +42 -0
  83. package/templates/fantasy/event_33.json +42 -0
  84. package/templates/fantasy/event_34.json +43 -0
  85. package/templates/fantasy/event_36.json +43 -0
  86. package/templates/fantasy/event_38.json +43 -0
  87. package/templates/fantasy/event_39.json +42 -0
  88. package/templates/fantasy/event_4.json +44 -0
  89. package/templates/fantasy/event_41.json +43 -0
  90. package/templates/fantasy/event_44.json +42 -0
  91. package/templates/fantasy/event_45.json +42 -0
  92. package/templates/fantasy/event_46.json +42 -0
  93. package/templates/fantasy/event_47.json +42 -0
  94. package/templates/fantasy/event_48.json +42 -0
  95. package/templates/fantasy/event_5.json +42 -0
  96. package/templates/fantasy/event_50.json +44 -0
  97. package/templates/fantasy/event_51.json +43 -0
  98. package/templates/fantasy/event_54.json +43 -0
  99. package/templates/fantasy/event_55.json +43 -0
  100. package/templates/fantasy/event_57.json +44 -0
  101. package/templates/fantasy/event_58.json +44 -0
  102. package/templates/fantasy/event_6.json +42 -0
  103. package/templates/fantasy/event_64.json +42 -0
  104. package/templates/fantasy/event_68.json +42 -0
  105. package/templates/fantasy/event_69.json +43 -0
  106. package/templates/fantasy/event_70.json +42 -0
  107. package/templates/fantasy/event_71.json +42 -0
  108. package/templates/fantasy/event_72.json +43 -0
  109. package/templates/fantasy/event_73.json +42 -0
  110. package/templates/fantasy/event_76.json +43 -0
  111. package/templates/fantasy/event_77.json +43 -0
  112. package/templates/fantasy/event_79.json +42 -0
  113. package/templates/fantasy/event_88.json +42 -0
  114. package/templates/fantasy/event_9.json +44 -0
  115. package/templates/fantasy/event_90.json +43 -0
  116. package/templates/fantasy/event_91.json +42 -0
  117. package/templates/fantasy/event_92.json +42 -0
  118. package/templates/fantasy/event_94.json +43 -0
  119. package/templates/fantasy/event_96.json +42 -0
  120. package/templates/fantasy/event_97.json +42 -0
  121. package/templates/fantasy/event_98.json +42 -0
  122. package/templates/fantasy/event_99.json +42 -0
  123. package/templates/fantasy/magic_shop.json +28 -0
  124. package/templates/historical/court_intrigue.json +28 -0
  125. package/templates/historical/event_1.json +44 -0
  126. package/templates/historical/event_10.json +42 -0
  127. package/templates/historical/event_11.json +44 -0
  128. package/templates/historical/event_14.json +44 -0
  129. package/templates/historical/event_17.json +44 -0
  130. package/templates/historical/event_2.json +43 -0
  131. package/templates/historical/event_20.json +43 -0
  132. package/templates/historical/event_21.json +44 -0
  133. package/templates/historical/event_22.json +43 -0
  134. package/templates/historical/event_25.json +43 -0
  135. package/templates/historical/event_26.json +42 -0
  136. package/templates/historical/event_3.json +43 -0
  137. package/templates/historical/event_30.json +42 -0
  138. package/templates/historical/event_33.json +44 -0
  139. package/templates/historical/event_34.json +42 -0
  140. package/templates/historical/event_39.json +42 -0
  141. package/templates/historical/event_4.json +44 -0
  142. package/templates/historical/event_40.json +42 -0
  143. package/templates/historical/event_42.json +42 -0
  144. package/templates/historical/event_44.json +43 -0
  145. package/templates/historical/event_45.json +43 -0
  146. package/templates/historical/event_48.json +42 -0
  147. package/templates/historical/event_50.json +42 -0
  148. package/templates/historical/event_52.json +42 -0
  149. package/templates/historical/event_53.json +44 -0
  150. package/templates/historical/event_54.json +44 -0
  151. package/templates/historical/event_56.json +42 -0
  152. package/templates/historical/event_57.json +42 -0
  153. package/templates/historical/event_59.json +42 -0
  154. package/templates/historical/event_60.json +43 -0
  155. package/templates/historical/event_61.json +42 -0
  156. package/templates/historical/event_62.json +44 -0
  157. package/templates/historical/event_63.json +42 -0
  158. package/templates/historical/event_64.json +43 -0
  159. package/templates/historical/event_65.json +44 -0
  160. package/templates/historical/event_66.json +42 -0
  161. package/templates/historical/event_67.json +43 -0
  162. package/templates/historical/event_69.json +43 -0
  163. package/templates/historical/event_7.json +42 -0
  164. package/templates/historical/event_70.json +42 -0
  165. package/templates/historical/event_71.json +43 -0
  166. package/templates/historical/event_74.json +42 -0
  167. package/templates/historical/event_75.json +43 -0
  168. package/templates/historical/event_79.json +42 -0
  169. package/templates/historical/event_8.json +44 -0
  170. package/templates/historical/event_80.json +43 -0
  171. package/templates/historical/event_82.json +42 -0
  172. package/templates/historical/event_87.json +43 -0
  173. package/templates/historical/event_89.json +43 -0
  174. package/templates/historical/event_9.json +43 -0
  175. package/templates/historical/event_90.json +44 -0
  176. package/templates/historical/event_91.json +42 -0
  177. package/templates/historical/event_92.json +43 -0
  178. package/templates/historical/event_94.json +42 -0
  179. package/templates/historical/event_97.json +42 -0
  180. package/templates/horror/event_1.json +42 -0
  181. package/templates/horror/event_100.json +42 -0
  182. package/templates/horror/event_12.json +42 -0
  183. package/templates/horror/event_13.json +43 -0
  184. package/templates/horror/event_14.json +44 -0
  185. package/templates/horror/event_15.json +42 -0
  186. package/templates/horror/event_16.json +43 -0
  187. package/templates/horror/event_17.json +43 -0
  188. package/templates/horror/event_18.json +42 -0
  189. package/templates/horror/event_2.json +44 -0
  190. package/templates/horror/event_20.json +43 -0
  191. package/templates/horror/event_23.json +42 -0
  192. package/templates/horror/event_27.json +43 -0
  193. package/templates/horror/event_28.json +42 -0
  194. package/templates/horror/event_29.json +42 -0
  195. package/templates/horror/event_3.json +42 -0
  196. package/templates/horror/event_30.json +42 -0
  197. package/templates/horror/event_32.json +42 -0
  198. package/templates/horror/event_34.json +42 -0
  199. package/templates/horror/event_35.json +43 -0
  200. package/templates/horror/event_36.json +43 -0
  201. package/templates/horror/event_37.json +43 -0
  202. package/templates/horror/event_38.json +44 -0
  203. package/templates/horror/event_39.json +42 -0
  204. package/templates/horror/event_40.json +42 -0
  205. package/templates/horror/event_41.json +42 -0
  206. package/templates/horror/event_42.json +43 -0
  207. package/templates/horror/event_43.json +43 -0
  208. package/templates/horror/event_45.json +42 -0
  209. package/templates/horror/event_46.json +44 -0
  210. package/templates/horror/event_47.json +42 -0
  211. package/templates/horror/event_50.json +43 -0
  212. package/templates/horror/event_52.json +44 -0
  213. package/templates/horror/event_53.json +43 -0
  214. package/templates/horror/event_55.json +43 -0
  215. package/templates/horror/event_56.json +44 -0
  216. package/templates/horror/event_58.json +42 -0
  217. package/templates/horror/event_59.json +42 -0
  218. package/templates/horror/event_60.json +43 -0
  219. package/templates/horror/event_61.json +44 -0
  220. package/templates/horror/event_62.json +42 -0
  221. package/templates/horror/event_63.json +43 -0
  222. package/templates/horror/event_65.json +42 -0
  223. package/templates/horror/event_67.json +43 -0
  224. package/templates/horror/event_68.json +44 -0
  225. package/templates/horror/event_72.json +42 -0
  226. package/templates/horror/event_73.json +44 -0
  227. package/templates/horror/event_74.json +43 -0
  228. package/templates/horror/event_77.json +42 -0
  229. package/templates/horror/event_79.json +43 -0
  230. package/templates/horror/event_8.json +42 -0
  231. package/templates/horror/event_82.json +43 -0
  232. package/templates/horror/event_83.json +42 -0
  233. package/templates/horror/event_84.json +42 -0
  234. package/templates/horror/event_86.json +43 -0
  235. package/templates/horror/event_88.json +42 -0
  236. package/templates/horror/event_89.json +43 -0
  237. package/templates/horror/event_9.json +43 -0
  238. package/templates/horror/event_90.json +44 -0
  239. package/templates/horror/event_91.json +43 -0
  240. package/templates/horror/event_93.json +42 -0
  241. package/templates/horror/event_95.json +42 -0
  242. package/templates/horror/event_96.json +43 -0
  243. package/templates/horror/event_99.json +42 -0
  244. package/templates/horror/haunted_mansion.json +28 -0
  245. package/templates/index.json +475 -0
  246. package/templates/modern/event_10.json +42 -0
  247. package/templates/modern/event_100.json +43 -0
  248. package/templates/modern/event_11.json +44 -0
  249. package/templates/modern/event_13.json +42 -0
  250. package/templates/modern/event_15.json +43 -0
  251. package/templates/modern/event_16.json +42 -0
  252. package/templates/modern/event_17.json +42 -0
  253. package/templates/modern/event_19.json +43 -0
  254. package/templates/modern/event_2.json +42 -0
  255. package/templates/modern/event_20.json +42 -0
  256. package/templates/modern/event_21.json +43 -0
  257. package/templates/modern/event_22.json +43 -0
  258. package/templates/modern/event_23.json +43 -0
  259. package/templates/modern/event_25.json +43 -0
  260. package/templates/modern/event_27.json +42 -0
  261. package/templates/modern/event_28.json +42 -0
  262. package/templates/modern/event_31.json +42 -0
  263. package/templates/modern/event_32.json +43 -0
  264. package/templates/modern/event_34.json +44 -0
  265. package/templates/modern/event_35.json +42 -0
  266. package/templates/modern/event_36.json +44 -0
  267. package/templates/modern/event_37.json +42 -0
  268. package/templates/modern/event_39.json +42 -0
  269. package/templates/modern/event_4.json +42 -0
  270. package/templates/modern/event_41.json +42 -0
  271. package/templates/modern/event_42.json +44 -0
  272. package/templates/modern/event_43.json +42 -0
  273. package/templates/modern/event_44.json +44 -0
  274. package/templates/modern/event_45.json +44 -0
  275. package/templates/modern/event_46.json +44 -0
  276. package/templates/modern/event_47.json +43 -0
  277. package/templates/modern/event_48.json +42 -0
  278. package/templates/modern/event_49.json +43 -0
  279. package/templates/modern/event_5.json +43 -0
  280. package/templates/modern/event_51.json +42 -0
  281. package/templates/modern/event_52.json +42 -0
  282. package/templates/modern/event_55.json +43 -0
  283. package/templates/modern/event_56.json +42 -0
  284. package/templates/modern/event_57.json +42 -0
  285. package/templates/modern/event_59.json +42 -0
  286. package/templates/modern/event_6.json +43 -0
  287. package/templates/modern/event_60.json +43 -0
  288. package/templates/modern/event_61.json +42 -0
  289. package/templates/modern/event_63.json +42 -0
  290. package/templates/modern/event_64.json +42 -0
  291. package/templates/modern/event_66.json +42 -0
  292. package/templates/modern/event_67.json +42 -0
  293. package/templates/modern/event_69.json +42 -0
  294. package/templates/modern/event_7.json +43 -0
  295. package/templates/modern/event_70.json +42 -0
  296. package/templates/modern/event_72.json +43 -0
  297. package/templates/modern/event_74.json +43 -0
  298. package/templates/modern/event_78.json +42 -0
  299. package/templates/modern/event_8.json +42 -0
  300. package/templates/modern/event_80.json +44 -0
  301. package/templates/modern/event_81.json +43 -0
  302. package/templates/modern/event_82.json +42 -0
  303. package/templates/modern/event_83.json +42 -0
  304. package/templates/modern/event_84.json +44 -0
  305. package/templates/modern/event_85.json +42 -0
  306. package/templates/modern/event_86.json +42 -0
  307. package/templates/modern/event_87.json +44 -0
  308. package/templates/modern/event_89.json +42 -0
  309. package/templates/modern/event_94.json +42 -0
  310. package/templates/modern/event_97.json +43 -0
  311. package/templates/modern/event_98.json +42 -0
  312. package/templates/modern/event_99.json +44 -0
  313. package/templates/schema.json +87 -0
  314. package/templates/sci-fi/alien_encounter.json +28 -0
  315. package/templates/sci-fi/event_1.json +42 -0
  316. package/templates/sci-fi/event_11.json +43 -0
  317. package/templates/sci-fi/event_13.json +43 -0
  318. package/templates/sci-fi/event_15.json +43 -0
  319. package/templates/sci-fi/event_18.json +42 -0
  320. package/templates/sci-fi/event_19.json +43 -0
  321. package/templates/sci-fi/event_2.json +44 -0
  322. package/templates/sci-fi/event_22.json +42 -0
  323. package/templates/sci-fi/event_23.json +42 -0
  324. package/templates/sci-fi/event_24.json +43 -0
  325. package/templates/sci-fi/event_25.json +42 -0
  326. package/templates/sci-fi/event_27.json +43 -0
  327. package/templates/sci-fi/event_28.json +43 -0
  328. package/templates/sci-fi/event_30.json +43 -0
  329. package/templates/sci-fi/event_31.json +42 -0
  330. package/templates/sci-fi/event_32.json +42 -0
  331. package/templates/sci-fi/event_33.json +44 -0
  332. package/templates/sci-fi/event_34.json +42 -0
  333. package/templates/sci-fi/event_35.json +42 -0
  334. package/templates/sci-fi/event_36.json +42 -0
  335. package/templates/sci-fi/event_37.json +44 -0
  336. package/templates/sci-fi/event_39.json +43 -0
  337. package/templates/sci-fi/event_4.json +43 -0
  338. package/templates/sci-fi/event_41.json +42 -0
  339. package/templates/sci-fi/event_45.json +42 -0
  340. package/templates/sci-fi/event_47.json +43 -0
  341. package/templates/sci-fi/event_48.json +42 -0
  342. package/templates/sci-fi/event_50.json +43 -0
  343. package/templates/sci-fi/event_51.json +42 -0
  344. package/templates/sci-fi/event_53.json +42 -0
  345. package/templates/sci-fi/event_54.json +43 -0
  346. package/templates/sci-fi/event_55.json +42 -0
  347. package/templates/sci-fi/event_56.json +43 -0
  348. package/templates/sci-fi/event_59.json +42 -0
  349. package/templates/sci-fi/event_6.json +42 -0
  350. package/templates/sci-fi/event_60.json +43 -0
  351. package/templates/sci-fi/event_64.json +44 -0
  352. package/templates/sci-fi/event_65.json +43 -0
  353. package/templates/sci-fi/event_67.json +42 -0
  354. package/templates/sci-fi/event_7.json +42 -0
  355. package/templates/sci-fi/event_72.json +42 -0
  356. package/templates/sci-fi/event_73.json +43 -0
  357. package/templates/sci-fi/event_74.json +44 -0
  358. package/templates/sci-fi/event_75.json +43 -0
  359. package/templates/sci-fi/event_78.json +42 -0
  360. package/templates/sci-fi/event_80.json +42 -0
  361. package/templates/sci-fi/event_82.json +43 -0
  362. package/templates/sci-fi/event_83.json +44 -0
  363. package/templates/sci-fi/event_85.json +42 -0
  364. package/templates/sci-fi/event_87.json +42 -0
  365. package/templates/sci-fi/event_89.json +42 -0
  366. package/templates/sci-fi/event_9.json +42 -0
  367. package/templates/sci-fi/event_90.json +43 -0
  368. package/templates/sci-fi/event_92.json +44 -0
  369. package/templates/sci-fi/event_93.json +42 -0
  370. package/templates/sci-fi/event_94.json +42 -0
  371. package/templates/sci-fi/event_95.json +43 -0
  372. package/templates/sci-fi/event_96.json +43 -0
  373. package/templates/sci-fi/event_97.json +42 -0
  374. package/templates/space-opera/event_1.json +44 -0
  375. package/templates/space-opera/event_10.json +42 -0
  376. package/templates/space-opera/event_100.json +42 -0
  377. package/templates/space-opera/event_12.json +42 -0
  378. package/templates/space-opera/event_13.json +44 -0
  379. package/templates/space-opera/event_14.json +43 -0
  380. package/templates/space-opera/event_15.json +43 -0
  381. package/templates/space-opera/event_17.json +42 -0
  382. package/templates/space-opera/event_18.json +43 -0
  383. package/templates/space-opera/event_19.json +42 -0
  384. package/templates/space-opera/event_20.json +43 -0
  385. package/templates/space-opera/event_21.json +42 -0
  386. package/templates/space-opera/event_24.json +44 -0
  387. package/templates/space-opera/event_25.json +42 -0
  388. package/templates/space-opera/event_26.json +43 -0
  389. package/templates/space-opera/event_27.json +43 -0
  390. package/templates/space-opera/event_28.json +43 -0
  391. package/templates/space-opera/event_29.json +44 -0
  392. package/templates/space-opera/event_31.json +42 -0
  393. package/templates/space-opera/event_32.json +42 -0
  394. package/templates/space-opera/event_33.json +42 -0
  395. package/templates/space-opera/event_35.json +42 -0
  396. package/templates/space-opera/event_36.json +44 -0
  397. package/templates/space-opera/event_38.json +43 -0
  398. package/templates/space-opera/event_40.json +42 -0
  399. package/templates/space-opera/event_41.json +42 -0
  400. package/templates/space-opera/event_43.json +43 -0
  401. package/templates/space-opera/event_44.json +42 -0
  402. package/templates/space-opera/event_47.json +42 -0
  403. package/templates/space-opera/event_48.json +43 -0
  404. package/templates/space-opera/event_49.json +44 -0
  405. package/templates/space-opera/event_5.json +44 -0
  406. package/templates/space-opera/event_50.json +42 -0
  407. package/templates/space-opera/event_51.json +42 -0
  408. package/templates/space-opera/event_52.json +42 -0
  409. package/templates/space-opera/event_53.json +43 -0
  410. package/templates/space-opera/event_55.json +42 -0
  411. package/templates/space-opera/event_58.json +43 -0
  412. package/templates/space-opera/event_6.json +43 -0
  413. package/templates/space-opera/event_60.json +44 -0
  414. package/templates/space-opera/event_61.json +42 -0
  415. package/templates/space-opera/event_62.json +43 -0
  416. package/templates/space-opera/event_65.json +42 -0
  417. package/templates/space-opera/event_67.json +42 -0
  418. package/templates/space-opera/event_68.json +43 -0
  419. package/templates/space-opera/event_69.json +42 -0
  420. package/templates/space-opera/event_7.json +44 -0
  421. package/templates/space-opera/event_71.json +44 -0
  422. package/templates/space-opera/event_73.json +42 -0
  423. package/templates/space-opera/event_74.json +42 -0
  424. package/templates/space-opera/event_77.json +43 -0
  425. package/templates/space-opera/event_78.json +43 -0
  426. package/templates/space-opera/event_8.json +43 -0
  427. package/templates/space-opera/event_81.json +42 -0
  428. package/templates/space-opera/event_82.json +42 -0
  429. package/templates/space-opera/event_83.json +43 -0
  430. package/templates/space-opera/event_85.json +42 -0
  431. package/templates/space-opera/event_87.json +42 -0
  432. package/templates/space-opera/event_88.json +42 -0
  433. package/templates/space-opera/event_90.json +42 -0
  434. package/templates/space-opera/event_93.json +43 -0
  435. package/templates/space-opera/event_97.json +42 -0
  436. package/templates/space-opera/event_98.json +43 -0
package/dist/index.js CHANGED
@@ -122,13 +122,15 @@ class RPGEventGenerator {
122
122
  * @param {Array} options.trainingData - Custom training data for Markov chains
123
123
  * @param {string} options.theme - Theme for event generation: 'fantasy', 'sci-fi', 'historical'
124
124
  * @param {string} options.culture - Cultural context within theme (optional)
125
+ * @param {boolean} options.enableTemplates - Enable template library system (default: false)
126
+ * @param {string} options.templateLibrary - Genre to load templates from: 'fantasy', 'sci-fi', 'horror', 'historical'
125
127
  */
126
128
  constructor(options = {}) {
127
129
  this.chance = new Chance();
128
130
  this.markovGenerator = new SimpleMarkovGenerator({
129
131
  stateSize: options.stateSize || 2
130
132
  });
131
- this.theme = options.theme || 'fantasy';
133
+ this.theme = options.theme !== undefined ? options.theme : 'fantasy';
132
134
  this.culture = options.culture;
133
135
  this.customTemplates = new Set();
134
136
  this.customChains = new Set();
@@ -137,7 +139,16 @@ class RPGEventGenerator {
137
139
  this.enableModifiers = options.enableModifiers !== false;
138
140
  this.enableRelationships = options.enableRelationships !== false;
139
141
  this.language = options.language || 'en';
142
+ this.pureMarkovMode = options.pureMarkovMode || false;
143
+ this.enableTemplates = this.pureMarkovMode ? false : options.enableTemplates !== false;
144
+ this.templateLibrary = this.pureMarkovMode ? null : options.templateLibrary || null;
145
+ this.loadedTemplates = new Map();
146
+ this.enableRuleEngine = options.enableRuleEngine !== false;
147
+ this.customRules = options.customRules || {};
148
+ this.ruleEngine = this.initializeRuleEngine();
149
+ this.pureMarkovMode = options.pureMarkovMode || false;
140
150
  this.initializeEnhancedFeatures(options);
151
+ this.initializeTemplateSystem(options);
141
152
  this.initializeThemes();
142
153
  this.activeChains = new Map();
143
154
  this.chainDefinitions = this.initializeChainDefinitions();
@@ -928,6 +939,139 @@ class RPGEventGenerator {
928
939
  */
929
940
  generateEvent(playerContext = {}) {
930
941
  const context = this.analyzeContext(playerContext);
942
+ let event;
943
+ if (this.pureMarkovMode) {
944
+ event = this.generatePureMarkovEvent(context);
945
+ } else {
946
+ const template = this.selectTemplate(context);
947
+ const scaledChoices = this.scaleEffectsForDifficulty(this.generateContextualChoices(template.choices, context), context);
948
+ event = {
949
+ id: `event_${Date.now()}_${this.chance.guid().substring(0, 8)}`,
950
+ title: this.generateDynamicTitle(template, context),
951
+ description: this.generateRichDescription(template, context),
952
+ narrative: template.narrative,
953
+ choices: scaledChoices,
954
+ type: Object.keys(this.templates).find(key => this.templates[key] === template),
955
+ consequence: null,
956
+ context: context,
957
+ urgency: this.calculateUrgency(template, context),
958
+ theme: this.determineTheme(template, context),
959
+ difficulty: this.calculateDifficultyTier(context.power_level || 0),
960
+ tags: template.tags || []
961
+ };
962
+ }
963
+
964
+ // Apply custom rules if rule engine is enabled
965
+ if (this.enableRuleEngine) {
966
+ event = this.applyCustomRules(event, context);
967
+ }
968
+ return event;
969
+ }
970
+
971
+ /**
972
+ * Generate an event purely from Markov chains (v2.0.0)
973
+ * @param {Object} context - Generation context
974
+ * @returns {Object} Generated event
975
+ */
976
+ generatePureMarkovEvent(context) {
977
+ try {
978
+ const titleGenerated = this.markovGenerator.generate({
979
+ minLength: 15,
980
+ maxLength: 40,
981
+ maxTries: 10
982
+ });
983
+ let title = titleGenerated && titleGenerated.string ? titleGenerated.string.trim().charAt(0).toUpperCase() + titleGenerated.string.trim().slice(1) : 'Mysterious Occurrence';
984
+ if (title.length > 35) {
985
+ title = title.substring(0, 32) + '...';
986
+ }
987
+ const narrativeGenerated = this.markovGenerator.generate({
988
+ minLength: 50,
989
+ maxLength: 120,
990
+ maxTries: 15
991
+ });
992
+ const narrative = narrativeGenerated && narrativeGenerated.string ? narrativeGenerated.string : 'Something extraordinary has occurred that demands your attention.';
993
+ const descriptionGenerated = this.markovGenerator.generate({
994
+ minLength: 30,
995
+ maxLength: 80,
996
+ maxTries: 10
997
+ });
998
+ let description = narrative;
999
+ if (descriptionGenerated && descriptionGenerated.string && descriptionGenerated.string.length > 20) {
1000
+ description = descriptionGenerated.string + '. ' + narrative.charAt(0).toLowerCase() + narrative.slice(1);
1001
+ }
1002
+ const choices = this.generateMarkovChoices(context);
1003
+ return {
1004
+ id: `event_${Date.now()}_${this.chance.guid().substring(0, 8)}`,
1005
+ title: title,
1006
+ description: description,
1007
+ narrative: narrative,
1008
+ choices: choices,
1009
+ type: 'MARKOV_GENERATED',
1010
+ consequence: null,
1011
+ context: context,
1012
+ urgency: 'normal',
1013
+ theme: 'custom',
1014
+ difficulty: this.calculateDifficultyTier(context.power_level || 0),
1015
+ tags: []
1016
+ };
1017
+ } catch (error) {
1018
+ console.warn('Pure Markov generation failed, falling back to template:', error.message);
1019
+ return this.generateTemplateBasedEvent(context);
1020
+ }
1021
+ }
1022
+
1023
+ /**
1024
+ * Generate choices for pure Markov events
1025
+ * @param {Object} context - Generation context
1026
+ * @returns {Array} Generated choices
1027
+ */
1028
+ generateMarkovChoices(context) {
1029
+ const choiceTemplates = ['Embrace this opportunity and see where it leads', 'Approach cautiously and assess the situation', 'Seek advice from others before proceeding', 'Take immediate action to resolve the matter', 'Observe and learn from this experience', 'Decline involvement and move on', 'Investigate further to understand better', 'Trust your instincts and follow your heart'];
1030
+ const numChoices = this.chance.integer({
1031
+ min: 2,
1032
+ max: 4
1033
+ });
1034
+ const selectedChoices = this.chance.pickset(choiceTemplates, numChoices);
1035
+ return selectedChoices.map((text, index) => {
1036
+ const effects = {};
1037
+ if (this.chance.bool({
1038
+ likelihood: 60
1039
+ })) {
1040
+ effects.gold = this.chance.integer({
1041
+ min: -50,
1042
+ max: 100
1043
+ });
1044
+ }
1045
+ if (this.chance.bool({
1046
+ likelihood: 40
1047
+ })) {
1048
+ effects.reputation = this.chance.integer({
1049
+ min: -10,
1050
+ max: 20
1051
+ });
1052
+ }
1053
+ if (this.chance.bool({
1054
+ likelihood: 30
1055
+ })) {
1056
+ effects.knowledge = this.chance.integer({
1057
+ min: 5,
1058
+ max: 25
1059
+ });
1060
+ }
1061
+ return {
1062
+ text: text,
1063
+ effect: effects,
1064
+ consequence: `markov_choice_${index}`
1065
+ };
1066
+ });
1067
+ }
1068
+
1069
+ /**
1070
+ * Fallback method for pure Markov generation failures
1071
+ * @param {Object} context - Generation context
1072
+ * @returns {Object} Generated event
1073
+ */
1074
+ generateTemplateBasedEvent(context) {
931
1075
  const template = this.selectTemplate(context);
932
1076
  const scaledChoices = this.scaleEffectsForDifficulty(this.generateContextualChoices(template.choices, context), context);
933
1077
  return {
@@ -945,6 +1089,96 @@ class RPGEventGenerator {
945
1089
  };
946
1090
  }
947
1091
 
1092
+ /**
1093
+ * Apply custom rules to an event (v2.0.0)
1094
+ * @param {Object} event - The generated event
1095
+ * @param {Object} context - The generation context
1096
+ * @returns {Object} Modified event with rules applied
1097
+ */
1098
+ applyCustomRules(event, context) {
1099
+ let modifiedEvent = event;
1100
+ for (const [ruleName, rule] of Object.entries(this.customRules)) {
1101
+ if (this.ruleEngine.evaluateRule(context, rule)) {
1102
+ modifiedEvent = this.ruleEngine.applyRuleEffects(modifiedEvent, rule, context);
1103
+ }
1104
+ }
1105
+ return modifiedEvent;
1106
+ }
1107
+
1108
+ /**
1109
+ * Add a custom rule to the rule engine (v2.0.0)
1110
+ * @param {string} name - Unique rule name
1111
+ * @param {Object} rule - Rule definition
1112
+ * @param {Array} rule.conditions - Array of condition objects
1113
+ * @param {Object} rule.effects - Effects to apply when conditions are met
1114
+ */
1115
+ addCustomRule(name, rule) {
1116
+ this.customRules[name] = rule;
1117
+ }
1118
+
1119
+ /**
1120
+ * Remove a custom rule (v2.0.0)
1121
+ * @param {string} name - Rule name to remove
1122
+ */
1123
+ removeCustomRule(name) {
1124
+ if (this.customRules[name]) {
1125
+ delete this.customRules[name];
1126
+ }
1127
+ }
1128
+
1129
+ /**
1130
+ * Get all custom rules (v2.0.0)
1131
+ * @returns {Object} All custom rules
1132
+ */
1133
+ getCustomRules() {
1134
+ return {
1135
+ ...this.customRules
1136
+ };
1137
+ }
1138
+
1139
+ /**
1140
+ * Clear all custom rules (v2.0.0)
1141
+ */
1142
+ clearCustomRules() {
1143
+ this.customRules = {};
1144
+ }
1145
+
1146
+ /**
1147
+ * Validate a custom rule definition (v2.0.0)
1148
+ * @param {Object} rule - Rule to validate
1149
+ * @returns {Object} Validation result { valid: boolean, errors: Array }
1150
+ */
1151
+ validateCustomRule(rule) {
1152
+ const errors = [];
1153
+ if (!rule || typeof rule !== 'object') {
1154
+ errors.push('Rule must be an object');
1155
+ return {
1156
+ valid: false,
1157
+ errors
1158
+ };
1159
+ }
1160
+ if (rule.conditions && !Array.isArray(rule.conditions)) {
1161
+ errors.push('Conditions must be an array');
1162
+ }
1163
+ if (rule.effects && typeof rule.effects !== 'object') {
1164
+ errors.push('Effects must be an object');
1165
+ }
1166
+ if (rule.conditions && Array.isArray(rule.conditions)) {
1167
+ rule.conditions.forEach((condition, index) => {
1168
+ if (!condition.type) {
1169
+ errors.push(`Condition ${index} missing type`);
1170
+ }
1171
+ if (!this.ruleEngine.conditionEvaluators[condition.type]) {
1172
+ errors.push(`Condition ${index} has unknown type: ${condition.type}`);
1173
+ }
1174
+ });
1175
+ }
1176
+ return {
1177
+ valid: errors.length === 0,
1178
+ errors
1179
+ };
1180
+ }
1181
+
948
1182
  /**
949
1183
  * Generate multiple events at once
950
1184
  * @param {Object} playerContext - Player stats and state
@@ -982,6 +1216,271 @@ class RPGEventGenerator {
982
1216
  this.initializeRelationshipRules();
983
1217
  }
984
1218
  }
1219
+
1220
+ /**
1221
+ * Initialize the custom rule engine system (v2.0.0)
1222
+ */
1223
+ initializeRuleEngine() {
1224
+ const ruleEngine = {
1225
+ rules: new Map(),
1226
+ evaluators: new Map(),
1227
+ conditions: new Map(),
1228
+ conditionEvaluators: {},
1229
+ evaluateCondition: function (context, condition) {
1230
+ const evaluator = this.conditionEvaluators[condition.type];
1231
+ if (!evaluator) {
1232
+ console.warn(`Unknown condition type: ${condition.type}`);
1233
+ return false;
1234
+ }
1235
+ return evaluator(context, condition.params || {}, this);
1236
+ },
1237
+ initializeConditionEvaluators: function () {
1238
+ const self = this;
1239
+ this.conditionEvaluators = {
1240
+ stat_greater_than: (context, params) => {
1241
+ var _context$player;
1242
+ const stat = ((_context$player = context.player) === null || _context$player === void 0 ? void 0 : _context$player[params.stat]) || context[params.stat] || 0;
1243
+ return stat > params.value;
1244
+ },
1245
+ stat_less_than: (context, params) => {
1246
+ var _context$player2;
1247
+ const stat = ((_context$player2 = context.player) === null || _context$player2 === void 0 ? void 0 : _context$player2[params.stat]) || context[params.stat] || 0;
1248
+ return stat < params.value;
1249
+ },
1250
+ stat_between: (context, params) => {
1251
+ var _context$player3;
1252
+ const stat = ((_context$player3 = context.player) === null || _context$player3 === void 0 ? void 0 : _context$player3[params.stat]) || context[params.stat] || 0;
1253
+ return stat >= params.min && stat <= params.max;
1254
+ },
1255
+ has_item: (context, params) => {
1256
+ var _context$player4;
1257
+ return ((_context$player4 = context.player) === null || _context$player4 === void 0 || (_context$player4 = _context$player4.inventory) === null || _context$player4 === void 0 ? void 0 : _context$player4.includes(params.item)) || false;
1258
+ },
1259
+ location_is: (context, params) => {
1260
+ return context.location === params.location;
1261
+ },
1262
+ season_is: (context, params) => {
1263
+ return context.season === params.season;
1264
+ },
1265
+ career_is: (context, params) => {
1266
+ var _context$player5;
1267
+ return (((_context$player5 = context.player) === null || _context$player5 === void 0 ? void 0 : _context$player5.career) || context.career) === params.career;
1268
+ },
1269
+ time_greater_than: (context, params) => {
1270
+ var _context$time;
1271
+ return (((_context$time = context.time) === null || _context$time === void 0 ? void 0 : _context$time.day) || 0) > params.days;
1272
+ },
1273
+ relationship_status: (context, params) => {
1274
+ var _context$relationship;
1275
+ const relationship = (_context$relationship = context.relationships) === null || _context$relationship === void 0 ? void 0 : _context$relationship.find(r => r.name === params.npc);
1276
+ if (!relationship) return false;
1277
+ return relationship.relationship >= params.min && relationship.relationship <= params.max;
1278
+ },
1279
+ random_chance: (context, params) => {
1280
+ return Math.random() < params.probability;
1281
+ },
1282
+ and: (context, params, ruleEngine) => {
1283
+ return params.conditions.every(condition => ruleEngine.evaluateCondition(context, condition));
1284
+ },
1285
+ or: (context, params, ruleEngine) => {
1286
+ return params.conditions.some(condition => ruleEngine.evaluateCondition(context, condition));
1287
+ },
1288
+ not: (context, params, ruleEngine) => {
1289
+ return !ruleEngine.evaluateCondition(context, params.condition);
1290
+ }
1291
+ };
1292
+ },
1293
+ evaluateRule: function (context, rule) {
1294
+ if (!rule.conditions || rule.conditions.length === 0) {
1295
+ return true;
1296
+ }
1297
+ return rule.conditions.every(condition => this.evaluateCondition(context, condition));
1298
+ },
1299
+ applyRuleEffects: function (event, rule, context) {
1300
+ if (!rule.effects) return event;
1301
+ const modifiedEvent = JSON.parse(JSON.stringify(event));
1302
+ if (rule.effects.modifyChoices) {
1303
+ modifiedEvent.choices = modifiedEvent.choices.map(choice => ({
1304
+ ...choice,
1305
+ effect: this.applyEffectModifiers(choice.effect, rule.effects.modifyChoices, context)
1306
+ }));
1307
+ }
1308
+ if (rule.effects.addChoices) {
1309
+ modifiedEvent.choices = [...modifiedEvent.choices, ...rule.effects.addChoices];
1310
+ }
1311
+ if (rule.effects.modifyTitle) {
1312
+ modifiedEvent.title = this.applyTextModifiers(modifiedEvent.title, rule.effects.modifyTitle, context);
1313
+ }
1314
+ if (rule.effects.modifyNarrative) {
1315
+ modifiedEvent.narrative = this.applyTextModifiers(modifiedEvent.narrative, rule.effects.modifyNarrative, context);
1316
+ }
1317
+ if (rule.effects.setDifficulty) {
1318
+ modifiedEvent.difficulty = rule.effects.setDifficulty;
1319
+ }
1320
+ if (rule.effects.addTags) {
1321
+ if (!modifiedEvent.tags) modifiedEvent.tags = [];
1322
+ modifiedEvent.tags = [...modifiedEvent.tags, ...rule.effects.addTags];
1323
+ }
1324
+ return modifiedEvent;
1325
+ },
1326
+ applyEffectModifiers: function (effect, modifiers, context) {
1327
+ const modified = {
1328
+ ...effect
1329
+ };
1330
+ if (modifiers.multiply) {
1331
+ Object.keys(modifiers.multiply).forEach(key => {
1332
+ if (modified[key] !== undefined) {
1333
+ if (Array.isArray(modified[key])) {
1334
+ modified[key] = modified[key].map(val => Math.round(val * modifiers.multiply[key]));
1335
+ } else {
1336
+ modified[key] = Math.round(modified[key] * modifiers.multiply[key]);
1337
+ }
1338
+ }
1339
+ });
1340
+ }
1341
+ if (modifiers.add) {
1342
+ Object.keys(modifiers.add).forEach(key => {
1343
+ if (modified[key] !== undefined) {
1344
+ if (Array.isArray(modified[key])) {
1345
+ modified[key] = modified[key].map(val => val + modifiers.add[key]);
1346
+ } else {
1347
+ modified[key] = modified[key] + modifiers.add[key];
1348
+ }
1349
+ } else {
1350
+ modified[key] = modifiers.add[key];
1351
+ }
1352
+ });
1353
+ }
1354
+ return modified;
1355
+ },
1356
+ applyTextModifiers: function (text, modifiers, context) {
1357
+ let modifiedText = text;
1358
+ if (modifiers.replace) {
1359
+ Object.keys(modifiers.replace).forEach(pattern => {
1360
+ const replacement = modifiers.replace[pattern];
1361
+ modifiedText = modifiedText.replace(new RegExp(pattern, 'g'), replacement);
1362
+ });
1363
+ }
1364
+ if (modifiers.append) {
1365
+ modifiedText += modifiers.append;
1366
+ }
1367
+ if (modifiers.prepend) {
1368
+ modifiedText = modifiers.prepend + modifiedText;
1369
+ }
1370
+ return modifiedText;
1371
+ }
1372
+ };
1373
+ ruleEngine.initializeConditionEvaluators();
1374
+ return ruleEngine;
1375
+ }
1376
+ initializeTemplateSystem(options) {
1377
+ if (this.enableTemplates && this.templateLibrary) {
1378
+ try {
1379
+ this.loadTemplateLibrary(this.templateLibrary);
1380
+ } catch (error) {
1381
+ console.warn('Failed to load template library:', error.message);
1382
+ }
1383
+ }
1384
+ }
1385
+ loadTemplateLibrary(genre) {
1386
+ try {
1387
+ const fs = require('fs');
1388
+ const path = require('path');
1389
+ const templatesDir = path.join(__dirname, '..', 'templates');
1390
+ const genreDir = path.join(templatesDir, genre);
1391
+ if (!fs.existsSync(genreDir)) {
1392
+ console.warn(`Template genre '${genre}' not found`);
1393
+ return;
1394
+ }
1395
+ const files = fs.readdirSync(genreDir);
1396
+ let loadedCount = 0;
1397
+ files.forEach(file => {
1398
+ if (file.endsWith('.json')) {
1399
+ try {
1400
+ const filePath = path.join(genreDir, file);
1401
+ const templateData = JSON.parse(fs.readFileSync(filePath, 'utf8'));
1402
+ const templateId = path.basename(file, '.json');
1403
+ this.loadedTemplates.set(`${genre}:${templateId}`, templateData);
1404
+ loadedCount++;
1405
+ } catch (error) {
1406
+ console.warn(`Failed to load template ${file}:`, error.message);
1407
+ }
1408
+ }
1409
+ });
1410
+ } catch (error) {
1411
+ console.warn('Template loading failed:', error.message);
1412
+ }
1413
+ }
1414
+ generateFromTemplate(templateId, context = {}) {
1415
+ const fullTemplateId = this.templateLibrary ? `${this.templateLibrary}:${templateId}` : templateId;
1416
+ const template = this.loadedTemplates.get(fullTemplateId);
1417
+ if (!template) {
1418
+ throw new Error(`Template '${fullTemplateId}' not found`);
1419
+ }
1420
+ const event = {
1421
+ title: template.title,
1422
+ description: template.narrative,
1423
+ choices: template.choices.map(choice => ({
1424
+ text: choice.text,
1425
+ effect: choice.effect || {},
1426
+ consequence: choice.consequence
1427
+ })),
1428
+ type: template.type,
1429
+ difficulty: template.difficulty,
1430
+ tags: template.tags || []
1431
+ };
1432
+ return this.applyContextEnhancements(event, context);
1433
+ }
1434
+ generateFromGenre(genre, context = {}) {
1435
+ if (!this.loadedTemplates.size) {
1436
+ throw new Error('No templates loaded. Call loadTemplateLibrary() first.');
1437
+ }
1438
+ const genreTemplates = Array.from(this.loadedTemplates.entries()).filter(([key]) => key.startsWith(`${genre}:`));
1439
+ if (!genreTemplates.length) {
1440
+ throw new Error(`No templates found for genre '${genre}'`);
1441
+ }
1442
+ const randomTemplate = this.chance.pickone(genreTemplates);
1443
+ const template = randomTemplate[1];
1444
+ const event = {
1445
+ title: template.title,
1446
+ description: template.narrative,
1447
+ choices: template.choices.map(choice => ({
1448
+ text: choice.text,
1449
+ effect: choice.effect || {},
1450
+ consequence: choice.consequence
1451
+ })),
1452
+ type: template.type,
1453
+ difficulty: template.difficulty,
1454
+ tags: template.tags || []
1455
+ };
1456
+ return this.applyContextEnhancements(event, context);
1457
+ }
1458
+ getAvailableTemplates() {
1459
+ const templates = {};
1460
+ this.loadedTemplates.forEach((template, key) => {
1461
+ const [genre, id] = key.split(':');
1462
+ if (!templates[genre]) {
1463
+ templates[genre] = [];
1464
+ }
1465
+ templates[genre].push({
1466
+ id,
1467
+ title: template.title,
1468
+ difficulty: template.difficulty,
1469
+ type: template.type,
1470
+ tags: template.tags
1471
+ });
1472
+ });
1473
+ return templates;
1474
+ }
1475
+ applyContextEnhancements(event, context) {
1476
+ if (context.player) {
1477
+ event.playerContext = context.player;
1478
+ }
1479
+ if (context.environment) {
1480
+ event.environment = context.environment;
1481
+ }
1482
+ return event;
1483
+ }
985
1484
  initializeThemes() {
986
1485
  this.themes = {
987
1486
  fantasy: ['The royal court is abuzz with whispers of scandal and betrayal', 'A noble lord approaches you with a proposition that could change your destiny', 'Court politics have reached a fever pitch as alliances shift like desert sands', 'The king\'s advisors plot in shadowed corners while the court dances obliviously', 'A mysterious letter arrives sealed with wax from a noble house you don\'t recognize', 'The thieves\' guild has put out a contract that bears your name', 'Shadowy figures lurk in alleyways, watching your every move', 'The black market thrives under the cover of night, offering forbidden luxuries', 'A notorious crime lord has taken an interest in your activities', 'Corrupt guards demand tribute while turning a blind eye to greater crimes', 'Strange runes appear on your bedroom wall, glowing with ethereal light', 'An ancient prophecy speaks of a hero who matches your description exactly', 'Ghostly apparitions warn of impending doom in fevered dreams', 'A witch in the woods offers you power beyond mortal comprehension', 'Cursed artifacts surface in the market, promising great power at terrible cost', 'Your past sins come back to haunt you in the most unexpected ways', 'A long-lost relative appears with a tale that shakes your world', 'Your reputation draws admirers and enemies in equal measure', 'A betrayal cuts deeper than any blade, leaving scars on your soul', 'Love and ambition war within your heart as opportunities arise', 'Ancient ruins whisper secrets to those brave enough to listen', 'A dragon\'s hoard lies hidden, protected by trials and tribulations', 'Bandits rule the roads, but their leader seems oddly familiar', 'A legendary artifact calls to you from across distant lands', 'The wilderness holds both peril and promise for the bold adventurer', 'Romantic entanglements complicate your carefully laid plans', 'Old friends become new enemies as loyalties are tested', 'Family secrets emerge that threaten to destroy everything you hold dear', 'Mentors offer wisdom that comes with strings attached', 'Rivals emerge from unexpected places, challenging your hard-won position', 'The market crashes send shockwaves through the merchant class', 'A get-rich-quick scheme promises fortunes but demands your soul', 'Trade wars erupt between rival merchant houses', 'Investment opportunities arise that could make or break your fortune', 'Black market deals offer power but carry the weight of damnation', 'War drums beat as kingdoms prepare for inevitable conflict', 'Desertion offers freedom but brands you a coward forever', 'A duel of honor is proposed, with your reputation on the line', 'Mercenary companies seek captains brave enough to lead them', 'Battle scars tell stories of glory and horror in equal measure', 'The veil between worlds thins, allowing magic to seep into reality', 'Curses and blessings intertwine in ways you never expected', 'Ancient bloodlines awaken powers dormant for generations', 'Rituals performed in secret grant power at terrible personal cost', 'The stars themselves seem to conspire in your favor or against you', 'Winter\'s cruel bite forces desperate measures from the populace', 'Spring\'s renewal brings both hope and dangerous new beginnings', 'Summer tournaments test the mettle of warriors and nobles alike', 'Autumn harvests reveal secrets long buried in the fields', 'The changing seasons mirror the turmoil in your own life', 'What seems like a blessing reveals itself as a curse in disguise', 'Enemies become allies, and allies become your greatest threat', 'The path of righteousness leads to ruin, while villainy brings reward', 'Fate itself seems to take notice of your actions, for good or ill', 'The world bends around you as your choices reshape reality itself'],
@@ -1353,7 +1852,7 @@ class RPGEventGenerator {
1353
1852
  template: this.templates[stage.template]
1354
1853
  };
1355
1854
  triggeredEvents.push(event);
1356
- break; // Only trigger one stage per day
1855
+ break;
1357
1856
  }
1358
1857
  }
1359
1858
  }
@@ -1404,7 +1903,6 @@ class RPGEventGenerator {
1404
1903
  day: this.timeSystem.currentDay,
1405
1904
  season: this.timeSystem.currentSeason,
1406
1905
  year: Math.ceil(this.timeSystem.currentDay / 360),
1407
- // Roughly 360 days per year
1408
1906
  seasonalModifiers: ((_this$seasonalEvents$ = this.seasonalEvents[this.timeSystem.currentSeason]) === null || _this$seasonalEvents$ === void 0 ? void 0 : _this$seasonalEvents$.modifiers) || {}
1409
1907
  };
1410
1908
  }
@@ -1989,8 +2487,7 @@ class RPGEventGenerator {
1989
2487
  };
1990
2488
  Object.keys(adjustedWeights).forEach(templateKey => {
1991
2489
  const rating = challengeRatings[templateKey] || 5;
1992
- const powerRatio = powerLevel / 100; // Normalize power level
1993
-
2490
+ const powerRatio = powerLevel / 100;
1994
2491
  if (rating < powerRatio + 2) {
1995
2492
  adjustedWeights[templateKey] *= 0.5;
1996
2493
  } else if (rating >= powerRatio + 2 && rating <= powerRatio + 5) {
@@ -2333,7 +2830,7 @@ class RPGEventGenerator {
2333
2830
  break;
2334
2831
  case 'stress':
2335
2832
  case 'happiness':
2336
- if (context.age > 40) multiplier *= 1.1; // More emotional impact with age
2833
+ if (context.age > 40) multiplier *= 1.1;
2337
2834
  break;
2338
2835
  }
2339
2836
  return multiplier;
@@ -3056,7 +3553,7 @@ class RPGEventGenerator {
3056
3553
  */
3057
3554
  getSystemStatus() {
3058
3555
  return {
3059
- version: '1.2.0',
3556
+ version: '2.0.0',
3060
3557
  language: this.language,
3061
3558
  availableLanguages: Array.from(this.locales.keys()),
3062
3559
  modifiersEnabled: this.enableModifiers,
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "rpg-event-generator",
3
- "version": "1.2.6",
4
- "description": "Procedural RPG event generation system for games",
3
+ "version": "2.0.0",
4
+ "description": "RPG Event Generator v2.0.0 - Complete procedural event generation with 429+ templates, rule engine, and theme creator",
5
5
  "main": "dist/index.js",
6
6
  "files": [
7
7
  "dist/",
8
+ "templates/",
9
+ "scripts/",
8
10
  "demo.js",
9
11
  "README.md",
10
12
  "LICENSE"
@@ -12,7 +14,14 @@
12
14
  "scripts": {
13
15
  "test": "jest",
14
16
  "build": "babel src --out-dir dist",
15
- "prepublishOnly": "npm run build"
17
+ "build:browser": "npm run build && browserify dist/index.js --standalone RPGEventGenerator -o demo-web/rpg-event-generator.js",
18
+ "prepublishOnly": "npm run build",
19
+ "demo": "node demo.js",
20
+ "economy:list": "node scripts/event-economy.js list-themes",
21
+ "economy:stats": "node scripts/event-economy.js stats",
22
+ "export:unity": "node scripts/export-templates.js unity",
23
+ "export:godot": "node scripts/export-templates.js godot",
24
+ "export:typescript": "node scripts/export-templates.js typescript"
16
25
  },
17
26
  "keywords": [
18
27
  "rpg",
@@ -54,6 +63,7 @@
54
63
  "@babel/cli": "^7.23.0",
55
64
  "@babel/core": "^7.23.0",
56
65
  "@babel/preset-env": "^7.23.0",
66
+ "browserify": "^17.0.0",
57
67
  "jest": "^29.7.0",
58
68
  "jest-environment-node": "^29.7.0"
59
69
  },
@@ -63,6 +73,10 @@
63
73
  "^.+\\.(js|jsx)$": "babel-jest"
64
74
  }
65
75
  },
76
+ "bin": {
77
+ "rpg-events": "./scripts/event-economy.js",
78
+ "rpg-export": "./scripts/export-templates.js"
79
+ },
66
80
  "engines": {
67
81
  "node": ">=14.0.0"
68
82
  }