前言
这篇文章耗时1小时写成,我算写得很认真了,求各位读者点一个赞,谢谢!
对于 OIers 来说,超苦逼冒险者 这个游戏应该是再熟悉不过了。无论是上课摸鱼,还是平时消遣,这都是一款非常不错的文字游戏。
但是,有些读者朋友可能会觉得:这个游戏太肝了!!!太难了!!!资源太难获取了!!!
没关系!这篇文章中我将用我目前的一些知识来告诉大家如何使用一个 python 修改程序来给自己用不尽的资源!
大致讲解
在超苦逼冒险者中,每次点击保存按钮时,都相当于是给"https://kubitionadvanture.sinaapp.com/save.php"这个地址发送了一个保存的 request,随后游戏会根据信息,将当前游戏进度保存在账号中。
而我们的 python 脚本干的事情,就是向 save.php 发送伪造的保存请求,借此来成功将自定义的进度存入游戏账号。
实现细节
那么,废话不多说,咱直接来讲讲这个脚本该如何在电脑上跑。
请注意,我的电脑是 M a c ,所以只能讲解在 M a c 下如何操作,对于 W i n d o w s 用户,实在抱歉,您只能在看懂这篇文章后,想办法在 W i n d o w s 下进行类似操作 \color{orange}{请注意,我的电脑是 Mac,所以只能讲解在 Mac 下如何操作,对于 Windows 用户,实在抱歉,您只能在看懂这篇文章后,想办法在 Windows 下进行类似操作} 请注意,我的电脑是Mac,所以只能讲解在Mac下如何操作,对于Windows用户,实在抱歉,您只能在看懂这篇文章后,想办法在Windows下进行类似操作
1.python 的安装
请先确认自己的电脑是否已经安装过 python 了,这对节约你的时间很有利!
请在 终端(Terminal) 中输入
python --version
或
python3 --version
来确认是否已安装过 python。
如果终端回应你:
Python [版本号]
就说明你已经装过 python 了,请跳过这一步,直接去看2。
对于终端回应为:
zsh: command not found: python
的读者,你就需要安装 python 了。
在这篇文章中,我建议使用brew来安装 python,如果你没装过 brew 的话,请去brew官网,跟着上面的指示来安装 brew。
那么,有了 brew 之后,请在终端输入:
brew install python
来安装 python,一般性静静等待一小会儿后 python 就装好了!恭喜你!ヽ(°▽°)ノ
2.requests库的安装
我们安装requests库,是因为我们要运行的那个 python 脚本,需要 import 这个库,所以要提前装好。
一般性,在安装完 python 后,会自带一个pip,这是一个很棒的用来安装 python 第三方库的工具。
请在终端输入:
pip install requests
或
pip3 install requests
来安装,这是根据你的 pip 的名字来定的。正常情况下,brew在安装时都会去装最新版的,所以基本上你的 pip 的名字应该叫pip3。
然后它又开始努力地装,等一小会儿,这个库也装好了!
3.脚本的新建
接下来,上代码!
import requests
import requests
headers = {
'Connection': 'keep-alive',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache',
'sec-ch-ua': '^\\^Chromium^\\^;v=^\\^94^\\^, ^\\^Microsoft',
'Accept': '*/*',
'Content-Type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest',
'sec-ch-ua-mobile': '?0',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36 Edg/94.0.992.31',
'sec-ch-ua-platform': '^\\^Windows^\\^',
'Origin': 'https://kubitionadvanture.sinaapp.com',
'Sec-Fetch-Site': 'same-origin',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Dest': 'empty',
'Referer': 'https://kubitionadvanture.sinaapp.com/',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
}
# data里的data就是要修改的数据
data = {
'action': 'save',
'account': '你的用户名',
'pass': '你的密码',
'data':'{"boxSaveData":{"bag":{"things":{"axe":10,"water":999,"bread":999,"bark":999,"wood":999},"size":12},"makeTable":{"things":{},"size":1,"isDone":true},"scienceTable":{"things":{},"size":1000,"isDone":true},"alchemyTable":{"things":{},"size":1,"isDone":true},"magicTable":{"things":{},"size":1,"isDone":true},"cooker":{"things":{},"size":2},"cooked":{"things":{},"size":1,"isDone":true},"well":{"things":{"water":10},"size":1,"isDone":true},"bigBox":{"things":{},"size":16},"register":{"things":{},"size":100},"shit":{"things":{},"size":1,"isDone":true},"wellUpdate":{"things":{},"size":100,"isDone":true},"cookerUpdate":{"things":{},"size":100,"isDone":true},"toiletUpdate":{"things":{},"size":100,"isDone":true},"bigBoxUpdate":{"things":{},"size":100,"isDone":true},"sleepPlaceUpdate":{"things":{},"size":100,"isDone":true},"marshGasTank":{"things":{},"size":4}},"buildingSaveData":{"build":{"own":true},"sleepPlace":{"own":false},"bigBox":{"own":false},"makeTable":{"own":false},"alchemyTable":{"own":false},"magicTable":{"own":false},"scienceTable":{"own":false},"trap":{"list":[],"size":2,"hint":false,"own":false},"farm":{"list":[],"size":2,"hint":false,"own":false},"alco":{"list":[],"size":2,"hint":false,"own":false},"cooker":{"own":false},"well":{"own":false},"toilet":{"own":false}},"coolDownSaveData":{"shit":0,"shower":0},"currentBox":"","currentEquip":{"body":null,"hand":null,"foot":null,"head":null},"currentScene":"home","defaultWeapon":[],"dungeonSaveData":{"stairCount":1,"roomCount":1,"deepest":1,"stairData":{}},"durableSaveData":{"nightmare":0,"vanity":0,"chaos":0,"testWeapon":0,"breakSword":0,"curseSword":0,"trident":0,"evilSpear":0,"evilSword":0,"magicSword":0,"fireBumb":0,"iceBumb":0,"flyKnife":0,"knife":0,"stick":0,"hoe":0,"shovel":0,"axe":1,"pickaxe":0,"poizondKnife":0,"soulKnife":0,"shortSword":0,"longSword":0,"uangKnife":0,"dragonSword":0,"milHammer":0,"boneBar":0,"spear":0,"foolHammer":0,"teethAxe":0,"lightHammer":0,"darkGoldAxe":0,"fearKnife":0,"blockAxe":0,"blessingHammer":0,"slingshot":0,"boneSlingshot":0,"handGun":0,"gun":0,"sniper":0,"goodSniper":0,"shotGun":0,"magicGun":0,"iceGun":0,"jtlGun":0,"bow":0,"hornBow":0,"poizondBow":0,"poizondHornBow":0,"frozenBow":0,"dragonBow":0,"rainbowBow":0,"bass":0,"bumb":0,"poizonBumb":0,"staff":0,"fireStaff":0,"iceStaff":0,"poizonStaff":0,"deadStaff":0,"knifeStaff":0,"curseStaff":0,"ancientStaff":0,"fearlessAxe":0,"ghostStaff":0,"frostStaff":0,"fireSword":0,"darkGun":0,"lightBow":0,"curlLance":0,"starStaff":0,"skStaff":0,"skSowrd":0,"curseKnife":0,"windKnife":0},"robberSaveData":{"lastDate":50,"stoled":{},"stoledAll":{},"robber":false},"eventSaveData":{"tramp":{"foodGot":0,"experienced":false},"townEvent":{"level":0},"traces_1":{"experienced":false},"part_1":{"experienced":false},"traces_2":{"experienced":false},"part_2":{"experienced":false},"traces_3":{"experienced":false},"denBox":{"experienced":false},"police_1":{"experienced":false},"reincarnation":{"experienced":false},"boss":{"experienced":false},"santa":{"experienced":false},"map_1":{"experienced":false},"map_2":{"experienced":false},"map_3":{"experienced":false},"map_4":{"experienced":false},"thief":{"experienced":false},"thief_1":{"experienced":false},"thief_2":{"experienced":false},"trade":{"experienced":false},"miner":{"experienced":false},"minerFood":{"experienced":false},"giveScroll":{"experienced":false},"huntIntro":{"experienced":false},"farmer_1":{"experienced":false},"farmer_2":{"experienced":false},"farmer_3":{"experienced":false},"farmer_end":{"experienced":false},"robberQuestGet":{"experienced":false},"robberQuest":{"experienced":false},"spiderQuestGet":{"experienced":false},"spiderQuest":{"experienced":false},"dragonQuestGet":{"experienced":false},"dragonQuest":{"experienced":false},"robbotQuest":{"experienced":false},"gulf":{"experienced":false},"drinker_1":{"experienced":false},"drinker_2":{"experienced":false},"drinker_3":{"experienced":false},"drinker_4":{"experienced":false},"drinker_end":{"experienced":false},"misteryQuest_1":{"experienced":false},"misteryQuest_2":{"experienced":false},"misteryQuest_3":{"experienced":false},"goblin":{"experienced":false},"goblin_1":{"experienced":false},"goblin_2":{"experienced":false},"goblin_3":{"experienced":false},"goblin_4":{"experienced":false},"goblin_5":{"experienced":false},"goblin_end":{"experienced":false},"graveEvent":{"experienced":false},"iceTownEvent":{"experienced":false},"fireTownEvent":{"experienced":false},"iceTownEvent_1":{"experienced":false},"iceTownEvent_2":{"experienced":false},"iceTownEvent_3":{"experienced":false},"iceTownEvent_end":{"experienced":false},"fireTownEvent_1":{"experienced":false},"fireTownEvent_2":{"experienced":false},"fireTownEvent_3":{"experienced":false},"fireTownEvent_end":{"experienced":false},"meleeUpgrade":{"experienced":false},"shootUpgrade":{"experienced":false},"magicUpgrade":{"experienced":false},"agileUpgrade":{"experienced":false},"defUpgrade":{"experienced":false},"farmUpgrade":{"experienced":false},"alcoUpgrade":{"experienced":false}},"isDueling":false,"menuDesc":{},"menuHint":0,"misk":0,"msgList":[],"mstState":{},"placeSaveData":{"town":{"visited":false,"mst":{},"things":{"wood":20,"seed":40,"part":20},"resource":{"tree":{"amount":15,"count":0},"part":{"amount":10,"count":0},"gold":{"amount":100,"count":0},"gem":{"amount":50,"count":0}}},"upgradePlace":{"visited":false},"forest":{"visited":true,"mst":{"scaryFlower":{"amount":15,"count":0},"butterFly":{"amount":12,"count":0}},"things":{"wood":20,"fruit":20,"flower":20,"seed":30,"bark":10},"resource":{"tree":{"amount":29,"count":0},"fruitCluster":{"amount":10,"count":0},"herbCluster":{"amount":10,"count":0}}},"river":{"visited":false,"mst":{"crow":{"amount":15,"count":0}},"things":{"water":20,"fruit":20,"poizonRoot":10,"flower":8,"seed":8},"resource":{"tree":{"amount":15,"count":0},"brook":{"amount":40,"count":0},"flowerCluster":{"amount":10,"count":0}}},"robberPlace":{"visited":false,"mst":{"robber":{"amount":25,"count":0},"robberHead":{"amount":1,"count":0}},"things":{"gold":5,"meat":8},"resource":{"brook":{"amount":5,"count":0},"traces":{"amount":5,"count":0}}},"den":{"visited":false,"mst":{"robber_1":{"amount":100,"count":0},"robber_2":{"amount":5,"count":0},"robber_3":{"amount":1,"count":0}}},"mine":{"visited":false,"mst":{},"things":{"wood":25,"iron":25,"saltpeter":15},"resource":{"ironMine":{"amount":20,"count":0},"saltpeterMine":{"amount":20,"count":0},"gold":{"amount":20,"count":0},"gem":{"amount":4,"count":0}}},"mountain":{"visited":false,"mst":{"rabbit":{"amount":12,"count":0},"eagle":{"amount":8,"count":0},"bull":{"amount":4,"count":0}},"things":{"hay":50},"resource":{"ice":{"amount":12,"count":0},"rabbitHole":{"amount":20,"count":0},"hayCrop":{"amount":20,"count":0}}},"spiderPlace":{"visited":false,"mst":{"spider":{"amount":2,"count":0},"bigSpider":{"amount":1,"count":0}},"things":{"spiderEgg":20,"teeth":20,"humanMeat":2,"bone":12,"meat":8},"resource":{"brook":{"amount":20,"count":0}}},"blackForest":{"visited":false,"mst":{"bear":{"amount":8,"count":0},"vulture":{"amount":8,"count":0}},"things":{"part":20,"iron":20,"saltpeter":20,"bone":20,"clawRoot":10},"resource":{"oldTree":{"amount":20,"count":0},"rootCrop":{"amount":10,"count":0},"fire":{"amount":10,"count":0}}},"iceberg":{"visited":false,"mst":{"penguin":{"amount":15,"count":0},"polarBear":{"amount":3,"count":0}},"things":{"water":10,"iceHeart":2},"resource":{"tree":{"amount":10,"count":0},"ice":{"amount":10,"count":0}}},"swamp":{"visited":false,"mst":{"creeper":{"amount":10,"count":0}},"things":{"carrot":10,"veg":10,"fruit":10,"seed":20},"resource":{"shit":{"amount":20,"count":0}}},"goblinTown":{"visited":false,"things":{"part":40,"wood":20,"iron":20,"gold":5,"ironStatue":4,"woodStatue":4,"beer":5},"resource":{"shit":{"amount":20,"count":0},"woodStatue":{"amount":35,"count":0},"ironStatue":{"amount":35,"count":0}}},"grave":{"visited":false,"mst":{"wolf":{"amount":10,"count":0}},"things":{"part":20,"wood":20,"teeth":5,"bone":20,"gold":20,"ironStatue":8,"woodStatue":8},"resource":{"tombstone":{"amount":20,"count":0}}},"ice":{"visited":false,"mst":{"ice":{"amount":100,"count":0},"iceNinja":{"amount":5,"count":0},"iceMaster":{"amount":1,"count":0}},"things":{"humanCook":5,"meat":10,"humanMeat":10,"hamburger":5},"resource":{"meat":{"amount":10,"count":0}}},"fire":{"visited":false,"mst":{"fire":{"amount":100,"count":0},"fireSage":{"amount":5,"count":0},"fireMaster":{"amount":1,"count":0}},"things":{"bread":18,"sandwich":5,"paper":5,"beer":5},"resource":{"crystal":{"amount":10,"count":0}}},"ruins":{"visited":false,"mst":{"machine":{"amount":3,"count":0},"idolum":{"amount":4,"count":0}},"things":{"iron":20,"part":20,"wood":10,"bone":5,"seed":10},"resource":{"ruins":{"amount":20,"count":0},"fountain":{"amount":20,"count":0}}},"dragon":{"visited":false,"mst":{"dragon":{"amount":20,"count":0},"lightDragon":{"amount":5,"count":0},"darkDragon":{"amount":5,"count":0},"dragonKing":{"amount":1,"count":0}},"things":{"hay":20,"dragonBone":20,"humanMeat":2,"bone":5},"resource":{}},"gulf":{"visited":false,"mst":{"pirate":{"amount":10,"count":0},"siren":{"amount":10,"count":0},"seaSnake":{"amount":10,"count":0}},"things":{"gold":20,"gem":4,"bone":20,"beer":10,"fruitAlco":5},"resource":{"fish":{"amount":10,"count":0},"jellyfish":{"amount":10,"count":0}}},"dunguen":{"visited":false,"things":{"bone":20},"resource":{}}},"playerState":{"temp":{"amount":-6},"hp":{"amount":100},"full":{"amount":99},"moist":{"amount":97},"ps":{"amount":95},"san":{"amount":100}},"progress":0,"startSeason":"spring","season":"spring","showMenu":"menu","skill":{},"time":{"day":1,"hour":9},"tradeSaveData":[{"trade":"wood","time":197},{"trade":"iron","time":197},{"trade":"part","time":197}],"maouLevel":0,"campSaveData":{"choice":null,"picked":false},"generation":0}',
'day': 1,
'g':0
}
response = requests.post('https://kubitionadvanture.sinaapp.com/save.php', headers=headers, data=data)
print(response.text)
声明:这个代码不是我写的,而是出自 \color{orange}{声明:这个代码不是我写的,而是出自} 声明:这个代码不是我写的,而是出自 这里 ,是我在翻超苦逼冒险者的创作者 m a o u 的小站时在底下的评论区里发现的。 \color{orange}{,是我在翻超苦逼冒险者的创作者 maou 的小站时在底下的评论区里发现的。} ,是我在翻超苦逼冒险者的创作者maou的小站时在底下的评论区里发现的。
你可以打开 Mac 自带的文本编辑软件,把这段代码贴进去,然后保存。
为了能成功存成.py文件,请按以下步骤进行:
- 电脑需要设置显示文件扩展名
- 保存时将文件名从
未命名.txt
改成[名字].py
,例如存档修改器.py
- 将下方如果没有提供扩展名,则使用".txt"。 的这个选项取消勾选,变成像上面那张图中的那样,否则文本编辑会因为.py不是它认识的扩展名而自动添加.txt的后缀
- 点击存储按钮即可!
在你保存的路径下只要看到有一个文件出现就对了!
4.脚本的运行
右键这个.py文件,在打开方式中选择IDLE.app,这个 IDLE.app 在你用 brew 安装完 python 后应该就自带了。
出现一个这样的窗口就对了:
请将代码中data下的account和pass分别改成你的游戏存档的用户名和密码。
然后在boxSaveData那一行的那个字符串中可以自定义,建议去仔细研究一下游戏中事件和物品名称的英文叫法,方便修改。(你可以研究一下我上传的超苦逼冒险者离线版中的源代码那块儿,会点英语的话基本上很好懂的!)
在改完代码之后记得保存。
最后,你只需按下 F5 或者在左上角选择 Run --> Run Module,即可运行脚本,去登录你的游戏账户一看,就会发现有资源了!
建议在运行代码之前先备份一下账号,不然如果一有闪失,你的存档可能就白玩了!
5.最终效果
你的物品栏会变成类似这样:
这样你的存档就改好了!
我分享一个我修改好的存档:
用户名:
C
o
o
k
i
e
123456
\color{blue}{用户名:Cookie123456}
用户名:Cookie123456
密码:
123456
\color{blue}{密码:123456}
密码:123456
当然,这有可能会被调皮的玩家覆盖掉,如果发现被覆盖了,请在评论或私信我来告诉我,我来重新给一下这个存档。
小结
这告诉我们:会一些程序在关键时候非常有用!哈哈哈!