Ingen beskrivning

KeyMasterOfGozer 1065f22a03 Added Javascript for filtering salable cards 7 månader sedan
.gitignore 7f10bcda42 Add Graph Plotting to discord. 11 månader sedan
DiscordBot.md 0f98ee5191 Add stub for Discord Bot, and logging stubs. 11 månader sedan
README.md 1065f22a03 Added Javascript for filtering salable cards 7 månader sedan
config.py 9e4b571335 Create Objects Market and Player 11 månader sedan
db.py 7d06f90c29 Install some formatting for buyout function 8 månader sedan
discord-bot.py 0086f80a4a Canted Dates to 45 degree angle on Plot to help visibility 9 månader sedan
gatherMarket.py 6cd5140d3d Add parameters to gatherMarket to allow noLogin and no Player Data 7 månader sedan
logger.py 0f98ee5191 Add stub for Discord Bot, and logging stubs. 11 månader sedan
market.py 6cd5140d3d Add parameters to gatherMarket to allow noLogin and no Player Data 7 månader sedan
player.py 5993f0aacf Better Error messaging on HTML errors. 10 månader sedan

README.md

BoobyLegends Economic Helper

This is intended as a helper to find trends in the Booby Legends game.

I intend to built a Discord Bot Interface to let us share in our guild.

Running Executables

Gather Marketing Data

This will gather marketing data every 15 minutes, and build an average for each day in UTC timezone.

python3 gatherMarket.py

Classes

There are some main components written as python classes.

Market

Loads the current Market values for cards.

You can initialize the Market List like this:

from market import Market
m=Market()
m.fetchData()
m.show()

Show a filtered Market Page with cards you alreqady have Crystalized removed.

from market import Market
m=Market()
m.fetchData()
m.filterMarketCards(False)
#After doing stuff...
m.closePage()

Player

Loads the current Player values for cards. To get stock values, a "config.json" file must be in the folder with a "cookie" defined to have the player's login. I got my cookie by using the "EditThisCookie" plugin for Chrome. The config file should looks omething like this.

{
    "cookie":
        {
            "name":"wordpress_logged_in_f129834928365fbaer348384348y23423uy2323",
            "value":"keymasterofgozer%8ksojhelFM88efn98709cvaSneOVWEUVn9dvs9eVASEvjSEv8ksojhelFM88efn98709cvaSneOVWEUVn9dvs9eVASEvjSEv8ksojhelFM88efn98709cvaSneOVW"
        }
}

You can initialize your Player list like this:

from player import Player
p=Player()
p.fetchData()
p.show()

Get a List of non-crystal remaining Cards to collect

from player import Player
p=Player()
p.fetchData()
p.show(fields=['name','level','stock'],filter='stock != "CRYSTAL"')

Market Data

from db import MarketDB, hist, plot
hist(2)
plot(2)

javascript to filter Market for uncrystalized cards

clist=[];
for (var i = 0; i < 153; i++) {clist.push(0);}
let player = document.createElement('div');
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++) {
    try{
    cardNum = parseInt(playerCards.item(i).getElementsByClassName('pornstar-number')[0].innerText);
    stock = playerCards.item(i).getElementsByClassName('card-nb')[0].innerText.trim();
    clist[cardNum]=stock;
    }catch(err){console.log('hi');}
};
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];
    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);
        }
    if (clist[cardNum].toString().includes('CRYSTAL')){
        cards.item(i).style.setProperty('Display','None');
    }
}

javascript to filter Market for good value cards

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);
    cardCost = parseInt(cards.item(i).getElementsByClassName('cost')[0].outerText);
    cardPPG = cardVal/cardCost;
    innerCard = cards.item(i).getElementsByClassName('inner-market-card')[0];
    var PPG = innerCard.getElementsByClassName('PPG')[0];
    if (PPG){PPG.innerHTML = "Points/<img src='https://play.boobylegends.com/wp-content/themes/child-roulette/img/gem.png' style='height:22px'>:<br/>" + cardPPG.toFixed(2);}
    else {
        let qty = document.createElement('div');
        qty.classList.add('PPG');
        qty.innerHTML = "Points/<img src='https://play.boobylegends.com/wp-content/themes/child-roulette/img/gem.png' style='height:22px'>:<br/>" + cardPPG.toFixed(2);
        qty.setAttribute("align", "center");
        innerCard.appendChild(qty);
        }
    if (cardPPG < 2){
        cards.item(i).style.setProperty('Display','None');
    }
}

javascript to filter Player Page for salable cards

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');
    }
}