ソースを参照

Added Javascript for filtering salable cards

KeyMasterOfGozer 7 ヶ月 前
コミット
1065f22a03
1 ファイル変更48 行追加10 行削除
  1. 48 10
      README.md

+ 48 - 10
README.md

@@ -75,10 +75,10 @@ plot(2)
 
 ### javascript to filter Market for uncrystalized cards
 ```javascript
-clist=[]
-for (var i = 0; i < 153; i++) {clist.push(-1);}
+clist=[];
+for (var i = 0; i < 153; i++) {clist.push(0);}
 let player = document.createElement('div');
-player.id = 'player'
+player.id = 'player';
 player.innerHTML=await (await fetch('https://play.boobylegends.com/player/')).text();
 playerCards=player.getElementsByClassName('wrapper-card');
 for (var i = 0; i < playerCards.length; i++) {
@@ -88,17 +88,17 @@ for (var i = 0; i < playerCards.length; i++) {
     clist[cardNum]=stock;
     }catch(err){console.log('hi');}
 };
-cards=document.getElementsByClassName('wrapper-market-card')
+cards=document.getElementsByClassName('wrapper-market-card');
 for (var i = 0; i < cards.length; i++) {
     cardNum = cards.item(i).getElementsByClassName('pornstar-number')[0].outerText;
-    innerCard = cards.item(i).getElementsByClassName('inner-market-card')[0]
-    var stock = innerCard.getElementsByClassName('Stock')[0]
+    innerCard = cards.item(i).getElementsByClassName('inner-market-card')[0];
+    var stock = innerCard.getElementsByClassName('Stock')[0];
     if (stock){stock.innerText = "Stock: " + clist[cardNum]}
     else {
         let qty = document.createElement('div');
-        qty.classList.add('Stock')
-        qty.innerText = "Stock: " + clist[cardNum]
-        innerCard.appendChild(qty)
+        qty.classList.add('Stock');
+        qty.innerText = "Stock: " + clist[cardNum];
+        innerCard.appendChild(qty);
         }
     if (clist[cardNum].toString().includes('CRYSTAL')){
         cards.item(i).style.setProperty('Display','None');
@@ -108,7 +108,7 @@ for (var i = 0; i < cards.length; i++) {
 
 ### javascript to filter Market for good value cards
 ```javascript
-cards=document.getElementsByClassName('wrapper-market-card')
+cards=document.getElementsByClassName('wrapper-market-card');
 for (var i = 0; i < cards.length; i++) {
     cardNum = cards.item(i).getElementsByClassName('pornstar-number')[0].outerText;
     cardVal = parseInt(cards.item(i).getElementsByClassName('score-card')[0].outerText);
@@ -129,3 +129,41 @@ for (var i = 0; i < cards.length; i++) {
     }
 }
 ```
+
+### javascript to filter Player Page for salable cards
+```javascript
+clist=[];
+for (var i = 0; i < 153; i++) {clist.push(0);}
+let market = document.createElement('div');
+market.id = 'market';
+market.innerHTML=await (await fetch('https://play.boobylegends.com/market/')).text();
+marketCards=market.getElementsByClassName('wrapper-market-card');
+for (var i = 0; i < marketCards.length; i++) {
+    try{
+    cardNum = parseInt(marketCards.item(i).getElementsByClassName('pornstar-number')[0].innerText);
+    price = parseInt(marketCards.item(i).getElementsByClassName('cost')[0].innerText.trim());
+    clist[cardNum]=price;
+    }catch(err){console.log('error on '+cardNum.toString());}
+};
+cards=document.getElementsByClassName('wrapper-card');
+for (var i = 0; i < cards.length; i++) {
+    cardNum = parseInt(cards.item(i).getElementsByClassName('pornstar-number')[0].outerText);
+    var cardNB = cards.item(i).getElementsByClassName('card-nb')[0];
+    if (cardNB){
+        stock = parseInt(cards.item(i).getElementsByClassName('nb-label')[0].outerText.trim());
+        var price = cardNB.getElementsByClassName('Price')[0];
+        if (price){price.innerText = "Price: " + clist[cardNum]}
+        else{
+            let qty = document.createElement('div');
+            qty.classList.add('Price');
+            qty.innerText = "Price: " + clist[cardNum];
+            cardNB.appendChild(qty);
+        }
+    }else{
+        stock=0;
+    }
+    if (stock<2){
+        cards.item(i).style.setProperty('Display','None');
+    }
+}
+```