9
3

TheWanderersThreeMeaningsOfLife.lua 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. --[[
  2. Script Name : Quests/ThunderingSteppes/TheWanderersThreeMeaningsOfLife.lua
  3. Script Author : Jabantiz
  4. Script Date : 2014.07.11 07:07:40
  5. Script Purpose :
  6. Zone : ThunderingSteppes
  7. Quest Giver: The Wandering Augur (2490318)
  8. Preceded by: None
  9. Followed by: None
  10. --]]
  11. local STEP1_SERPENTS = 1
  12. local STEP1_HAWKS = 2
  13. local STEP1_GORGERS = 4
  14. local STEP3_CRABS = 8
  15. local STEP3_SIRENS = 16
  16. local STEP5_CEMETERY = 32
  17. local STEP5_LASTSTAND = 64
  18. local STEP5_DECAY = 128
  19. function Init(Quest)
  20. end
  21. function Step1Complete(Quest, QuestGiver, Player)
  22. local Flags = GetQuestFlags(Quest)
  23. if hasflag(Flags, STEP1_SERPENTS) then
  24. UpdateQuestStepDescription(Quest, 1, "I've slain a plains serpent.")
  25. elseif hasflag(Flags, STEP1_HAWKS) then
  26. UpdateQuestStepDescription(Quest, 1, "I've slain an elder hawk.")
  27. elseif hasflag(Flags, STEP1_GORGERS) then
  28. UpdateQuestStepDescription(Quest, 1, "I've slain a carrion gorger.")
  29. end
  30. AddQuestStepChat(Quest, 2, "I must speak with the Wandering Augur.", 1, "The Wandering Augur is teaching me three meanings of life.", 11, 2490318)
  31. AddQuestStepCompleteAction(Quest, 2, "Step2Complete")
  32. end
  33. function Step2Complete(Quest, QuestGiver, Player)
  34. local step3 = math.random(1, 2)
  35. local Flags = GetQuestFlags(Quest)
  36. if step3 == 1 then
  37. Flags = Flags + STEP3_CRABS
  38. elseif step3 == 2 then
  39. Flags = Flags + STEP3_SIRENS
  40. end
  41. SetStep3Description(Quest, step3)
  42. SetQuestFlags(Quest, Flags)
  43. end
  44. function SetStep3Description(Quest, step3)
  45. UpdateQuestStepDescription(Quest, 2, "I've spoken with the Wandering Augur.")
  46. if step3 == 1 then
  47. AddQuestStepKill(Quest, 3, "Learn inner strength by hunting large shore crabs in the Thundering Steppes.", 5, 100, "The Wandering Augur is teaching me three meanings of life.", 86, 2490280)
  48. elseif step3 == 2 then
  49. AddQuestStepKill(Quest, 3, "Learn inner strength by hunting irresistible sirens in the Thundering Steppes.", 5, 100, "The Wandering Augur is teaching me three meanings of life.", 86, 2490117)
  50. end
  51. AddQuestStepCompleteAction(Quest, 3, "Step3Complete")
  52. end
  53. function CheckStep3Bitmask(Quest)
  54. local step3 = 0
  55. local Flags = GetQuestFlags(Quest)
  56. if hasflag(Flags, STEP3_CRABS) then
  57. step3 = 1
  58. elseif hasflag(Flags, STEP3_SIRENS) then
  59. step3 = 2
  60. end
  61. SetStep3Description(Quest, step3)
  62. end
  63. function Step3Complete(Quest, QuestGiver, Player)
  64. local Flags = GetQuestFlags(Quest)
  65. if hasflag(Flags, STEP3_CRABS) then
  66. UpdateQuestStepDescription(Quest, 3, "I've slain some large shore crabs.")
  67. elseif hasflag(Flags, STEP3_SIRENS) then
  68. UpdateQuestStepDescription(Quest, 3, "I've slain some irresistible sirens.")
  69. end
  70. AddQuestStepChat(Quest, 4, "I must speak with the Wandering Augur.", 1, "The Wandering Augur is teaching me three meanings of life.", 11, 2490318)
  71. AddQuestStepCompleteAction(Quest, 4, "Step4Complete")
  72. end
  73. function Step4Complete(Quest, QuestGiver, Player)
  74. local step5 = math.random(1, 3)
  75. local Flags = GetQuestFlags(Quest)
  76. if step5 == 1 then
  77. Flags = Flags + STEP5_CEMETERY
  78. elseif step5 == 2 then
  79. Flags = Flags + STEP5_LASTSTAND
  80. elseif step5 == 3 then
  81. Flags = Flags + STEP5_DECAY
  82. end
  83. SetStep5Description(Quest, step5)
  84. SetQuestFlags(Quest, Flags)
  85. end
  86. function SetStep5Description(Quest, step5)
  87. UpdateQuestStepDescription(Quest, 4, "I've spoken with the Wandering Augur.")
  88. if step5 == 1 then
  89. AddQuestStepLocation(Quest, 5, "I've seen the Coldwind Shores Cemetery.", 20, "The Wandering Augur is teaching me three meanings of life.", 11, 1317, -6, -80)
  90. elseif step5 == 2 then
  91. AddQuestStepLocation(Quest, 5, "I need the patience to find the Last Stand in the Thundering Steppes.", 20, "The Wandering Augur is teaching me three meanings of life.", 11, -380, 6, 761)
  92. elseif step5 == 3 then
  93. AddQuestStepLocation(Quest, 5, "I've located the Shrine of Decay.", 20, "The Wandering Augur is teaching me three meanings of life.", 11, 357, 5, 1189)
  94. end
  95. AddQuestStepCompleteAction(Quest, 5, "Step5Complete")
  96. end
  97. function CheckStep5Bitmask(Quest)
  98. local step5 = 0
  99. local Flags = GetQuestFlags(Quest)
  100. if hasflag(Flags, STEP5_CEMETERY) then
  101. step5 = 1
  102. elseif hasflag(Flags, STEP5_LASTSTAND) then
  103. step5 = 2
  104. elseif hasflag(Flags, STEP5_DECAY) then
  105. step5 = 3
  106. end
  107. SetStep5Description(Quest, step5)
  108. end
  109. function Step5Complete(Quest, QuestGiver, Player)
  110. local Flags = GetQuestFlags(Quest)
  111. if hasflag(Flags, STEP5_CEMETERY) then
  112. UpdateQuestStepDescription(Quest, 5, "I've seen the Coldwind Shores Cemetery.")
  113. elseif hasflag(Flags, STEP5_LASTSTAND) then
  114. UpdateQuestStepDescription(Quest, 5, "I've located the Last Stand.")
  115. elseif hasflag(Flags, STEP5_DECAY) then
  116. UpdateQuestStepDescription(Quest, 5, "I've located the Shrine of Decay.")
  117. end
  118. AddQuestStepChat(Quest, 6, "I must speak with the Wandering Augur.", 1, "The Wandering Augur is teaching me three meanings of life.", 11, 2490318)
  119. AddQuestStepCompleteAction(Quest, 6, "Step6Complete")
  120. end
  121. function Step6Complete(Quest, QuestGiver, Player)
  122. GiveQuestReward(Quest, Player)
  123. end
  124. function Accepted(Quest, QuestGiver, Player)
  125. FaceTarget(QuestGiver, Player)
  126. conversation = CreateConversation()
  127. PlayFlavor(QuestGiver, "voiceover/english/the_wandering_augur/steppes/quests/quest_wandering_augur/wandering_augur003.mp3", "", "", 430514653, 1419831869, Player)
  128. AddConversationOption(conversation, "Well, okay.")
  129. StartConversation(conversation, QuestGiver, Player, "Splendid! There are three meanings to which I can lead you, my child. What you take from them is your choice; I am but the augur. The first meaning is physical. Without a corporeal body, how can we experience life? Go, then, and seek the physicality of life as I have written down for you. Return to me when you are ready for the next meaning.")
  130. local Flags = GetQuestFlags(Quest)
  131. if Flags == 0 then
  132. local step1 = math.random(1, 3)
  133. if step1 == 1 then
  134. Flags = Flags + STEP1_SERPENTS
  135. elseif step1 == 2 then
  136. Flags = Flags + STEP1_HAWKS
  137. elseif step1 == 3 then
  138. Flags = Flags + STEP1_GORGERS
  139. end
  140. SetStep1Description(Quest, step1)
  141. SetQuestFlags(Quest, Flags)
  142. else
  143. CheckStep1Bitmask(Quest)
  144. end
  145. end
  146. function SetStep1Description(Quest, step1)
  147. if step1 == 1 then
  148. AddQuestStepKill(Quest, 1, "Learn the physical meaning of life by hunting plains serpents in the Thundering Steppes.", 3, 100, "The Wandering Augur is teaching me three meanings of life.", 98, 2490110)
  149. elseif step1 == 2 then
  150. AddQuestStepKill(Quest, 1, "Learn physical meaning of life by hunting elder hawks in the Thundering Steppes.", 3, 100, "The Wandering Augur is teaching me three meanings of life.", 98, 2490108)
  151. elseif step1 == 3 then
  152. AddQuestStepKill(Quest, 1, "Learn the physical meaning of life by hunting carrion gorgers in the Thundering Steppes.", 3, 100, "The Wandering Augur is teaching me three meanings of life.", 98, 2490118)
  153. end
  154. AddQuestStepCompleteAction(Quest, 1, "Step1Complete")
  155. end
  156. function CheckStep1Bitmask(Quest)
  157. local step1 = 0
  158. local Flags = GetQuestFlags(Quest)
  159. if hasflag(Flags, STEP1_SERPENTS) then
  160. step1 = 1
  161. elseif hasflag(Flags, STEP1_HAWKS) then
  162. step1 = 2
  163. elseif hasflag(Flags, STEP1_GORGERS) then
  164. step1 = 3
  165. end
  166. SetStep1Description(Quest, step1)
  167. end
  168. function Deleted(Quest, QuestGiver, Player)
  169. end
  170. function Declined(Quest, QuestGiver, Player)
  171. end
  172. function hasflag(flags, flag)
  173. return flags % (2*flag) >= flag
  174. end
  175. function Reload(Quest, QuestGiver, Player, Step)
  176. if Step == 0 then
  177. CheckStep1Bitmask(Quest)
  178. elseif Step == 1 then
  179. Step1Complete(Quest, QuestGiver, Player)
  180. elseif Step == 2 then
  181. CheckStep3Bitmask(Quest)
  182. elseif Step == 3 then
  183. Step3Complete(Quest, QuestGiver, Player)
  184. elseif Step == 4 then
  185. CheckStep5Bitmask(Quest)
  186. elseif Step == 5 then
  187. Step5Complete(Quest, QuestGiver, Player)
  188. elseif Step == 6 then
  189. Step6Complete(Quest, QuestGiver, Player)
  190. end
  191. end