forked from 0rtis/dfktools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:0rtis/dfk
merge 1eea69d with local changes
- Loading branch information
Showing
7 changed files
with
451 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
type = { | ||
'solo': 1, | ||
'squad': 3, | ||
'war': 9 | ||
} | ||
|
||
background = { | ||
'desert': 0, | ||
'forest': 2, | ||
'plains': 4, | ||
'island': 6, | ||
'swamp': 8, | ||
'mountains': 10, | ||
'city': 12, | ||
'arctic': 14 | ||
} | ||
|
||
stat = { | ||
'strength': 0, | ||
'agility': 2, | ||
'intelligence': 4, | ||
'wisdom': 6, | ||
'luck': 8, | ||
'vitality': 10, | ||
'endurance': 12, | ||
'dexterity': 14 | ||
} | ||
|
||
|
||
def string2id(attr, label): | ||
if attr == "type": | ||
return type.get(label, None) | ||
elif attr == 'background': | ||
return background.get(label, None) | ||
elif attr == 'stat': | ||
return stat.get(label, None) | ||
|
||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import logging | ||
import json | ||
import sys | ||
import duel.duel as duels | ||
from web3 import Web3 | ||
|
||
if __name__ == "__main__": | ||
log_format = '%(asctime)s|%(name)s|%(levelname)s: %(message)s' | ||
|
||
logger = logging.getLogger("DFK-duel") | ||
logger.setLevel(logging.DEBUG) | ||
logging.basicConfig(level=logging.INFO, format=log_format, stream=sys.stdout) | ||
|
||
rpc_server = 'https://api.harmony.one' | ||
logger.info("Using RPC server " + rpc_server) | ||
|
||
result = duels.get_duel(1,rpc_server) | ||
logger.info(json.dumps(result, indent=4, sort_keys=False)) | ||
|
||
|
||
private_key = "" # set private key | ||
account_address = "0x" # set account address | ||
gas_price_gwei = 35 | ||
tx_timeout_seconds = 30 | ||
w3 = Web3(Web3.HTTPProvider(rpc_server)) | ||
|
||
|
||
# start ranked duel | ||
''' | ||
Ranked match jewel fees | ||
Solo: 0.1, 0.5, 1 | ||
Squad: 0.3, 1.5, 3 | ||
War: 1, 5, 10 | ||
''' | ||
duels.enter_duel_lobby('solo', [241730], 0.1, 'forest', 'dexterity', | ||
private_key, w3.eth.getTransactionCount(account_address), | ||
gas_price_gwei, tx_timeout_seconds, rpc_server, logger) | ||
|
||
# start private duel | ||
duels.start_private_duel('solo', [241730], '0x', 'forest', 'dexterity', | ||
private_key, w3.eth.getTransactionCount(account_address), | ||
gas_price_gwei, tx_timeout_seconds, rpc_server, logger) | ||
|
||
# complete duel | ||
duels.complete_duel(40331, | ||
private_key, w3.eth.getTransactionCount(account_address), | ||
gas_price_gwei, tx_timeout_seconds, rpc_server, logger) | ||
|
||
# result = duels.getDuelTurns(1,rpc_server) # get duels details based on Duel ID | ||
# result = duels.get_total_open_duel_entries(3, rpc_server) # 1-Solo,3-Squad,9-War |
File renamed without changes.