DH_QuestManager.qsrc 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. # DH_QuestManager
  2. if $ARGS[0] = 'UpdateStoryCard':
  3. !! Character Card
  4. if (ARRPOS('$dhCh_Chars_', 'Player') ! -1):
  5. func('Screen', 'Replace', 'PLAYER_LEVEL', '<<dhCh_Level[''Player'']>>')
  6. func('Screen', 'Replace', 'PLAYER_XP', '<<dhCh_Exp[''Player'']>>')
  7. func('Screen', 'Replace', 'PLAYER_HP', '<<dhCh_Health[''Player'']>>')
  8. func('Screen', 'Replace', 'PLAYER_SP', '<<dhCh_Stamina[''Player'']>>')
  9. func('Screen', 'Replace', 'PLAYER_MP', '<<dhCh_Mana[''Player'']>>')
  10. func('Screen', 'Replace', 'PLAYER_RP', '<<dhCh_Rage[''Player'']>>')
  11. func('Screen', 'Replace', 'PLAYER_EP', '<<dhCh_Energy[''Player'']>>')
  12. func('Screen', 'Replace', 'PLAYER_MAXXP', '<<dhCh_ExpMax[''Player'']>>')
  13. func('Screen', 'Replace', 'PLAYER_MAXHP', '<<dhCh_HealthMax[''Player'']>>')
  14. func('Screen', 'Replace', 'PLAYER_MAXSP', '<<dhCh_StaminaMax[''Player'']>>')
  15. func('Screen', 'Replace', 'PLAYER_MAXMP', '<<dhCh_ManaMax[''Player'']>>')
  16. func('Screen', 'Replace', 'PLAYER_MAXRP', '<<dhCh_RageMax[''Player'']>>')
  17. func('Screen', 'Replace', 'PLAYER_MAXEP', '<<dhCh_EnergyMax[''Player'']>>')
  18. func('Screen', 'Replace', 'PLAYER_GOLD', '<<dhInv_Gold[''Player'']>>')
  19. func('Screen', 'Replace', 'EXP_PERCENT', 'calc(<<dhCh_Exp[''Player'']>>%/<<dhCh_ExpMax[''Player'']>>*100)')
  20. func('Screen', '<<iif(dhCh_ManaMax[''Player''] ! 0, ''Show'', ''Hide'')>>', 'storyCardMP')
  21. func('Screen', '<<iif(dhCh_RageMax[''Player''] ! 0, ''Show'', ''Hide'')>>', 'storyCardRP')
  22. func('Screen', '<<iif(dhCh_EnergyMax[''Player''] ! 0, ''Show'', ''Hide'')>>', 'storyCardEP')
  23. else
  24. func('Screen', 'Replace', 'PLAYER_LEVEL', '0')
  25. func('Screen', 'Replace', 'PLAYER_XP', '0')
  26. func('Screen', 'Replace', 'PLAYER_HP', '2')
  27. func('Screen', 'Replace', 'PLAYER_SP', '1')
  28. func('Screen', 'Replace', 'PLAYER_MP', '?')
  29. func('Screen', 'Replace', 'PLAYER_RP', '?')
  30. func('Screen', 'Replace', 'PLAYER_EP', '?')
  31. func('Screen', 'Replace', 'PLAYER_MAXXP', '10')
  32. func('Screen', 'Replace', 'PLAYER_MAXHP', '5')
  33. func('Screen', 'Replace', 'PLAYER_MAXSP', '5')
  34. func('Screen', 'Replace', 'PLAYER_MAXMP', '???')
  35. func('Screen', 'Replace', 'PLAYER_MAXRP', '???')
  36. func('Screen', 'Replace', 'PLAYER_MAXEP', '???')
  37. func('Screen', 'Replace', 'PLAYER_GOLD', '0')
  38. func('Screen', 'Replace', 'EXP_PERCENT', '0%')
  39. func('Screen', 'Hide', 'storyCardMP')
  40. func('Screen', 'Hide', 'storyCardRP')
  41. func('Screen', 'Hide', 'storyCardEP')
  42. end
  43. end
  44. if $ARGS[0] = 'Init':
  45. KILLVAR '$DhQst_List_'
  46. KILLVAR '$DhQst_Msg_'
  47. $DhQst_List_[] = 'NewBeginnings'
  48. $DhQst_List_[] = 'CharacterCreation'
  49. $DhQst_Msg_['NoQuest'] = 'Warning: No Quest by the name of ''{0}'' exists.'
  50. $DhQst_Msg_['NoSubQuest'] = 'Warning: No SubQuest by the name of ''{0}'' exists in the quest ''{1}''.'
  51. $DhQst_Msg_['QuestStarted'] = 'Warning: ''{0}'' has already been started.'
  52. $DhQst_Msg_['QuestComplete'] = 'Warning: ''{0}'' has already been completed.'
  53. $DhQst_Msg_['QuestNotStarted'] = 'Warning: ''{0}'' has not been started yet.'
  54. $dhQst_Current = ''
  55. KILLVAR '$dhQst_Title'
  56. KILLVAR '$dhQst_Started'
  57. KILLVAR '$dhQst_Finished'
  58. KILLVAR '$dhQst_Progress'
  59. KILLVAR '$dhQst_SubQst_'
  60. gs 'DH_QuestManager', 'UpdateStoryCard'
  61. end
  62. if $ARGS[0] = 'Start':
  63. $.questName = $ARGS[1]
  64. !! Check if quest exists
  65. if ARRPOS('$DhQst_List_', $.questName) = -1:
  66. $RESULT = FUNC('DH_Functions', 'FormatStr', $dhQst_Msg_['NoQuest'], $.questName)
  67. msg($RESULT)
  68. exit
  69. end
  70. if dhQst_Started[$.questName] = False:
  71. $RESULT = 'Quest Started'
  72. $scr_Layout = 'dhScr_Def'
  73. func('Screen', 'ClearAll')
  74. gs 'DH_Quest_<<$.questName>>', 'Start'
  75. else
  76. $RESULT = FUNC('DH_Functions', 'FormatStr', $dhQst_Msg_['QuestStarted'], $.questName)
  77. msg($RESULT)
  78. exit
  79. end
  80. end
  81. if $ARGS[0] = 'Restart':
  82. $.questName = $ARGS[1]
  83. !! Check if quest exists
  84. if ARRPOS('$DhQst_List_', $.questName) = -1:
  85. $RESULT = FUNC('DH_Functions', 'FormatStr', $dhQst_Msg_['NoQuest'], $.questName)
  86. msg($RESULT)
  87. exit
  88. end
  89. if dhQst_Started[$.questName] = True:
  90. $scr_Layout = 'dhScr_Def'
  91. func('Screen', 'ClearAll')
  92. gs 'DH_QuestManager', 'UpdateStoryCard'
  93. gs 'DH_Quest_<<$.questName>>', 'Start'
  94. else
  95. $RESULT = FUNC('DH_Functions', 'FormatStr', $dhQst_Msg_['QuestNotStarted'], $.questName)
  96. msg($RESULT)
  97. exit
  98. end
  99. end
  100. if $ARGS[0] = 'Continue':
  101. $.questName = $ARGS[1]
  102. !! Check if quest exists
  103. if ARRPOS('$DhQst_List_', $.questName) = -1:
  104. $RESULT = FUNC('DH_Functions', 'FormatStr', $dhQst_Msg_['NoQuest'], $.questName)
  105. msg($RESULT)
  106. exit
  107. end
  108. !! Check if quest has been started yet
  109. if dhQst_Started[$.questName] = False:
  110. $RESULT = FUNC('DH_Functions', 'FormatStr', $dhQst_Msg_['QuestNotStarted'], $.questName)
  111. msg($RESULT)
  112. exit
  113. end
  114. if dhQst_Finished[$.questName] = False:
  115. $scr_Layout = 'dhScr_Def'
  116. func('Screen', 'ClearAll')
  117. gs 'DH_QuestManager', 'UpdateStoryCard'
  118. gs 'DH_Quest_<<$.questName>>', $dhQst_Progress[$.questName]
  119. else
  120. $RESULT = FUNC('DH_Functions', 'FormatStr', $dhQst_Msg_['QuestComplete'], $.questName)
  121. msg($RESULT)
  122. exit
  123. end
  124. end
  125. if $ARGS[0] = 'GoTo':
  126. $.questName = $ARGS[1]
  127. $.subQuest = $ARGS[2]
  128. .clearScreen = ARGS[3]
  129. !! Check if quest exists
  130. if ARRPOS('$DhQst_List_', $.questName) = -1:
  131. $RESULT = FUNC('DH_Functions', 'FormatStr', $dhQst_Msg_['NoQuest'], $.questName)
  132. msg($RESULT)
  133. exit
  134. end
  135. !! Check if quest has been started yet
  136. if dhQst_Started[$.questName] = False:
  137. $RESULT = FUNC('DH_Functions', 'FormatStr', $dhQst_Msg_['QuestNotStarted'], $.questName)
  138. msg($RESULT)
  139. exit
  140. end
  141. !! Check if sub quest exists
  142. func('DH_Quest_<<$.questName>>', 'GetSubQuests')
  143. if (ARRPOS('$dhQst_SubQst_', $.subQuest) = -1):
  144. $RESULT = FUNC('DH_Functions', 'FormatStr', $dhQst_Msg_['NoSubQuest'], $.subQuest, $.questName)
  145. msg($RESULT)
  146. exit
  147. end
  148. if dhQst_Finished[$.questName] = False:
  149. $scr_Layout = 'dhScr_Def'
  150. IF (.clearScreen = True): func('Screen', 'ClearAll') else func('Screen', 'Clear', 'actions')
  151. KILLVAR '$dhDyn'
  152. gs 'DH_Quest_<<$.questName>>', $.subQuest
  153. gs 'DH_QuestManager', 'UpdateStoryCard'
  154. else
  155. $RESULT = FUNC('DH_Functions', 'FormatStr', $dhQst_Msg_['QuestComplete'], $.questName)
  156. msg($RESULT)
  157. exit
  158. end
  159. end
  160. if $ARGS[0] = 'Complete':
  161. $.questName = $ARGS[1]
  162. !! Check if quest exists
  163. if ARRPOS('$DhQst_List_', $.questName) = -1:
  164. $RESULT = FUNC('DH_Functions', 'FormatStr', $dhQst_Msg_['NoQuest'], $.questName)
  165. exit
  166. end
  167. if dhQst_Finished[$.questName] = False:
  168. dhQst_Started[$.questName] = True
  169. !! $scr_Theme = 'dhScr_Def'
  170. !! Not sure if this should just set the quest complete or go to the complete screen?
  171. gt 'DH_Quest_<<$.questName>>', 'Complete'
  172. else
  173. $RESULT = FUNC('DH_Functions', 'FormatStr', $dhQst_Msg_['QuestComplete'], $.questName)
  174. exit
  175. end
  176. end
  177. if $ARGS[0] = 'ProgressAct':
  178. $.actionText = $ARGS[1]
  179. $.questName = $ARGS[2]
  180. $.subQuest = $ARGS[3]
  181. $.textColor = $ARGS[4]
  182. func('write', 'actions', '<a class="action" href="exec:gs ''DH_QuestManager'', ''GoTo'', ''<<$.questName>>'', ''<<$.subQuest>>''" draggable="false">')
  183. func('write', 'actions', $.actionText, $.textColor)
  184. func('writeL', 'actions', '</a>')
  185. func('Screen', 'Update')
  186. end
  187. if $ARGS[0] = 'DynamicAct':
  188. $.actionText = $ARGS[1]
  189. $.dynamicId = $ARGS[2]
  190. $.textColor = $ARGS[3]
  191. func('write', 'actions', '<a class="action" href="exec:DYNAMIC $dhDyn[''<<$.dynamicId>>'']" draggable="false">')
  192. func('write', 'actions', $.actionText, $.textColor)
  193. func('writeL', 'actions', '</a>')
  194. func('Screen', 'Update')
  195. end
  196. --- DH_QuestManager ---------------------------------