linbin 2024-02-28 02:04:40 +08:00
commit 7894786ffb
11 changed files with 388 additions and 0 deletions

10
.gitignore vendored 100644
View File

@ -0,0 +1,10 @@
#过滤target文件下生成的编译文件
target/
.project
.settings/
.metadata/
.classpath
*.MF
.idea
*.iml

49
pom.xml 100644
View File

@ -0,0 +1,49 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>yuanqi</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>yuanqi</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.12.0</version>
</dependency>
<dependency>
<groupId>com.jfirer</groupId>
<artifactId>JfireBoot</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>21</source>
<target>21</target>
<compilerArgs>--enable-preview</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,38 @@
package org.example;
import java.util.HashMap;
import java.util.Map;
public class AdressMap
{
public static Map<String, String> map = new HashMap<>();
static
{
/*
{TuplesKt.to(9, "南部草原"), TuplesKt.to(10, "芦苇湿地"), TuplesKt.to(11, "迷雾森林"), TuplesKt.to(12, "潮湿溶洞"), TuplesKt.to(13, "水晶洞窟"), TuplesKt.to(14, "寂静山谷"), TuplesKt.to(15, "干燥荒漠"), TuplesKt.to(16, "废弃城堡"), TuplesKt.to(17, "巨石山地"), TuplesKt.to(18, "宁静森林"), TuplesKt.to(19, "热浪海岛"), TuplesKt.to(20, "炽热火山"), TuplesKt.to(21, "严寒雪山"), TuplesKt.to(22, "古代遗迹"), TuplesKt.to(23, "机械大陆"), TuplesKt.to(24, "最终之塔"), TuplesKt.to(8, "魔法石神殿"), TuplesKt.to(34, "虎豹山寨"), TuplesKt.to(35, "石雕圆林"), TuplesKt.to(36, "五彩枫林"), TuplesKt.to(37, "长城遗迹"), TuplesKt.to(38, "神秘山脉")};
*/
map.put("9", "南部草原");
map.put("10", "芦苇湿地");
map.put("11", "迷雾森林");
map.put("12", "潮湿溶洞");
map.put("13", "水晶洞窟");
map.put("14", "寂静山谷");
map.put("15", "干燥荒漠");
map.put("16", "废弃城堡");
map.put("17", "巨石山地");
map.put("18", "宁静森林");
map.put("19", "热浪海岛");
map.put("20", "炽热火山");
map.put("21", "严寒雪山");
map.put("22", "古代遗迹");
map.put("23", "机械大陆");
map.put("24", "最终之塔");
map.put("8", "魔法石神殿");
map.put("34", "虎豹山寨");
map.put("35", "石雕圆林");
map.put("36", "五彩枫林");
map.put("37", "长城遗迹");
map.put("38", "神秘山脉");
}
}

View File

