create account

[개발] 스팀몬스트 퀘스트 관련 API들 by tradingideas

View this thread on: hive.blogpeakd.comecency.com
· @tradingideas · (edited)
$11.40
[개발] 스팀몬스트 퀘스트 관련 API들
스몬 게임을 자동으로 하시는 분들이 늘고 있습니다. 저도 얼마전에 자동 퀘스트 관련하여 완성을 했는데요. 이와 관련된 API들을 정리해봅니다.

#### 1. 사용자의 현재 quest 상태 알아오기 
https://steemmonsters.com/players/quests?username=myid

![](https://cdn.steemitimages.com/DQmY6njm8B8ecoQaWLJJx81jFMgsShYqTcNawC8oj6JwZZD/image.png)

중요 데이터의 의미
- total_items : quest로 이긴 게임 수
- completed_items : quest 완료를 위하여 필요한 승 수 (No neutral의 경우에는 3)
- claim_trx_id : quest 완료 후 클레임하여 받은 카드에 대한 정보
- claim_date : quest 완료 후 claim을 한 날짜

#### quest의 종류
현재 quest의 종류는 아래와 같이 7가지입니다.
~~~
QUEST_NAME = {'Rising Dead' : 'Black',
              'Pirate Attacks' : 'Blue',
              "Stir the Volcano" : 'Red',
              "Lyanna's Call" : 'Green',
              'Defend the Borders' : 'White',
              'Stubborn Mercenaries' : 'No Neutral',
              'Proving Grounds' : 'Tournament',
              'Gloridax Revenge' : 'Dragon',
}
~~~

### 2. 다음 quest 요청하기
#
23시간이 지나면 새로운 quest를 요청할 수 있습니다. 따라서 이전 quest의 'created_date'와 현재 시각과의 차이가 23이 넘으면 새로운 quest를 요청하면 됩니다. 우선 quest 요청을 보내는 custom_json 함수를 만듭니다.

~~~
def do_quest_custom_json(acc, id, type, txid=0) :
    pwd = players_posting_key[acc]
    my_steem = Steem(keys=pwd)
    my_acc = Account(acc, steem_instance=my_steem)
    # 새로운 quest 요청
    if id == "sm_claim_reward" :
        json_data = {"type": type, "quest_id":txid, "app": 'steemmonsters/0.7.0'}
    else :
        json_data = {"type": type, "app": 'steemmonsters/0.7.0'}

    ret = my_steem.custom_json(id, json_data, required_posting_auths=[acc])

~~~

앞으로는 이 함수를 이용하면 됩니다. 새로운 quest는 아래와 같은 값으로 콜을 하면 됩니다.

do_quest_custom_json(account_name, "sm_start_quest", "daily")

새롭게 받은 quest가 마음에 안들면 최초 한번은 바꿀 수 있습니다. 이때는 아래와 같이 콜을 하면 됩니다.

do_quest_custom_json(account_name, 'sm_refresh_quest', "daily")

### 3. quest 결과 claim하기

quest가 끝났는지는 앞에서 설명한대로 아래 두 변수를 확인하면 됩니다.

- total_items : quest로 이긴 게임 수
- completed_items : quest 완료를 위하여 필요한 승 수 (No neutral의 경우에는 3)

total_items가 completed_items 보다 크면 아래 함수를 콜하면 됩니다.

do_quest_custom_json(account_name, "sm_claim_reward", "quest", quest_info['id'])

claim을 한 후 스몬 공홈으로 접속을 해 보면 클레임한 카드를 열어보라고 나옵니다. 하지만 peakmon에서 확인을 해보면 이미 클레임한 카드의 종류가 나옵니다. 즉 공홈에서 열어보는 행위와 상관없이 카드는 결정이 되어 본인의 계정에 들어와 있습니다.

일단은 여기까지. 
좀 더 하자면 claim으로 받은 카드를 시장에 파는 것까지 개발하면 그야말로 완전 자동으로 동작하는 일퀘머쉰이 될 것 같습니다.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 116 others
👎  
properties (23)
authortradingideas
permlink2gpfyj-api
categorysct
json_metadata{"tags":["sct","sct-kr","sct-freeboard","s","union","mini","spt","zzan","dblog","marlians"],"image":["https://cdn.steemitimages.com/DQmY6njm8B8ecoQaWLJJx81jFMgsShYqTcNawC8oj6JwZZD/image.png"],"links":["https://steemmonsters.com/players/quests?username=myid"],"app":"steemcoinpan/0.1","format":"markdown","canonical_url":"https://www.steemcoinpan.com/@tradingideas/2gpfyj-api"}
created2020-01-17 08:31:00
last_update2020-01-17 08:49:57
depth0
children1
last_payout2020-01-24 08:31:00
cashout_time1969-12-31 23:59:59
total_payout_value6.011 HBD
curator_payout_value5.390 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,264
author_reputation473,979,989,726,345
root_title"[개발] 스팀몬스트 퀘스트 관련 API들"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,475,906
net_rshares41,840,620,125,075
author_curate_reward""
vote details (181)
@steemitboard ·
Congratulations @tradingideas! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

<table><tr><td><img src="https://steemitimages.com/60x70/http://steemitboard.com/@tradingideas/payout.png?202001171545"></td><td>You received more than 20000 as payout for your posts. Your next target is to reach a total payout of 30000</td></tr>
</table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@tradingideas) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=tradingideas)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>


To support your work, I also upvoted your post!


###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-tradingideas-20200117t165147000z
categorysct
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2020-01-17 16:51:45
last_update2020-01-17 16:51:45
depth1
children0
last_payout2020-01-24 16:51:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length939
author_reputation38,975,615,169,260
root_title"[개발] 스팀몬스트 퀘스트 관련 API들"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,486,263
net_rshares0