recycling_the_old-fashioned_way.lua 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. --[[
  2. Script Name : Quests/ThunderingSteppes/recycling_the_old-fashioned_way.lua
  3. Script Author : Patrick_Boyd
  4. Script Date : 2020.09.07
  5. Script Purpose :
  6. Zone : ThunderingSteppes
  7. Quest Giver: Green Stiles
  8. Preceded by: None
  9. Followed by:
  10. --]]
  11. local STEP1_ANTELOPE = 1
  12. local STEP1_LIONESS = 2
  13. local STEP1_SIREN = 4
  14. function Init(Quest)
  15. SetQuestFeatherColor(Quest, 1)
  16. SetQuestRepeatable(Quest)
  17. end
  18. function Step1Complete(Quest, QuestGiver, Player)
  19. local Flags = GetQuestFlags(Quest)
  20. if hasflag(Flags, STEP1_ANTELOPE) then
  21. UpdateQuestStepDescription(Quest, 1, "Got five antelope bones.")
  22. elseif hasflag(Flags, STEP1_LIONESS) then
  23. UpdateQuestStepDescription(Quest, 1, "Got five highland lioness bones.")
  24. elseif hasflag(Flags, STEP1_SIREN) then
  25. UpdateQuestStepDescription(Quest, 1, "Got five entrancing siren bones.")
  26. end
  27. AddQuestStepChat(Quest, 2, "I need to speak with Grenn Stiles.", 1, "Take the bones back to Grenn in the Thundering Steppes.", 11, 2490174)
  28. AddQuestStepCompleteAction(Quest, 2, "Step2Complete")
  29. end
  30. function Step2Complete(Quest, QuestGiver, Player)
  31. GiveQuestReward(Quest, Player)
  32. end
  33. function Accepted(Quest, QuestGiver, Player)
  34. conversation = CreateConversation()
  35. AddConversationOption(conversation, "All right, I'll be back")
  36. StartConversation(conversation, QuestGiver, Player, "Oh, the price is right, my friend! It's free! And I'll even pay you for your work! I need a variety of bones: some antelope, huntress and siren bones for a sort of 'surf and turf' fertilizer. The Steppes abound with these creatures. Think of this as recycling. We're helping the environment, eh?")
  37. local Flags = GetQuestFlags(Quest)
  38. if Flags == 0 then
  39. local step1 = math.random(1, 3)
  40. if step1 == 1 then
  41. Flags = Flags + STEP1_ANTELOPE
  42. elseif step1 == 2 then
  43. Flags = Flags + STEP1_LIONESS
  44. elseif step1 == 3 then
  45. Flags = Flags + STEP1_SIREN
  46. end
  47. SetStep1Description(Quest, step1)
  48. SetQuestFlags(Quest, Flags)
  49. else
  50. CheckStep1Bitmask(Quest)
  51. end
  52. end
  53. function SetStep1Description(Quest, step1)
  54. if step1 == 1 then
  55. AddQuestStepKill(Quest, 1, "Get five young antelope bones in the Thundering Steppes.", 5, 100, "Get various bones for Grenn's fertilizer mix.", 418, 2490047)
  56. elseif step1 == 2 then
  57. AddQuestStepKill(Quest, 1, "Get five highland lioness bones in the Thundering Steppes.", 5, 100, "Get various bones for Grenn's fertilizer mix.", 322, 2490043)
  58. elseif step1 == 3 then
  59. AddQuestStepKill(Quest, 1, "Get five entrancing siren bones in the Thundering Steppes.", 5, 100, "Get various bones for Grenn's fertilizer mix.", 322, 2490245)
  60. end
  61. AddQuestStepCompleteAction(Quest, 1, "Step1Complete")
  62. end
  63. function Deleted(Quest, QuestGiver, Player)
  64. end
  65. function Declined(Quest, QuestGiver, Player)
  66. end
  67. function hasflag(flags, flag)
  68. return flags % (2*flag) >= flag
  69. end
  70. function Reload(Quest, QuestGiver, Player, Step)
  71. if Step == 1 then
  72. Step1Complete(Quest, QuestGiver, Player)
  73. elseif Step == 2 then
  74. Step2Complete(Quest, QuestGiver, Player)
  75. elseif Step == 3 then
  76. Step3Complete(Quest, QuestGiver, Player)
  77. end
  78. end