python steemmonsters 0.0.23 - new play modi and pack handling added

in #utopian-io5 years ago (edited)

Repository

https://github.com/holgern/steemmonsters

steemmonsters is a python command line tool for playing steemmonsters without graphics. The newest version 0.0.23 can be downloaded here.

New API commands

get_open_all_packs

Opens all booster packs at once

from steemmonsters.api import Api
api = Api()
response = api.get_open_all_packs("holger80", 1, token):

get_open_packs

Opens an owned booster pack.

from steemmonsters.api import Api
api = Api()
response = api.get_open_packs("B-xxx", "holger80", 1, token):

get_cards_packs

Returns the unopened packs of a player

from steemmonsters.api import Api
import json
from beembase import memo as Memo
from beemgraphenebase.account import PrivateKey, PublicKey
api = Api()
account = "holger80"
response = api.get_player_login(account)
postingwif = "5xx"
token = Memo.decode_memo(PrivateKey(postingwif), response["token"])
response = api.get_cards_packs(account, token)
tx = json.dumps(response, indent=4)
print(tx)

get_market_for_sale_by_card

Returns the currently available cards on the market

from steemmonsters.api import Api
api = Api()
response = api.get_market_for_sale_by_card(10, "true", 1)
print(response[0])

get_market_for_sale_grouped

Shows the minimum and maximum prices for all cards.

from steemmonsters.api import Api
api = Api()
response = api.get_market_for_sale_grouped()
print(response[0])

Command line tool

New play modi

sm> play quest f1

Plays team f1 until the quest is solved.

sm> play mirror

Whenever the current team loses a defined number of times in a row, a new team from the last played teams of the top 100 is copied and used.

sm> play t1,t2,t3

Play team t1 until a defined number of loses in a row occurs. Then the team is switched to the next one. For the example, "switch_on_loosing_streak": 1 is set and t1 has lost two times. The next match is then played with team t2. After t3, t1 is used.

sm> play random t1,t2,t3

Plays one of the three given teams. The team is randomly chosen. The team is switched whenever a pre-defined number of loses in a row occur.

New parameter for the config file

"switch_on_loosing_streak": 1,

defines when the current team is switched. This plays only a role, when more than one team was defined.

Creating new decks based on already played teams with a high winning rate.

sm> splinter fire 2

Shows up to 15 fire splinter teams with summoner level 2. One of the shown teams can be selected and stored under a given name.
image.png

Show, open and gift packs

sm>packs

shows all unopened packs of the currently selected player

sm>openpack

shows all available packs and let the user select one and opens it then. The open market value and card name of all cards are shown in a table.
image.png

sm> giftpacks holger80

After starting the command, all available decks were shown and the user can set how many packs are sent.

Account switch without changing the config file

sm> set_account holger80

Changes the currently selected player to holger80, without the need to change the config file and reload it.

Commit history

Release 0.0.23

Release 0.0.22

  • commit fc33cd5
  • Add get_market_for_sale_grouped api call
  • Improve output for openpack
  • Collection shows card names

Release 0.0.21

  • commit 70c4ff3
  • openpack added
  • play random <deck1>,<deck2>,.. added
  • play quest play_counter fixed
  • get_open_packs and get_open_all_packs API-calls improved

Release 0.0.20

  • commit d25cbae
  • Utility functions get_summoner_level, convert_team_id_to_string, expand_short_form, convert_team_string_to_id and get_cards_collection added to prevent duplicated code
  • set_account can be used to switch an account
  • packs shows the unopened packs
  • giftpacks moves unopened packs to an other player
  • splinter <plinter> <summoner_level> can be used to received often played decks and store them for later usage
  • play quest <team_name> - plays until the quest is solved
  • play mirror - selects randomly a last played team for the op 100 and uses it, deck is switched when losing, or when switch_on_loosing_streake is set, when reached
  • play <deck1>,<deck2> plays the first deck and switches when loosing, when switch_on_loosing_streake is set, when switch_on_loosing_streake is reached.

Release 0.0.16

GitHub Account

https://github.com/holgern

Sort:  

Great library.

I have seen a couple of checks like

str(response) != '<Response [200]>'

to check response status codes. You can do the same with response.status_code. I believe this is more explicit and better since the str represantion of the Response class doesn't look reliable to do that kind of checks.


Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

That is a really good advice, i will improve this in my next update.
$rewarding 50% 14min

Posted using Partiko Android

Command accepted.

Thank you for your review, @emrebeyler! Keep up the good work!

Great update! Was hoping for a play mode that switched decks. The playlog PR will be up tomorrow or Friday.

Posted using Partiko Android

Hi @holger80!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hi, @holger80!

You just got a 0.95% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

Hey, @holger80!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!