HuntingForTrapperBorgus.lua 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. --[[
  2. Script Name : Quests/ThunderingSteppes/HuntingForTrapperBorgus.lua
  3. Script Author : Jabantiz
  4. Script Date : 2014.07.03 08:07:38
  5. Script Purpose :
  6. Zone : ThunderingSteppes
  7. Quest Giver:
  8. Preceded by: None
  9. Followed by:
  10. --]]
  11. local beetles = 1
  12. local crabs = 2
  13. local antelope = 4
  14. local snakes = 8
  15. local kill8 = 16
  16. local kill9 = 32
  17. local kill10 = 64
  18. local kill11 = 128
  19. local kill12 = 256
  20. function Init(Quest)
  21. SetQuestFeatherColor(Quest, 3)
  22. SetQuestRepeatable(Quest)
  23. end
  24. function FinishedKilling(Quest, QuestGiver, Player)
  25. UpdateQuestTaskGroupDescription(Quest, 1, "I've slain quite a few of the local Steppes creatures, this should be enough for the needed provisions.")
  26. AddQuestStepChat(Quest, 6, "I should return to Trapper Borgus on the road to Antonica in the Thundering Steppes.", 1, "I should report back to Trapper Borgus.", 11, 2490327)
  27. AddQuestStepCompleteAction(Quest, 6, "CompleteQuest")
  28. SetCompleteFlag(Quest)
  29. end
  30. function Accepted(Quest, QuestGiver, Player)
  31. FaceTarget(QuestGiver, Player)
  32. conversation = CreateConversation()
  33. if GetTempVariable(Player, "RepeatHuntingForTrapperBorgus") == "true" then
  34. -- agree to do it again after turn in
  35. PlayFlavor(QuestGiver, "voiceover/english/trapper_borgus/steppes/trapper_borgus005.mp3", "", "", 3731275829, 2804607060, Player)
  36. AddConversationOption(conversation, "No problem.")
  37. StartConversation(conversation, QuestGiver, Player, "Righto, I need yeh to slay some more beasts for me.")
  38. else
  39. PlayFlavor(QuestGiver, "voiceover/english/trapper_borgus/steppes/trapper_borgus002.mp3", "", "", 2714498539, 3912364452, Player)
  40. AddConversationOption(conversation, "I'm ready to hunt.")
  41. StartConversation(conversation, QuestGiver, Player, "I thank yeh, and me back thanks yeh! I just need several of each kind o' Steppes beasts that wander in these parts, they should provide enough food for the coming months! Slay them n' bring their bodies to me.")
  42. end
  43. SetTempVariable(Player, "RepeatHuntingForTrapperBorgus", nil)
  44. if GetQuestFlags(Quest) == 0 then
  45. -- needs to be in accept to make it random per person
  46. local mob_type = math.random(1, 4) -- what to kill
  47. local quantity = math.random(8, 12)
  48. local flags = 0
  49. if mob_type == 1 then -- Beetles
  50. flags = beetles
  51. elseif mob_type == 2 then -- Crabs
  52. flags = crabs
  53. elseif mob_type == 3 then -- Antelope
  54. flags = antelope
  55. elseif mob_type == 4 then -- Snakes
  56. flags = snakes
  57. end
  58. if quantity == 8 then
  59. flags = flags + kill8
  60. elseif quantity == 9 then
  61. flags = flags + kill9
  62. elseif quantity == 10 then
  63. flags = flags + kill10
  64. elseif quantity == 11 then
  65. flags = flags + kill11
  66. elseif quantity == 12 then
  67. flags = flags + kill12
  68. end
  69. SetQuestFlags(Quest, flags)
  70. SetStep(Quest, Player, mob_type, quantity)
  71. else -- need the else for /reload quest
  72. CheckBitMask(Quest, Player, GetQuestFlags(Quest))
  73. end
  74. end
  75. function hasflag(flags, flag)
  76. return flags % (2*flag) >= flag
  77. end
  78. function CheckBitMask(Quest, Player, Flags)
  79. local mob_type = 0
  80. local quantity = 0
  81. if hasflag(Flags, beetles) then
  82. mob_type = 1
  83. elseif hasflag(Flags, crabs) then
  84. mob_type = 2
  85. elseif hasflag(Flags, antelope) then
  86. mob_type = 3
  87. elseif hasflag(Flags, snakes) then
  88. mob_type = 4
  89. end
  90. if hasflag(Flags, kill8) then
  91. quantity = 8
  92. elseif hasflag(Flags, kill9) then
  93. quantity = 9
  94. elseif hasflag(Flags, kill10) then
  95. quantity = 10
  96. elseif hasflag(Flags, kill11) then
  97. quantity = 11
  98. elseif hasflag(Flags, kill12) then
  99. quantity = 12
  100. end
  101. SetStep(Quest, Player, mob_type, quantity)
  102. end
  103. function Declined(Quest, QuestGiver, Player)
  104. SetTempVariable(Player, "RepeatHuntingForTrapperBorgus", nil)
  105. end
  106. function CompleteQuest(Quest, QuestGiver, Player)
  107. GiveQuestReward(Quest, Player)
  108. end
  109. function SetStep(Quest, Player, mob, quantity)
  110. if mob == 1 then
  111. AddQuestStepKill(Quest, 1, "Hunt beetles in the Thundering Steppes.", quantity, 100, "I'm supposed to help Trapper Borgus get the provisions his family requires, I should get them back to him as soon as I am done.", 0, 2490206, 2490050, 2490058)
  112. elseif mob == 2 then
  113. AddQuestStepKill(Quest, 1, "Hunt crabs in the Thundering Steppes.", quantity, 100, "I'm supposed to help Trapper Borgus get the provisions his family requires, I should get them back to him as soon as I am done.", 0, 2490280, 2490007, 2490128, 2490200)
  114. elseif mob == 3 then
  115. AddQuestStepKill(Quest, 1, "Hunt antelope in the Thundering Steppes.", quantity, 100, "I'm supposed to help Trapper Borgus get the provisions his family requires, I should get them back to him as soon as I am done.", 0, 2490056, 2490052, 2490047)
  116. else
  117. AddQuestStepKill(Quest, 1, "Hunt snakes in the Thundering Steppes.", quantity, 100, "I'm supposed to help Trapper Borgus get the provisions his family requires, I should get them back to him as soon as I am done.", 0, 2490181, 2490110)
  118. end
  119. AddQuestStepCompleteAction(Quest, 1, "FinishedKilling")
  120. end
  121. function Reload(Quest, QuestGiver, Player, Step)
  122. if Step == 0 then
  123. CheckBitMask(Quest, Player, GetQuestFlags(Quest))
  124. elseif Step == 1 then
  125. FinishedKilling(Quest, QuestGiver, Player)
  126. end
  127. end
  128. function Deleted(Quest, QuestGiver, Player)
  129. end