1
0

npc.tw 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. :: NPC_Widgets[widget]
  2. <<widget 'npc' container>>
  3. <<set _npcId = _args[0]>>
  4. <!-- Present NPCs -->
  5. <<if !_presentNPCs>><<set _presentNPCs = {}>><</if>>
  6. <<set _presentNPCs[_npcId] = passage()>>
  7. <<set _displayedName = _args[1]>>
  8. <<if !_displayedName>>
  9. <<set _displayedName = $npcs.get(_npcId,'usedname')>>
  10. <</if>>
  11. <<set _c to _contents>>
  12. <<capture _c>>
  13. <<set _note = $npcs.get(_npcId,'notes')>>
  14. <<set _image = $npcs.get(_npcId,'image')>>
  15. <<if _image>>
  16. <<set _note = "<<image '"+_image+"'>>" + _note>>
  17. <</if>>
  18. <<if _note>>
  19. <<linkWithTooltip _displayedName _note>>_c<</linkWithTooltip>>
  20. <<else>>
  21. <<link _displayedName>>
  22. _c
  23. <</link>>
  24. <</if>>
  25. <</capture>>
  26. <</widget>>
  27. <<widget 'npcDecription'>>
  28. <<set _npcId = _args[0]>>
  29. <<set _gender = $npcs.get(_npcId,'gender')>> <!-- 0: male, 1: female -->
  30. <<if _gender === 0>>
  31. <<set _l = {he:'he',him:'him',his:'his'}>>
  32. <<else>>
  33. <<set _l = {he:'she',him:'her',his:'her'}>>
  34. <</if>>
  35. <<for _key,_value range _l>>
  36. <<set _l[_key.toUpperFirst()] = _value.toUpperFirst()>>
  37. <</for>>
  38. <<set _age = $npcs.get(_npcId,'age')>>
  39. <<set _ageDecade = Math.floor(_age/10)>>
  40. <<if _age <= 1>>
  41. _l.He is an infant.
  42. <<elseif _age <= 5>>
  43. _l.He is a little child.
  44. <<elseif _age <= 12>>
  45. _l.He is a child.
  46. <<elseif _age <= 14>>
  47. _l.He is in _l.his early teens.
  48. <<elseif _age < 20>>
  49. _l.He is a teenager.
  50. <<elseif _age <= 23>>
  51. _l.He is in _l.his early twenties.
  52. <<elseif _age <= 26>>
  53. _l.He is in _l.his mid-twenties.
  54. <<elseif _age < 30>>
  55. _l.He is in _l.his late twenties.
  56. <<elseif _age <= 33>>
  57. _l.He is in _l.his early thirties.
  58. <<elseif _age <= 36>>
  59. _l.He is in _l.his mid-thirties.
  60. <<elseif _age < 40>>
  61. _l.He is in _l.his late thirties.
  62. <<elseif _age < 50>>
  63. _l.He is in _l.his forties.
  64. <<elseif _age < 60>>
  65. _l.He is in _l.his fifties.
  66. <<elseif _age < 70>>
  67. _l.He is in _l.his sixties.
  68. <<elseif _age < 80>>
  69. _l.He is in _l.his seventies.
  70. <<elseif _age >= 80>>
  71. _l.He is at least in _l.his eighties.
  72. <</if>>
  73. <<set _height = $npcs.get(_npcId,'height')>>
  74. <<set _heightApprox = Math.round(_height / 3) * 3>>
  75. <<set _pc_height = $pc.pcs_hgt>>
  76. <<set _heightQutient = _pc_height / _height>>
  77. <!-- Comment references are for Svetas default hight of 170cm -->
  78. <<if _heightQutient > 3.4>><!-- Smaller than 50cm -->
  79. _l.He is tiny.
  80. <<elseif _heightQutient > 2.4>><!-- Smaller than 70cm -->
  81. _l.He reaches up to your knees.
  82. <<elseif _heightQutient > 2.4>><!-- Smaller than 70cm -->
  83. _l.He reaches up to your knees.
  84. <<elseif _heightQutient > 1.9>><!-- Smaller than 90cm -->
  85. _l.He reaches up to your hips.
  86. <<elseif _heightQutient > 1.55>><!-- Smaller than 110cm -->
  87. _l.He reaches up to belly button.
  88. <<elseif _heightQutient > 1.3>><!-- Smaller than 130cm -->
  89. _l.He reaches up to your breasts.
  90. <<elseif _heightQutient > 1.13>><!-- Smaller than 150cm -->
  91. _l.He reaches up to your shoulder.
  92. <<elseif _heightQutient > 1.09>><!-- Smaller than 155cm -->
  93. _l.He reaches up to your chin.
  94. <<elseif _heightQutient > 1.09>><!-- Smaller than 160cm -->
  95. _l.He is a little smaller than you. You can barely look over _l.his head.
  96. <<elseif _heightQutient > 1.02>><!-- Smaller than 167cm -->
  97. _l.He is a tiny bit smaller than you.
  98. <<elseif _heightQutient > 0.98>><!-- Smaller than 173cm -->
  99. _l.He is almost the exact same height as you.
  100. <<elseif _heightQutient > 0.94>><!-- Smaller than 180cm -->
  101. _l.He is a tiny bit taller than you.
  102. <<elseif _heightQutient > 0.92>><!-- Smaller than 185cm -->
  103. _l.He is a little taller than you. _l.He can likely look above your head.
  104. <<elseif _heightQutient > 0.89>><!-- Smaller than 190cm -->
  105. _l.He is taller than you. Your eyes are as high as _l.his neck.
  106. <<elseif _heightQutient > 0.87>><!-- Smaller than 195cm -->
  107. _l.He is taller than you. Your eyes are as high as _l.his upper chest.
  108. <<elseif _heightQutient > 0.85>><!-- Smaller than 200cm -->
  109. _l.He is way taller than you. Your eyes are as high as _l.his chest.
  110. <<elseif _heightQutient > 0.77>><!-- Smaller than 220cm -->
  111. _l.He is way taller than you. Your eyes are as high as _l.his lower chest.
  112. <<elseif _heightQutient > 0.65>><!-- Smaller than 240cm -->
  113. _l.He is way taller than you. Your eyes are as high as _l.his belly.
  114. <<elseif _heightQutient > 0.5>><!-- Smaller than 240cm -->
  115. _l.He is way way taller than you. Your eyes are as high as _l.his hips.
  116. <<else>>
  117. _l.He is way way taller than you. Your don't even reach _l.his hips.
  118. <</if>>
  119. <</widget>>
  120. <<widget 'npcList'>>
  121. <<if ['array','object'].includes(typeof _args[0])>>
  122. <<set _npcNames = []>>
  123. <<for _key, _npcId range _args[0]>>
  124. <<if typeof _npcId == 'object'>>
  125. <<run _npcNames.push("<<npc '"+_key+"'>>"+(_npcId.contents ?? '')+"<</npc>>")>>
  126. <<else>>
  127. <<run _npcNames.push("<<npc '"+_npcId+"'>><</npc>>")>>
  128. <</if>>
  129. <</for>>
  130. <<if _args[2] and _npcNames.length > 1>>
  131. <<=_args[2].split('#')[0]>>
  132. <<elseif _args[1] and _npcNames.length > 0>>
  133. <<=_args[1].split('#')[0]>>
  134. <</if>>
  135. <<concatAnd _npcNames>>
  136. <<if _args[2] and _npcNames.length > 1>>
  137. <<=_args[2].split('#')[1]>>
  138. <<elseif _args[1] and _npcNames.length > 0>>
  139. <<=_args[1].split('#')[1]>>
  140. <</if>>
  141. <</if>>
  142. <</widget>>
  143. <<widget "npcLoad" container>>
  144. <<if !_autoCapture.loadedNPCIds>>
  145. <<set _autoCapture.loadedNPCIds = []>>
  146. <</if>>
  147. <<run _autoCapture.loadedNPCIds.push(_args[0])>>
  148. <!--<<set _loadedNPCId = _autoCapture.loadedNPCIds.last()>>-->
  149. _contents
  150. <<run _autoCapture.loadedNPCIds.pop()>>
  151. <!--<<if _autoCapture.loadedNPCIds.length > 0>>
  152. <<set _loadedNPCId = _autoCapture.loadedNPCIds.last()>>
  153. <<else>>
  154. <<set _loadedNPCId = undefined>>
  155. <</if>>-->
  156. <</widget>>
  157. <<widget 'npcPronoun'>>
  158. <<if Array.isArray(_args[0])>>
  159. <<if _args[0].length == 1>>
  160. <<set _npcGender = $npcs.get(_args[0][0]).gender>>
  161. <<else>>
  162. <<set _npcGender = -1>>
  163. <</if>>
  164. <<elseif typeof _args[0] == 'object'>>
  165. <<if Object.keys(_args[0]).length == 1>>
  166. <<set _npcGender = $npcs.get(Object.keys(_args[0]))[0].gender>>
  167. <<else>>
  168. <<set _npcGender = -1>>
  169. <</if>>
  170. <<else>>
  171. <<set _npcGender = $npcs.get(_args[0]).gender>>
  172. <</if>>
  173. <<switch _npcGender>>
  174. <<case -1>>
  175. <<set _pronouns = {
  176. 'himherthem': 'them',
  177. 'HimHerThem': 'Them',
  178. }>>
  179. <<case 0>>
  180. <<set _pronouns = {
  181. 'himherthem': 'him',
  182. 'HimHerThem': 'Him',
  183. }>>
  184. <<case 1>>
  185. <<set _pronouns = {
  186. 'himherthem': 'her',
  187. 'HimHerThem': 'Her',
  188. }>>
  189. <</switch>>
  190. <<=_pronouns[_args[1]]>>
  191. <</widget>>
  192. <<widget 'npcRemember'>>
  193. <</widget>>
  194. <<widget 'g'>>
  195. <!--<<=$npcs.pronoun(_loadedNPCId,_args[0])>>-->
  196. <<=$npcs.pronoun(_autoCapture?.loadedNPCIds?.last(),_args[0])>>
  197. <</widget>>