Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.thoo.bot.cosmetics;
- import com.thoo.bot.enums.ECosmetic;
- import com.thoo.bot.enums.ERarity;
- public class Skin<T> {
- private String name;
- private String CID;
- private ERarity rarity;
- private ECosmetic cosmetic;
- private String[] exports;
- private String[] sources;
- private T image;
- public Skin(String name, String CID, ERarity rarity, ECosmetic cosmetic, String[] exports, String[] sources, T image){
- this.name = name;
- this.CID = CID;
- this.rarity = rarity;
- this.cosmetic = cosmetic;
- this.exports = exports;
- this.sources = sources;
- this.image = image;
- }
- public String[] getExports() {
- return exports;
- }
- public ECosmetic getCosmetic() {
- return cosmetic;
- }
- public ERarity getRarity() {
- return rarity;
- }
- public String getName() {
- return name;
- }
- public T getImage() {
- return image;
- }
- public String[] getSources() {
- return sources;
- }
- }
- package com.thoo.bot.discord.listeners;
- import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
- import net.dv8tion.jda.core.hooks.ListenerAdapter;
- public class SkinListener extends ListenerAdapter {
- public void onGuildMessageReceived(GuildMessageReceivedEvent e){
- String[] args = e.getMessage().getContentDisplay().split(" ");
- if(e.getAuthor().isBot()) return;
- if(args[0].equalsIgnoreCase("!skin")){
- e.getChannel().sendMessage("Test").queue();
- }
- }
- }
- package com.thoo.bot.discord;
- import com.thoo.bot.discord.listeners.SkinListener;
- import net.dv8tion.jda.core.AccountType;
- import net.dv8tion.jda.core.JDA;
- import net.dv8tion.jda.core.JDABuilder;
- public class DiscordListener {
- private static JDA jda;
- public static void start(){
- try {
- jda = new JDABuilder(AccountType.BOT).setToken("").buildBlocking();
- addListener(new SkinListener());
- } catch(Exception e){
- System.err.println("Error while connecting to Discord bot: " + e.getMessage());
- }
- }
- private static void addListener(Object listener){
- jda.addEventListener(listener);
- }
- }
- package com.thoo.bot.enums;
- public enum ECosmetic {
- OUTFIT,
- BACKPACK,
- GLIDER,
- WRAP,
- SPRAY,
- DANCE,
- EMOTE,
- PICKAXE,
- CONTRAIL,
- MUSIC,
- BANNER,
- LOADINGSCREEN;
- }
- package com.thoo.bot.enums;
- public enum EEncryptionKey {
- V9_20("0xE47F0FE3C66BC50D65A92F93609710FEB580BD982017A7D3FC6DE7872197E0CA");
- private String AES;
- EEncryptionKey(String AES){
- this.AES = AES;
- }
- public String getAES() {
- return AES;
- }
- }
- package com.thoo.bot.enums;
- public enum EPaks {
- S10_S1("C:\\Program Files\\Epic Games\\Fortnite\\FortniteGame\\Content\\Paks\\pakchunk10_s1-WindowsClient");
- private String path;
- EPaks(String path){
- this.path = path;
- }
- public String getPath() {
- return path;
- }
- }
- package com.thoo.bot.enums;
- public enum ERarity {
- COMMON,
- UNCOMMON,
- RARE,
- EPIC,
- MARVEL,
- LEGENDARY;
- }
- package com.thoo.bot.parser;
- import UE4.GameFile;
- import UE4.PakFileReader;
- import UE4_Packages.Package;
- import UE4_Packages.ReadException;
- import com.thoo.bot.enums.EEncryptionKey;
- import com.thoo.bot.enums.EPaks;
- import org.json.JSONObject;
- import java.io.File;
- import java.io.IOException;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Objects;
- public class Skins {
- private PakFileReader reader;
- private List<GameFile> gameFiles;
- public Skins(){
- try {
- reader = new PakFileReader(EPaks.S10_S1.getPath());
- } catch (Exception e){
- System.err.println("Error while initializing PakFileReader: " + e.getMessage());
- }
- try {
- if(Objects.requireNonNull(reader).isEncrypted() && reader.testKey(EEncryptionKey.V9_20.getAES())){
- reader.setKey(EEncryptionKey.V9_20.getAES());
- gameFiles = reader.readIndex();
- }
- } catch (Exception e) {
- System.err.println("Error while reading index of pak file S10_S1: " + e.getMessage());
- }
- }
- public List<JSONObject> getSkinsData() {
- List<JSONObject> objects = new ArrayList<>();
- int c = 0;
- for(GameFile file : gameFiles){
- if(file.getName().toLowerCase().contains("cid_")){
- try {
- String skinPath = "";
- String uasset = reader.extractSelected(file);
- String uexp = null;
- String ubulk = null;
- if(file.hasUexp()) uexp = reader.extractSelected(file.getUexp());
- if(file.hasUbulk()) ubulk = reader.extractSelected(file.getUbulk());
- Package cPackage = Package.fromFiles(
- new File(skinPath + file.getNameWithoutExtension() + ".uasset"),
- new File(skinPath + file.getNameWithoutExtension() + ".uexp"),
- new File(skinPath + file.getNameWithoutExtension() + ".ubulk"));
- objects.add(new JSONObject(cPackage.toJSON()));
- c++;
- } catch (ReadException | IOException e) {
- e.printStackTrace();
- }
- }
- }
- return objects;
- }
- }
- package com.thoo.bot;
- import com.thoo.bot.discord.DiscordListener;
- public class Main {
- public static void main(String[] args){
- DiscordListener.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement