Mike Greene d6da08dea9 JavaScript export to filter Market | 8 bulan lalu | |
---|---|---|
.gitignore | 11 bulan lalu | |
DiscordBot.md | 11 bulan lalu | |
README.md | 8 bulan lalu | |
config.py | 11 bulan lalu | |
db.py | 8 bulan lalu | |
discord-bot.py | 9 bulan lalu | |
gatherMarket.py | 10 bulan lalu | |
logger.py | 11 bulan lalu | |
market.py | 8 bulan lalu | |
player.py | 10 bulan lalu |
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.
This will gather marketing data every 15 minutes, and build an average for each day in UTC timezone.
python3 gatherMarket.py
There are some main components written as python classes.
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()
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"')
from db import MarketDB, hist, plot
hist(2)
plot(2)
from datetime import datetime
from db import PlayerDB
from tinydb import Query
import json
today=datetime.utcnow().strftime('%Y-%m-%d')
Cards=PlayerDB.search(Query().fragment({'date':today}))
clist=[None]*152
for card in Cards: clist[card['card-num']]=card['stock']
js="clist={clist}\n".format(clist=json.dumps(clist))
js+="""
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]
let qty = document.createElement('div');
qty.innerText = "Stock: " + clist[cardNum]
innerCard.appendChild(qty)
if (clist[cardNum].includes('CRYSTAL')){
cards.item(i).style.setProperty('Display','None');
}
}"""
print(js)