@ -0,0 +1,147 @@
package org.example;
import com.jfirer.dson.Dson;
import okhttp3.*;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import static java.lang.StringTemplate.STR;
/**
* Hello world!
*/
public class App
{
OkHttpClient client = new OkHttpClient().newBuilder().build();
public String login() throws IOException
{
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"loginType\": \"phone\",\n \"account\": \"17750208698\",\n \"password\": \"1234asdf\"\n}");
Request request = new Request.Builder().url("https://api.soulknight-prequel.chillyroom.com/UserAuth/Login").method("POST", body).addHeader("x-distro-id", "2e9a2011-2a42-46e1-b648-42a8c598b43b").addHeader("x-unique-id", "b0cf8709c2fe262c").addHeader("x-game-version", "1.0.4").addHeader("x-game-id", "5").addHeader("x-game-lang", "Chinese").addHeader("x-delivery-platform", "origin_taptap").addHeader("Host", "api.soulknight-prequel.chillyroom.com").addHeader("Cookie", "aliyungf_tc=cda0eae1ad50e83b749872ae0bd2d54ef73baa05df0a8ed5b72d7a57f9869364; aliyungf_tc=ea178e71aaebd11ae52f47366848a891891e49e319b815107ff9204d66c3ac14").addHeader("User-Agent", "Apifox/1.0.0 (https://apifox.com)").addHeader("Content-Type", "application/json").addHeader("Accept", "*/*").addHeader("Connection", "keep-alive").build();
Response response = client.newCall(request).execute();
String answer = response.body().string();
String token = (String) ((Map<String, Object>) ((Map<String, Object>) Dson.fromString(answer)).get("session")).get("token");
response.close();
return token;
}
public void getCharacter(String token) throws IOException
{
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"dateTimeUtcOffsetOfMinutes\": 480,\n \"firstLaunch\": false\n}");
Request request = new Request.Builder().url("https://api.soulknight-prequel.chillyroom.com/Character/FetchGameData").method("POST", body).addHeader("x-distro-id", "2e9a2011-2a42-46e1-b648-42a8c598b43b").addHeader("x-unique-id", "b0cf8709c2fe262c").addHeader("x-game-version", "1.0.4").addHeader("x-game-id", "5").addHeader("x-game-lang", "Chinese").addHeader("x-delivery-platform", "origin_taptap").addHeader("Host", "api.soulknight-prequel.chillyroom.com").addHeader("Authorization", "Bearer " + token).addHeader("Cookie", "aliyungf_tc=cda0eae1ad50e83b749872ae0bd2d54ef73baa05df0a8ed5b72d7a57f9869364; aliyungf_tc=ea178e71aaebd11ae52f47366848a891891e49e319b815107ff9204d66c3ac14").addHeader("User-Agent", "Apifox/1.0.0 (https://apifox.com)").addHeader("Content-Type", "application/json").addHeader("Accept", "*/*").addHeader("Connection", "keep-alive").build();
Response response = client.newCall(request).execute();
response.close();
}
public void setDiffcult(String token, String characterId) throws IOException
{
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"difficulty\":2}");
Request request = new Request.Builder().url("https://api.soulknight-prequel.chillyroom.com/Difficulty/SetDifficulty").method("POST", body).addHeader("x-distro-id", "2e9a2011-2a42-46e1-b648-42a8c598b43b").addHeader("x-unique-id", "b0cf8709c2fe262c").addHeader("x-game-version", "1.0.4").addHeader("x-game-id", "5").addHeader("x-game-lang", "Chinese").addHeader("x-delivery-platform", "origin_taptap").addHeader("Host", "api.soulknight-prequel.chillyroom.com").addHeader("Authorization", "Bearer " + token).addHeader("x-character-id", characterId).addHeader("Cookie", "aliyungf_tc=cda0eae1ad50e83b749872ae0bd2d54ef73baa05df0a8ed5b72d7a57f9869364; aliyungf_tc=ea178e71aaebd11ae52f47366848a891891e49e319b815107ff9204d66c3ac14").addHeader("Content-Type", "application/json").addHeader("Accept", "*/*").addHeader("Connection", "keep-alive").build();
Response response = client.newCall(request).execute();
response.close();
}
/**
* @param token
* @param characterId
* @param mapId
* @param stageType 24 boss
* @return
* @throws IOException
*/
public Equp enterAddress(String token, String characterId, int mapId, int stageType) throws IOException
{
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"sceneAreaType\":" + mapId + ",\"stageType\":" + stageType + ",\"layer\":5,\"precessDropMarks\":{}}");
Request request = new Request.Builder().url("https://api.soulknight-prequel.chillyroom.com/Scene/SceneEnter").method("POST", body).addHeader("x-distro-id", "2e9a2011-2a42-46e1-b648-42a8c598b43b").addHeader("x-unique-id", "b0cf8709c2fe262c").addHeader("x-game-version", "1.0.4").addHeader("x-game-id", "5").addHeader("x-game-lang", "Chinese").addHeader("x-delivery-platform", "origin_taptap").addHeader("Host", "api.soulknight-prequel.chillyroom.com").addHeader("Authorization", "Bearer " + token).addHeader("x-character-id", characterId).addHeader("Cookie", "aliyungf_tc=cda0eae1ad50e83b749872ae0bd2d54ef73baa05df0a8ed5b72d7a57f9869364; aliyungf_tc=ea178e71aaebd11ae52f47366848a891891e49e319b815107ff9204d66c3ac14").addHeader("Content-Type", "application/json").addHeader("Accept", "*/*").addHeader("Connection", "keep-alive").build();
Response response = client.newCall(request).execute();
String string = response.body().string();
response.close();
return Dson.fromString(Equp.class, string);
}
public String getRevision(String token, String characterId) throws IOException
{
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder().url("https://api.soulknight-prequel.chillyroom.com/Character/Fetch").method("POST", body).addHeader("x-distro-id", "2e9a2011-2a42-46e1-b648-42a8c598b43b").addHeader("x-unique-id", "b0cf8709c2fe262c").addHeader("x-game-version", "1.0.4").addHeader("x-game-id", "5").addHeader("x-game-lang", "Chinese").addHeader("x-delivery-platform", "origin_taptap").addHeader("Host", "api.soulknight-prequel.chillyroom.com").addHeader("Authorization", "Bearer " + token).addHeader("x-character-id", characterId).addHeader("Cookie", "aliyungf_tc=cda0eae1ad50e83b749872ae0bd2d54ef73baa05df0a8ed5b72d7a57f9869364; aliyungf_tc=ea178e71aaebd11ae52f47366848a891891e49e319b815107ff9204d66c3ac14").addHeader("Content-Type", "application/json").addHeader("Accept", "*/*").addHeader("Connection", "keep-alive").build();
Response response = client.newCall(request).execute();
String revision = ((String) ((Map<String, Object>) Dson.fromString(response.body().string())).get("revision"));
response.close();
return revision;
}
public void putItem(String token, String characterId, List<String> itemIds, int revision) throws IOException
{
MediaType mediaType = MediaType.parse("application/json");
PutItemDTO putItemDTO = new PutItemDTO();
putItemDTO.setRevision(revision);
putItemDTO.getGuidsv465().addAll(itemIds);
RequestBody body = RequestBody.create(mediaType, Dson.toJson(putItemDTO));
Request request = new Request.Builder().url("https://api.soulknight-prequel.chillyroom.com/Package/AddV8868").method("POST", body).addHeader("x-distro-id", "2e9a2011-2a42-46e1-b648-42a8c598b43b").addHeader("x-unique-id", "b0cf8709c2fe262c").addHeader("x-game-version", "1.0.4").addHeader("x-game-id", "5").addHeader("x-game-lang", "Chinese").addHeader("x-delivery-platform", "origin_taptap").addHeader("Host", "api.soulknight-prequel.chillyroom.com").addHeader("Authorization", "Bearer " + token).addHeader("x-character-id", characterId).addHeader("Cookie", "aliyungf_tc=cda0eae1ad50e83b749872ae0bd2d54ef73baa05df0a8ed5b72d7a57f9869364; aliyungf_tc=ea178e71aaebd11ae52f47366848a891891e49e319b815107ff9204d66c3ac14").addHeader("User-Agent", "Apifox/1.0.0 (https://apifox.com)").addHeader("Content-Type", "application/json").addHeader("Accept", "*/*").addHeader("Connection", "keep-alive").build();
Response response = client.newCall(request).execute();
response.close();
}
public static void main(String[] args) throws IOException, InterruptedException
{
// String id = "WL_SS_000";
App app = new App();
String token = app.login();
app.getCharacter(token);
String characterId = "be41e5ec-a316-45d2-a164-50e133072338";
int[] stageTypes = {2, 4};
int sumOfTry = 0;
for (String mapId : AdressMap.map.keySet())
{
for (int stageType : stageTypes)
{
int want = 4;
int fetch = 0;
int numOfTry = 0;
while (fetch < want && numOfTry < 200)
{
// Thread.sleep(1000);
app.setDiffcult(token, characterId);
Equp equp = app.enterAddress(token, characterId, Integer.parseInt(mapId), stageType);
List<Item> list = new ArrayList<>();
list.addAll(equp.getEquipmentPools().getHigh());
list.addAll(equp.getEquipmentPools().getLow());
list.addAll(equp.getEquipmentPools().getMedium());
List<Item> result = list.stream().filter(item -> true).toList();
if (!result.isEmpty())
{
List<Item> filter = result.stream().filter(item -> {
String enchantList = item.getDict_nested().getEnchant_list();
String[] split = enchantList.substring(1, enchantList.length() - 1).split(",");
return Arrays.stream(split).filter(str -> str.equals("126") || str.equals("124") || str.equals("125") || str.equals("127")).count() >= 2;
}).toList();
if (!filter.isEmpty())
{
String revision = app.getRevision(token, characterId);
app.putItem(token, characterId, filter.stream().map(item -> item.getItemId()).toList(), Integer.parseInt(revision));
fetch += filter.size();
String ehcList = filter.stream().map(item -> item.getDict_nested().getEnchant_list()).collect(Collectors.joining(","));
System.out.println(STR."在\{AdressMap.map.get(mapId)}第\{sumOfTry}次尝试,成功获取。当前已经获取\{fetch}个。本次获取到的物品信息是:\{ehcList}");
}
else
{
System.out.println(STR."在\{AdressMap.map.get(mapId)}第\{sumOfTry}次尝试,未能成功。当前已经获取\{fetch}个。");
}
}
else
{
System.out.println(STR."在\\{AdressMap.map.get(mapId)}第\{sumOfTry}次尝试,未能成功。当前已经获取\{fetch}个。");
}
numOfTry++;
sumOfTry++;
}
}
}
}
}

