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

avatar
(Edited)

스몬 게임을 자동으로 하시는 분들이 늘고 있습니다. 저도 얼마전에 자동 퀘스트 관련하여 완성을 했는데요. 이와 관련된 API들을 정리해봅니다.

1. 사용자의 현재 quest 상태 알아오기

https://steemmonsters.com/players/quests?username=myid

중요 데이터의 의미

  • 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으로 받은 카드를 시장에 파는 것까지 개발하면 그야말로 완전 자동으로 동작하는 일퀘머쉰이 될 것 같습니다.



0
0
0.000
1 comments
avatar

Congratulations @tradingideas! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You received more than 20000 as payout for your posts. Your next target is to reach a total payout of 30000

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Vote for @Steemitboard as a witness to get one more award and increased upvotes!
0
0
0.000