@@ -7,6 +7,7 @@ import pickle
|
|||||||
import platform
|
import platform
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import random
|
||||||
import signal
|
import signal
|
||||||
from slickrpc import Proxy
|
from slickrpc import Proxy
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
@@ -1044,6 +1045,7 @@ def print_multiplayer_games_list(rpc_connection):
|
|||||||
|
|
||||||
def rogue_newgame_singleplayer(rpc_connection, is_game_a_rogue=True):
|
def rogue_newgame_singleplayer(rpc_connection, is_game_a_rogue=True):
|
||||||
try:
|
try:
|
||||||
|
if is_game_a_rogue:
|
||||||
new_game_txid = rpc_connection.cclib("newgame", "17", "[1]")["txid"]
|
new_game_txid = rpc_connection.cclib("newgame", "17", "[1]")["txid"]
|
||||||
print("New singleplayer training game succesfully created. txid: " + new_game_txid)
|
print("New singleplayer training game succesfully created. txid: " + new_game_txid)
|
||||||
while True:
|
while True:
|
||||||
@@ -1054,6 +1056,10 @@ def rogue_newgame_singleplayer(rpc_connection, is_game_a_rogue=True):
|
|||||||
else:
|
else:
|
||||||
print(colorize("Game transaction is mined", "green"))
|
print(colorize("Game transaction is mined", "green"))
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
pending_games = rpc_connection.cclib("pending", "17")["pending"]
|
||||||
|
new_game_txid = random.choice(pending_games)
|
||||||
|
if is_game_a_rogue:
|
||||||
players_list = rogue_players_list(rpc_connection)
|
players_list = rogue_players_list(rpc_connection)
|
||||||
if len(players_list["playerdata"]) > 0:
|
if len(players_list["playerdata"]) > 0:
|
||||||
print_players_list(rpc_connection)
|
print_players_list(rpc_connection)
|
||||||
@@ -1073,6 +1079,8 @@ def rogue_newgame_singleplayer(rpc_connection, is_game_a_rogue=True):
|
|||||||
print("No players available to select")
|
print("No players available to select")
|
||||||
input("Press [Enter] to continue...")
|
input("Press [Enter] to continue...")
|
||||||
newgame_regisration_txid = rogue_game_register(rpc_connection, new_game_txid)["txid"]
|
newgame_regisration_txid = rogue_game_register(rpc_connection, new_game_txid)["txid"]
|
||||||
|
else:
|
||||||
|
newgame_regisration_txid = rogue_game_register(rpc_connection, new_game_txid)["txid"]
|
||||||
while True:
|
while True:
|
||||||
mempool = rpc_connection.getrawmempool()
|
mempool = rpc_connection.getrawmempool()
|
||||||
if newgame_regisration_txid in mempool:
|
if newgame_regisration_txid in mempool:
|
||||||
@@ -1143,7 +1151,7 @@ def rogue_newgame_singleplayer(rpc_connection, is_game_a_rogue=True):
|
|||||||
print("Let's wait a little bit more")
|
print("Let's wait a little bit more")
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
pass
|
pass
|
||||||
if confirmations_amount < 2:
|
if confirmations_amount < 1:
|
||||||
print("Last keystroke not confirmed yet! Let's wait a little")
|
print("Last keystroke not confirmed yet! Let's wait a little")
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
else:
|
else:
|
||||||
@@ -1163,6 +1171,7 @@ def rogue_newgame_singleplayer(rpc_connection, is_game_a_rogue=True):
|
|||||||
is_bailout_needed = input("Do you want to make bailout now [y] or wait for one more block [n]? [y/n]: ")
|
is_bailout_needed = input("Do you want to make bailout now [y] or wait for one more block [n]? [y/n]: ")
|
||||||
if is_bailout_needed == "y":
|
if is_bailout_needed == "y":
|
||||||
bailout_info = rogue_bailout(rpc_connection, new_game_txid)
|
bailout_info = rogue_bailout(rpc_connection, new_game_txid)
|
||||||
|
if is_game_a_rogue:
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
confirmations_amount = rpc_connection.getrawtransaction(bailout_info["txid"], 1)["confirmations"]
|
confirmations_amount = rpc_connection.getrawtransaction(bailout_info["txid"], 1)["confirmations"]
|
||||||
|
|||||||
Reference in New Issue
Block a user