View File

@ -0,0 +1,9 @@
package org.example;
import lombok.Data;
@Data
public class DictNested
{
private String enchant_list;
}

View File

@ -0,0 +1,47 @@
package org.example;
import java.util.HashMap;
import java.util.Map;
public class EnhanceMap
{
private static Map<String,String> map = new HashMap<>();
static {
map.put("0", "力量+4");
map.put("4", "敏捷+4");
map.put("5", "敏捷+8");
map.put("8", "智力+4");
map.put("9", "智力+8");
map.put("11", "智力+16");
map.put("16", "技能冷却 10%");
map.put("17", "技能冷却 20%");
map.put("20", "攻击速度 8%");
map.put("22", "攻击速度+24");
map.put("49", "物理伤害+10%");
map.put("51", "物理伤害+40%");
map.put("52", "火焰伤害+10%");
map.put("53", "火焰伤害+20%");
map.put("58", "冰冷伤害+30%");
map.put("60", "电击伤害+10%");
map.put("64", "毒素伤害+10%");
map.put("65", "毒素伤害+20%");
map.put("66", "毒素伤害+30%");
map.put("76", "全体伤害+8%");
map.put("77", "全体伤害+16%");
map.put("84", "暴击率+15%");
map.put("88", "暴击伤害+15%");
map.put("89", "暴击伤害+30%");
map.put("91", "暴击伤害+60%");
map.put("112", "召唤物强度+20%");
map.put("124", "额外物伤 10%");
map.put("125", "额外物伤 20%");
map.put("126", "额外物伤 30%");
map.put("127", "额外物伤 40%");
map.put("140", "额外毒素伤害+10%");
map.put("144", "额外闪光伤害+10%");
map.put("148", "额外黑暗伤害+20%");
map.put("149", "额外黑暗伤害+10%");
}
}

View File

@ -0,0 +1,13 @@
package org.example;
import lombok.Data;
import java.util.List;
@Data
public class EquipmentPools
{
private List<Item> high;
private List<Item> low;
private List<Item> medium;
}

View File

@ -0,0 +1,9 @@
package org.example;
import lombok.Data;
@Data
public class Equp
{
private EquipmentPools equipmentPools;
}

View File

@ -0,0 +1,11 @@
package org.example;
import lombok.Data;
@Data
public class Item
{
private String id;
private String itemId;
private DictNested dict_nested;
}

View File

@ -0,0 +1,17 @@
package org.example;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@Data
public class PutItemDTO
{
private List<String> guidsv465 = new ArrayList<>();
private int revision;
private String[] currenciesv123 = {};
private int secretKey = new Random().nextInt(1001, 5000);
private double secretKey2 =new Random().nextDouble(102.3, 500);
}

View File

@ -0,0 +1,38 @@
package org.example;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}