Advertisement
martintokio

Quiver Function

Feb 15th, 2021 (edited)
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. -- [[ Quiver functions
  2. -- examples of it's utilitation. ]]
  3.  
  4. local quiverConfig = {
  5. ["defaultContainer"] = "Jewelled Backpack",
  6. ["quiverContainer"] = "Red Quiver",
  7. ["ammunitionID"] = {25757, 25758},
  8. ["labelAfter"] = "openQuiver", -- Label that's after your label to open containers.
  9. ["huntCheck"] = true, -- If you want to check if your quiver's open while hunting.
  10. ["huntLabel"] = "huntQuiver" -- Label that you'll be using to check while hunting.
  11. }
  12.  
  13. registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
  14. function onWalkerSelectLabel(scriptExamples)
  15. if scriptExamples == quiverConfig["labelAfter"] then
  16. -- Checks if the quiver container it's open
  17. if (Container(quiverConfig["quiverContainer"]):isOpen() == false) then
  18. -- If container it's not open, will proceed to open it
  19. Self.UseItemFromEquipment("shield")
  20. end
  21. elseif scriptExamples == quiverConfig["huntLabel"] then
  22. -- Checks if the option it's enabled or not
  23. if quiverConfig["huntCheck"] == true then
  24. -- If it's enabled, will check if quiver it's open or not
  25. if (Container(quiverConfig["quiverContainer"]):isOpen() == false) then
  26. -- If container it's not open, will proceed to open it
  27. Self.UseItemFromEquipment("shield") -- Opens the quiver
  28. end
  29. end
  30. end
  31. end
  32.  
  33. Module.New("sort|SpecialAmmo", function()
  34. local defaultContainer = Container(quiverConfig["defaultContainer"])
  35. local quiverContainer = Container(quiverConfig["quiverContainer"])
  36. for spot, item in defaultContainer:iItems() do
  37. if (table.contains(quiverConfig["ammunitionID"], item.id) and not quiverContainer:isFull()) then
  38. defaultContainer:MoveItemToContainer(spot, Container.New(quiverConfig["quiverContainer"]):Index())
  39. break
  40. end
  41. end
  42. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement