Search in sources :

Example 1 with Hack

use of net.wurstclient.hack.Hack in project Wurst7 by Wurst-Imperium.

the class FeaturesCmd method call.

@Override
public void call(String[] args) throws CmdException {
    if (args.length != 0)
        throw new CmdSyntaxError();
    if (WurstClient.VERSION.startsWith("7.0pre"))
        ChatUtils.warning("This is just a pre-release! It doesn't (yet) have all of the features of Wurst 7.0! See download page for details.");
    int hax = WURST.getHax().countHax();
    int cmds = WURST.getCmds().countCmds();
    int otfs = WURST.getOtfs().countOtfs();
    int all = hax + cmds + otfs;
    ChatUtils.message("All features: " + all);
    ChatUtils.message("Hacks: " + hax);
    ChatUtils.message("Commands: " + cmds);
    ChatUtils.message("Other features: " + otfs);
    int settings = 0;
    for (Hack hack : WURST.getHax().getAllHax()) settings += hack.getSettings().size();
    for (Command cmd : WURST.getCmds().getAllCmds()) settings += cmd.getSettings().size();
    for (OtherFeature otf : WURST.getOtfs().getAllOtfs()) settings += otf.getSettings().size();
    ChatUtils.message("Settings: " + settings);
}
Also used : CmdSyntaxError(net.wurstclient.command.CmdSyntaxError) Hack(net.wurstclient.hack.Hack) Command(net.wurstclient.command.Command) OtherFeature(net.wurstclient.other_feature.OtherFeature)

Example 2 with Hack

use of net.wurstclient.hack.Hack in project Wurst7 by Wurst-Imperium.

the class NavigatorFeatureScreen method onResize.

@Override
protected void onResize() {
    buttonDatas.clear();
    // primary button
    String primaryAction = feature.getPrimaryAction();
    boolean hasPrimaryAction = !primaryAction.isEmpty();
    // !feature.getHelpPage().isEmpty();
    boolean hasHelp = false;
    if (hasPrimaryAction) {
        primaryButton = new ButtonWidget(width / 2 - 151, height - 65, hasHelp ? 149 : 302, 18, new LiteralText(primaryAction), b -> {
            TooManyHaxHack tooManyHax = WurstClient.INSTANCE.getHax().tooManyHaxHack;
            if (tooManyHax.isEnabled() && tooManyHax.isBlocked(feature)) {
                ChatUtils.error(feature.getName() + " is blocked by TooManyHax.");
                return;
            }
            feature.doPrimaryAction();
            primaryButton.setMessage(new LiteralText(feature.getPrimaryAction()));
            WurstClient.INSTANCE.getNavigator().addPreference(feature.getName());
        });
        addDrawableChild(primaryButton);
    }
    // help button
    // if(hasHelp)
    // method_37063(new ButtonWidget(
    // width / 2 + (hasPrimaryAction ? 2 : -151), height - 65,
    // hasPrimaryAction ? 149 : 302, 20, "Help", b -> {
    // MiscUtils.openLink("https://www.wurstclient.net/wiki/"
    // + feature.getHelpPage() + "/");
    // wurst.navigator.analytics.trackEvent("help", "open",
    // feature.getName());
    // wurst.navigator.addPreference(feature.getName());
    // ConfigFiles.NAVIGATOR.save();
    // }));
    // type
    text = "Type: ";
    if (feature instanceof Hack)
        text += "Hack";
    else if (feature instanceof Command)
        text += "Command";
    else
        text += "Other Feature";
    // category
    if (feature.getCategory() != null)
        text += ", Category: " + feature.getCategory().getName();
    // description
    String description = feature.getWrappedDescription(300);
    if (!description.isEmpty())
        text += "\n\nDescription:\n" + description;
    // area
    Rectangle area = new Rectangle(middleX - 154, 60, 308, height - 103);
    // settings
    Collection<Setting> settings = feature.getSettings().values();
    if (!settings.isEmpty()) {
        text += "\n\nSettings:";
        windowComponentY = getStringHeight(text) + 2;
        for (int i = 0; i < Math.ceil(window.getInnerHeight() / 9.0); i++) text += "\n";
    }
    // keybinds
    Set<PossibleKeybind> possibleKeybinds = feature.getPossibleKeybinds();
    if (!possibleKeybinds.isEmpty()) {
        // heading
        text += "\n\nKeybinds:";
        // add keybind button
        ButtonData addKeybindButton = new ButtonData(area.x + area.width - 16, area.y + getStringHeight(text) - 7, 12, 8, "+", 0x00ff00) {

            @Override
            public void press() {
                // add keybind
                WurstClient.MC.setScreen(new NavigatorNewKeybindScreen(possibleKeybinds, NavigatorFeatureScreen.this));
            }
        };
        buttonDatas.add(addKeybindButton);
        // keybind list
        HashMap<String, String> possibleKeybindsMap = new HashMap<>();
        for (PossibleKeybind possibleKeybind : possibleKeybinds) possibleKeybindsMap.put(possibleKeybind.getCommand(), possibleKeybind.getDescription());
        TreeMap<String, PossibleKeybind> existingKeybinds = new TreeMap<>();
        boolean noKeybindsSet = true;
        for (Keybind keybind : WurstClient.INSTANCE.getKeybinds().getAllKeybinds()) {
            String commands = keybind.getCommands();
            commands = commands.replace(";", "\u00a7").replace("\u00a7\u00a7", ";");
            for (String command : commands.split("\u00a7")) {
                command = command.trim();
                String keybindDescription = possibleKeybindsMap.get(command);
                if (keybindDescription != null) {
                    if (noKeybindsSet)
                        noKeybindsSet = false;
                    text += "\n" + keybind.getKey().replace("key.keyboard.", "") + ": " + keybindDescription;
                    existingKeybinds.put(keybind.getKey(), new PossibleKeybind(command, keybindDescription));
                } else if (feature instanceof Hack && command.equalsIgnoreCase(feature.getName())) {
                    if (noKeybindsSet)
                        noKeybindsSet = false;
                    text += "\n" + keybind.getKey().replace("key.keyboard.", "") + ": " + "Toggle " + feature.getName();
                    existingKeybinds.put(keybind.getKey(), new PossibleKeybind(command, "Toggle " + feature.getName()));
                }
            }
        }
        if (noKeybindsSet)
            text += "\nNone";
        else {
            // remove keybind button
            buttonDatas.add(new ButtonData(addKeybindButton.x, addKeybindButton.y, addKeybindButton.width, addKeybindButton.height, "-", 0xff0000) {

                @Override
                public void press() {
                    // remove keybind
                    client.setScreen(new NavigatorRemoveKeybindScreen(existingKeybinds, NavigatorFeatureScreen.this));
                }
            });
            addKeybindButton.x -= 16;
        }
    }
    // text height
    setContentHeight(getStringHeight(text));
}
Also used : Color(java.awt.Color) Rectangle(java.awt.Rectangle) LiteralText(net.minecraft.text.LiteralText) Keybind(net.wurstclient.keybinds.Keybind) Setting(net.wurstclient.settings.Setting) TooManyHaxHack(net.wurstclient.hacks.TooManyHaxHack) HashMap(java.util.HashMap) ChatUtils(net.wurstclient.util.ChatUtils) ClickGui(net.wurstclient.clickgui.ClickGui) Command(net.wurstclient.command.Command) ArrayList(java.util.ArrayList) VertexFormat(net.minecraft.client.render.VertexFormat) Window(net.wurstclient.clickgui.Window) SoundEvents(net.minecraft.sound.SoundEvents) BufferRenderer(net.minecraft.client.render.BufferRenderer) GL11(org.lwjgl.opengl.GL11) PossibleKeybind(net.wurstclient.keybinds.PossibleKeybind) VertexFormats(net.minecraft.client.render.VertexFormats) ClickableWidget(net.minecraft.client.gui.widget.ClickableWidget) Drawable(net.minecraft.client.gui.Drawable) Tessellator(net.minecraft.client.render.Tessellator) Matrix4f(net.minecraft.util.math.Matrix4f) Feature(net.wurstclient.Feature) Collection(java.util.Collection) GameRenderer(net.minecraft.client.render.GameRenderer) MatrixStack(net.minecraft.client.util.math.MatrixStack) Set(java.util.Set) IScreen(net.wurstclient.mixinterface.IScreen) ButtonWidget(net.minecraft.client.gui.widget.ButtonWidget) Hack(net.wurstclient.hack.Hack) GLFW(org.lwjgl.glfw.GLFW) Component(net.wurstclient.clickgui.Component) PositionedSoundInstance(net.minecraft.client.sound.PositionedSoundInstance) TreeMap(java.util.TreeMap) WurstClient(net.wurstclient.WurstClient) RenderSystem(com.mojang.blaze3d.systems.RenderSystem) BufferBuilder(net.minecraft.client.render.BufferBuilder) RenderUtils(net.wurstclient.util.RenderUtils) PossibleKeybind(net.wurstclient.keybinds.PossibleKeybind) TooManyHaxHack(net.wurstclient.hacks.TooManyHaxHack) Hack(net.wurstclient.hack.Hack) HashMap(java.util.HashMap) Setting(net.wurstclient.settings.Setting) Rectangle(java.awt.Rectangle) TreeMap(java.util.TreeMap) ButtonWidget(net.minecraft.client.gui.widget.ButtonWidget) Command(net.wurstclient.command.Command) Keybind(net.wurstclient.keybinds.Keybind) PossibleKeybind(net.wurstclient.keybinds.PossibleKeybind) TooManyHaxHack(net.wurstclient.hacks.TooManyHaxHack) LiteralText(net.minecraft.text.LiteralText)

Aggregations

Command (net.wurstclient.command.Command)2 Hack (net.wurstclient.hack.Hack)2 RenderSystem (com.mojang.blaze3d.systems.RenderSystem)1 Color (java.awt.Color)1 Rectangle (java.awt.Rectangle)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Set (java.util.Set)1 TreeMap (java.util.TreeMap)1 Drawable (net.minecraft.client.gui.Drawable)1 ButtonWidget (net.minecraft.client.gui.widget.ButtonWidget)1 ClickableWidget (net.minecraft.client.gui.widget.ClickableWidget)1 BufferBuilder (net.minecraft.client.render.BufferBuilder)1 BufferRenderer (net.minecraft.client.render.BufferRenderer)1 GameRenderer (net.minecraft.client.render.GameRenderer)1 Tessellator (net.minecraft.client.render.Tessellator)1 VertexFormat (net.minecraft.client.render.VertexFormat)1 VertexFormats (net.minecraft.client.render.VertexFormats)1 PositionedSoundInstance (net.minecraft.client.sound.PositionedSoundInstance)1