Advertisement
Hirsw0w

Untitled

Feb 23rd, 2021
579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 KB | None | 0 0
  1. var cases = [];
  2.  
  3. fetch("https://api.datdrop.com/api/dropcase/", {
  4. "headers": {
  5. "accept": "application/json",
  6. "accept-language": "he-IL,he;q=0.9,en-US;q=0.8,en;q=0.7,nl;q=0.6",
  7. "sec-fetch-dest": "empty",
  8. "sec-fetch-mode": "cors",
  9. "sec-fetch-site": "same-site",
  10. "x-application-id": "730",
  11. "x-client-id": "15828987403100.204253287691756",
  12. "x-client-version": "7",
  13. "x-language": "en",
  14. "x-nonce": "3004542"
  15. },
  16. "referrer": "https://datdrop.com/",
  17. "referrerPolicy": "no-referrer-when-downgrade",
  18. "body": null,
  19. "method": "GET",
  20. "mode": "cors",
  21. "credentials": "omit"
  22. }).then((response) => response.json()).then((myJson) => {
  23. cases = myJson;
  24. var count = 0;
  25. var cases = cases.filter((a) => a.stock == "in_stock" && a.human_price < 350).sort((a, b) => a.human_price - b.human_price);
  26. for (var c of cases) {
  27. var slug = c.slug;
  28. callTimeOut(slug, count++);
  29.  
  30. }
  31.  
  32. function callTimeOut(caseName, count) {
  33. setTimeout(function () {
  34. calculateCase(caseName);
  35. }, 1000 * count);
  36. }
  37. });
  38.  
  39. var output = "";
  40.  
  41. function calculateCase(caseName) {
  42. fetch("https://api.datdrop.com/api/dropcase/" + caseName, {
  43. "headers": {
  44. "accept": "application/json",
  45. "accept-language": "he-IL,he;q=0.9,en-US;q=0.8,en;q=0.7,nl;q=0.6",
  46. "sec-fetch-dest": "empty",
  47. "sec-fetch-mode": "cors",
  48. "sec-fetch-site": "same-site",
  49. "x-application-id": "730",
  50. "x-client-id": "15985402558040.49803865996272023",
  51. "x-client-version": "7",
  52. "x-language": "en",
  53. "x-nonce": "6905797"
  54. },
  55. "referrer": "https://datdrop.com/",
  56. "referrerPolicy": "strict-origin-when-cross-origin",
  57. "body": null,
  58. "method": "GET",
  59. "mode": "cors",
  60. "credentials": "omit"
  61. }).then((response) => response.json()).then((myJson) => {
  62. var items = myJson.items;
  63. var chances = myJson.chances;
  64.  
  65. var casePrice = myJson.human_price;
  66. var shouldBePrice = 0;
  67. for (var item of items) {
  68. var chance = chances[item.id].human_chance;
  69. var price = item.human_drop_price;
  70. shouldBePrice += price * chance;
  71. }
  72. var houseEdge = (1 - (1 / (casePrice / shouldBePrice))) * 100;
  73. output += "Case Name: " + myJson.name + " | Case Price: " + casePrice.toFixed(2) + " | Price should be: " + shouldBePrice.toFixed(2) + " | House Edge: " + houseEdge.toFixed(2) + "%\n";
  74. console.log("Case Name: " + myJson.name + " | Case Price: " + casePrice.toFixed(2) + " | Price should be: " + shouldBePrice.toFixed(2) + " | House Edge: " + houseEdge.toFixed(2) + "%");
  75. });
  76. }
  77.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement