Advertisement
martintokio

Quiver [XB]

Oct 30th, 2021
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. local quiverConfig = {
  2. ["ammunitionID"] = {25757, 25758, 15793}, -- Ammunition IDs. (Do not use names)
  3. ["huntCheck"] = true -- Do you want to check if quiver's open while hunting? (true/false)
  4. }
  5.  
  6.  
  7. registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
  8. function onWalkerSelectLabel(KiNGTiNScripts)
  9. if KiNGTiNScripts == "quiver|Check" then -- Here you have to add your label name, else use this one
  10. -- Checks if the quiver container it's open
  11. if (Container(Item.GetName(Self.Shield().id)):isOpen() == false) then
  12. -- If container it's not open, will proceed to open it
  13. --ch:SendYellowMessage("Quiver", "It's not open, re-openning.")
  14. Self.UseItemFromEquipment("shield")
  15. end
  16.  
  17. elseif KiNGTiNScripts == "quiver|Hunt" then -- Here you have to add your label name, else use this one
  18. -- Checks if the option it's enabled or not
  19. if quiverConfig["huntCheck"] == true then
  20. -- If it's enabled, will check if quiver it's open or not
  21. if (Container(Item.GetName(Self.Shield().id)):isOpen() == false) then
  22. -- If container it's not open, will proceed to open it
  23. --ch:SendYellowMessage("Quiver", "It's not open, re-openning.")
  24. Self.UseItemFromEquipment("shield") -- Opens the quiver
  25. end
  26. end
  27. end
  28. end
  29.  
  30. Module.New("quiver|Sorting", function(mod)
  31. local ammoTypes = quiverConfig["ammunitionID"]
  32. local quiverName = Item.GetName(Self.Shield().id)
  33. for i = 0, #Container.GetAll() do
  34. search = Container.New(i)
  35. cont = Container.New(quiverName)
  36. for spot = 0, cont:ItemCount() do
  37. local item = search:GetItemData(spot)
  38. if cont:isOpen() and search:Name() ~= cont:Name() and table.find(ammoTypes, item.id) and not cont:isFull() then
  39. print("Moving items...")
  40. search:MoveItemToContainer(spot, cont:Index(), 0, 500)
  41. end
  42. end
  43. end
  44. end)
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement