1
0

npc.tw 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. :: NPCFunctions[include]
  2. <<switch $location_var[$here][0]>>
  3. <<case 'relationshipDescription'>>
  4. <<set $result = ''>>
  5. <<set _npcFam = $npcs.get($location_var[$here][1],'fam')>>
  6. /*<<if _npcFam < 5>>
  7. <<set $result += "You don't know each other.">>
  8. <<elseif _npcFam < 20>>
  9. <<set $result += "You barely know each other.">>
  10. <<elseif _npcFam < 100>>
  11. <<set $result += "You know little about each other.">>
  12. <<elseif _npcFam < 300>>
  13. <<set $result += "You are acquainted with each other.">>
  14. <<elseif _npcFam < 500>>
  15. <<set $result += "You somewhat know each other.">>
  16. <<elseif _npcFam < 700>>
  17. <<set $result += "You are familiar with each other.">>
  18. <<elseif _npcFam < 800>>
  19. <<set $result += "You are very familiar with each other.">>
  20. <<elseif _npcFam < 900>>
  21. <<set $result += "You are extremely familiar with each other.">>
  22. <<else>>
  23. <<set $result += "You are extremely familiar with each other.">>
  24. <</if>>*/
  25. <<if _npcFam < 5>>
  26. <<set $result += "You don't know each other.">>
  27. <<elseif _npcFam < 20>>
  28. <<set $result += "You barely know each other.">>
  29. <<elseif _npcFam < 200>>
  30. <<set $result += "You know each other as well as colleagues or class mates do.">>
  31. <<elseif _npcFam < 400>>
  32. <<set $result += "You know each other as well as friends do.">>
  33. <<elseif _npcFam < 600>>
  34. <<set $result += "You know each other as well as close friends do.">>
  35. <<elseif _npcFam < 800>>
  36. <<set $result += "You know each other as well as best friends do.">>
  37. <<elseif _npcFam < 900>>
  38. <<set $result += "You know each other as well as close family members do.">>
  39. <<else>>
  40. <<set $result += "You know each other as well as soul mates do.">>
  41. <</if>>
  42. <<set $result += ' '>>
  43. <<set _npcRel = $npcs.get($location_var[$here][1],'rel')>>
  44. <<if _npcRel < 20>>
  45. <<set $result += 'Your relationship is awful.'>>
  46. <<elseif _npcRel < 40>>
  47. <<set $result += 'Your relationship is tense.'>>
  48. <<elseif _npcRel < 60>>
  49. <<set $result += 'You have a normal relationship.'>>
  50. <<elseif _npcRel < 80>>
  51. <<set $result += 'You have a good relationship.'>>
  52. <<else>>
  53. <<set $result += 'You have a great relationship.'>>
  54. <</if>>
  55. <</switch>>
  56. :: NPC_Widgets[widget]
  57. <<widget 'npc' container>>
  58. <<set _npcId = _args[0]>>
  59. <!-- Present NPCs -->
  60. <<if !_presentNPCs>><<set _presentNPCs = {}>><</if>>
  61. <<set _presentNPCs[_npcId] = passage()>>
  62. <<set _displayedName = _args[1]>>
  63. <<if !_displayedName>>
  64. <<set _displayedName = $npcs.get(_npcId,'usedname')>>
  65. <</if>>
  66. <<set _c to _contents>>
  67. <<capture _c>>
  68. <<set _note = $npcs.get(_npcId,'notes')>>
  69. <<set _image = $npcs.get(_npcId,'image')>>
  70. <<if _image>>
  71. <<set _note = "<<image '"+_image+"'>>" + _note>>
  72. <</if>>
  73. <<set _note += '<hr/>'+func('NPCFunctions','relationshipDescription',_npcId)>>
  74. <<if _note>>
  75. <<linkWithTooltip _displayedName _note>>_c<</linkWithTooltip>>
  76. <<else>>
  77. <<link _displayedName>>
  78. _c
  79. <</link>>
  80. <</if>>
  81. <</capture>>
  82. <</widget>>
  83. <<widget 'npcDecription'>>
  84. <<set _npcId = _args[0]>>
  85. <<set _gender = $npcs.get(_npcId,'gender')>> <!-- 0: male, 1: female -->
  86. <<if _gender === 0>>
  87. <<set _l = {he:'he',him:'him',his:'his'}>>
  88. <<else>>
  89. <<set _l = {he:'she',him:'her',his:'her'}>>
  90. <</if>>
  91. <<for _key,_value range _l>>
  92. <<set _l[_key.toUpperFirst()] = _value.toUpperFirst()>>
  93. <</for>>
  94. <<set _age = $npcs.get(_npcId,'age')>>
  95. <<set _ageDecade = Math.floor(_age/10)>>
  96. <<if _age <= 1>>
  97. _l.He is an infant.
  98. <<elseif _age <= 5>>
  99. _l.He is a little child.
  100. <<elseif _age <= 12>>
  101. _l.He is a child.
  102. <<elseif _age <= 14>>
  103. _l.He is in _l.his early teens.
  104. <<elseif _age < 20>>
  105. _l.He is a teenager.
  106. <<elseif _age <= 23>>
  107. _l.He is in _l.his early twenties.
  108. <<elseif _age <= 26>>
  109. _l.He is in _l.his mid-twenties.
  110. <<elseif _age < 30>>
  111. _l.He is in _l.his late twenties.
  112. <<elseif _age <= 33>>
  113. _l.He is in _l.his early thirties.
  114. <<elseif _age <= 36>>
  115. _l.He is in _l.his mid-thirties.
  116. <<elseif _age < 40>>
  117. _l.He is in _l.his late thirties.
  118. <<elseif _age < 50>>
  119. _l.He is in _l.his forties.
  120. <<elseif _age < 60>>
  121. _l.He is in _l.his fifties.
  122. <<elseif _age < 70>>
  123. _l.He is in _l.his sixties.
  124. <<elseif _age < 80>>
  125. _l.He is in _l.his seventies.
  126. <<elseif _age >= 80>>
  127. _l.He is at least in _l.his eighties.
  128. <</if>>
  129. <<set _height = $npcs.get(_npcId,'height')>>
  130. <<set _heightApprox = Math.round(_height / 3) * 3>>
  131. <<set _pc_height = $pc.pcs_hgt>>
  132. <<set _heightQutient = _pc_height / _height>>
  133. <!-- Comment references are for Svetas default hight of 170cm -->
  134. <<if _heightQutient > 3.4>><!-- Smaller than 50cm -->
  135. _l.He is tiny.
  136. <<elseif _heightQutient > 2.4>><!-- Smaller than 70cm -->
  137. _l.He reaches up to your knees.
  138. <<elseif _heightQutient > 2.4>><!-- Smaller than 70cm -->
  139. _l.He reaches up to your knees.
  140. <<elseif _heightQutient > 1.9>><!-- Smaller than 90cm -->
  141. _l.He reaches up to your hips.
  142. <<elseif _heightQutient > 1.55>><!-- Smaller than 110cm -->
  143. _l.He reaches up to belly button.
  144. <<elseif _heightQutient > 1.3>><!-- Smaller than 130cm -->
  145. _l.He reaches up to your breasts.
  146. <<elseif _heightQutient > 1.13>><!-- Smaller than 150cm -->
  147. _l.He reaches up to your shoulder.
  148. <<elseif _heightQutient > 1.09>><!-- Smaller than 155cm -->
  149. _l.He reaches up to your chin.
  150. <<elseif _heightQutient > 1.09>><!-- Smaller than 160cm -->
  151. _l.He is a little smaller than you. You can barely look over _l.his head.
  152. <<elseif _heightQutient > 1.02>><!-- Smaller than 167cm -->
  153. _l.He is a tiny bit smaller than you.
  154. <<elseif _heightQutient > 0.98>><!-- Smaller than 173cm -->
  155. _l.He is almost the exact same height as you.
  156. <<elseif _heightQutient > 0.94>><!-- Smaller than 180cm -->
  157. _l.He is a tiny bit taller than you.
  158. <<elseif _heightQutient > 0.92>><!-- Smaller than 185cm -->
  159. _l.He is a little taller than you. _l.He can likely look above your head.
  160. <<elseif _heightQutient > 0.89>><!-- Smaller than 190cm -->
  161. _l.He is taller than you. Your eyes are as high as _l.his neck.
  162. <<elseif _heightQutient > 0.87>><!-- Smaller than 195cm -->
  163. _l.He is taller than you. Your eyes are as high as _l.his upper chest.
  164. <<elseif _heightQutient > 0.85>><!-- Smaller than 200cm -->
  165. _l.He is way taller than you. Your eyes are as high as _l.his chest.
  166. <<elseif _heightQutient > 0.77>><!-- Smaller than 220cm -->
  167. _l.He is way taller than you. Your eyes are as high as _l.his lower chest.
  168. <<elseif _heightQutient > 0.65>><!-- Smaller than 240cm -->
  169. _l.He is way taller than you. Your eyes are as high as _l.his belly.
  170. <<elseif _heightQutient > 0.5>><!-- Smaller than 240cm -->
  171. _l.He is way way taller than you. Your eyes are as high as _l.his hips.
  172. <<else>>
  173. _l.He is way way taller than you. Your don't even reach _l.his hips.
  174. <</if>>
  175. <</widget>>
  176. <<widget 'npcList'>>
  177. <<if ['array','object'].includes(typeof _args[0])>>
  178. <<set _npcNames = []>>
  179. <<for _key, _npcId range _args[0]>>
  180. <<if typeof _npcId == 'object'>>
  181. <<run _npcNames.push("<<npc '"+_key+"'>>"+(_npcId.contents ?? '')+"<</npc>>")>>
  182. <<else>>
  183. <<run _npcNames.push("<<npc '"+_npcId+"'>><</npc>>")>>
  184. <</if>>
  185. <</for>>
  186. <<if _args[2] and _npcNames.length > 1>>
  187. <<=_args[2].split('#')[0]>>
  188. <<elseif _args[1] and _npcNames.length > 0>>
  189. <<=_args[1].split('#')[0]>>
  190. <</if>>
  191. <<concatAnd _npcNames>>
  192. <<if _args[2] and _npcNames.length > 1>>
  193. <<=_args[2].split('#')[1]>>
  194. <<elseif _args[1] and _npcNames.length > 0>>
  195. <<=_args[1].split('#')[1]>>
  196. <</if>>
  197. <</if>>
  198. <</widget>>
  199. <<widget "npcLoad" container>>
  200. <<if !_autoCapture.loadedNPCIds>>
  201. <<set _autoCapture.loadedNPCIds = []>>
  202. <</if>>
  203. <<run _autoCapture.loadedNPCIds.push(_args[0])>>
  204. <!--<<set _loadedNPCId = _autoCapture.loadedNPCIds.last()>>-->
  205. _contents
  206. <<run _autoCapture.loadedNPCIds.pop()>>
  207. <!--<<if _autoCapture.loadedNPCIds.length > 0>>
  208. <<set _loadedNPCId = _autoCapture.loadedNPCIds.last()>>
  209. <<else>>
  210. <<set _loadedNPCId = undefined>>
  211. <</if>>-->
  212. <</widget>>
  213. <<widget 'npcPronoun'>>
  214. <<if Array.isArray(_args[0])>>
  215. <<if _args[0].length == 1>>
  216. <<set _npcGender = $npcs.get(_args[0][0]).gender>>
  217. <<else>>
  218. <<set _npcGender = -1>>
  219. <</if>>
  220. <<elseif typeof _args[0] == 'object'>>
  221. <<if Object.keys(_args[0]).length == 1>>
  222. <<set _npcGender = $npcs.get(Object.keys(_args[0])[0],'gender')>>
  223. <<else>>
  224. <<set _npcGender = -1>>
  225. <</if>>
  226. <<else>>
  227. <<set _npcGender = $npcs.get(_args[0]).gender>>
  228. <</if>>
  229. <<switch _npcGender>>
  230. <<case -1>>
  231. <<set _pronouns = {
  232. 'himherthem': 'them',
  233. 'HimHerThem': 'Them',
  234. }>>
  235. <<case 0>>
  236. <<set _pronouns = {
  237. 'himherthem': 'him',
  238. 'HimHerThem': 'Him',
  239. }>>
  240. <<case 1>>
  241. <<set _pronouns = {
  242. 'himherthem': 'her',
  243. 'HimHerThem': 'Her',
  244. }>>
  245. <</switch>>
  246. <<=_pronouns[_args[1]]>>
  247. <</widget>>
  248. <<widget 'npcRemember'>>
  249. <</widget>>
  250. <<widget 'g'>>
  251. <!--<<=$npcs.pronoun(_loadedNPCId,_args[0])>>-->
  252. <<=$npcs.pronoun(_autoCapture?.loadedNPCIds?.last(),_args[0])>>
  253. <</widget>>
  254. <<widget 'he'>>
  255. <<genderedWord `['he','she']` _args[0]>>
  256. <</widget>>
  257. <<widget 'He'>>
  258. <<genderedWord `['He','She']` _args[0]>>
  259. <</widget>>
  260. <<widget 'genderedWord'>>
  261. <<if _args[1]>>
  262. <<set _npcId = _args[1]>>
  263. <<elseif _autoCapture.loadedNPCIds>>
  264. <<set _npcId = _autoCapture.loadedNPCIds.last()>>
  265. <</if>>
  266. <<set _npcGender = $npcs.get(_npcId,'gender')>>
  267. <<switch _npcGender>>
  268. <<case 0>>
  269. <<=_args[0][0]>>
  270. <<case 1>>
  271. <<=_args[0][1]>>
  272. <<default>>
  273. <<=`'Key not found: '+_npcGender+' in <<genderedWord>>'`>>
  274. <</switch>>
  275. <</widget>>