Jump to content

Selling gf script


Pikkel Rick

Recommended Posts

So i would gladly share this amazing script for you guys. This hoe will seduce every man in Gielinor. Let me know if you have any tips scripting related 😃

Features

- Will target surrounding people (ignores the lvl 3 bots)

- Keeps track of previous targets so it will only approach new ones

- Amazing twerk skills

P.s when added to the SDN?

import com.epicbot.api.shared.APIContext;
import com.epicbot.api.shared.GameType;
import com.epicbot.api.shared.entity.Player;
import com.epicbot.api.shared.entity.WidgetChild;
import com.epicbot.api.shared.event.ChatMessageEvent;
import com.epicbot.api.shared.methods.ITabsAPI;
import com.epicbot.api.shared.model.Area;
import com.epicbot.api.shared.model.Tile;
import com.epicbot.api.shared.script.LoopScript;
import com.epicbot.api.shared.script.ScriptManifest;
import com.epicbot.api.shared.util.paint.frame.PaintFrame;
import com.epicbot.api.shared.util.time.Time;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;

@ScriptManifest(name = "Girlfriend", gameType = GameType.OS)
public class main extends LoopScript {

    long startTime;
    int currentPrice = 1000;
    int boyfriendAmount = 0;
    int moneyEarned = 0;
    int theirCoinsAmountInTrade;

    String currentBoyfriend;
    String currentlyInTradeWith;
    String currentTarget;
    String state;
    ArrayList<String> pastTargets = new ArrayList<String>();

    boolean justGotBought = false;
    boolean goPublicAdvertisement = false;

    Area grandExchangeArea = new Area(3156, 3479, 3174, 3468);
    Tile grandExchangeTile= new Tile(3164, 3474);

    public String getNewTarget(){
        if(pastTargets.size() >= 10){
            pastTargets.remove(0);
        }
        for(int i=0; i < getAPIContext().players().query().notMe().results().nearestList().size(); i++){
            Player player = getAPIContext().players().query().notMe().results().nearestList().get(i);
            if(!player.getName().equals(currentBoyfriend) &&
                    !player.getName().equals(currentTarget) &&
                    player.getCombatLevel() > 3 &&
                    !pastTargets.contains(player.getName())){
                if(!pastTargets.contains(player.getName())){
                    pastTargets.add(player.getName());
                    System.out.println(pastTargets);
                    return player.getName();
                }
            }
        }return null;
    }

    public void startContact(String target){
        if(getAPIContext().players().query().named(target).results().nearest().isVisible()){
            state = "Making contact";
            if(!getAPIContext().widgets().isInterfaceOpen()){
                if(getAPIContext().players().query().named(target).results().nearest().interact("Follow")){
                    if(!getAPIContext().widgets().isInterfaceOpen()){
                        getAPIContext().keyboard().sendText("Hey " + target + ", do you want to buy me as your gf?", true);
                    }
                    if(!getAPIContext().widgets().isInterfaceOpen()){
                        getAPIContext().keyboard().sendText(currentBoyfriend + " owns me now, he bought me for " + currentPrice + " gp", true);
                    }
                    if(!getAPIContext().widgets().isInterfaceOpen()){
                        getAPIContext().keyboard().sendText("You can buy me for " + (currentPrice + 1) + " gp", true);
                    }
                    if(!getAPIContext().widgets().isInterfaceOpen()){
                        getAPIContext().keyboard().sendText("If you own me, I will twerk for you daddy", true);
                    }
                    if(!getAPIContext().widgets().isInterfaceOpen()){
                        getAPIContext().players().query().named(currentTarget).results().nearest().interact("Trade with");
                        Time.sleep(5000, ()-> getAPIContext().widgets().isInterfaceOpen());
                    }
                }
            }
        }
    }

    public boolean isFirstTradeInterfaceOpen(){
        return getAPIContext().widgets().get(335, 2).isVisible();
    }

    public boolean isSecondTradeInterfaceOpen(){
        return getAPIContext().widgets().get(334, 3).isVisible();
    }

    public boolean otherPlayerAccepted(){
        if(getAPIContext().widgets().query().textContains("Other player has accepted").results().first() != null){
            return getAPIContext().widgets().query().textContains("Other player has accepted").results().first().isVisible();
        }else{
            return false;
        }
    }

    public void declineTrade(){
        if(getAPIContext().widgets().query().group(335).textContains("Decline").results().first() != null){
            getAPIContext().widgets().query().group(335).textContains("Decline").results().first().click();
        }
        else if(getAPIContext().widgets().query().group(334).textContains("Decline").results().first() != null){
            getAPIContext().widgets().query().group(334).textContains("Decline").results().first().click();
        }
    }

    public void acceptTrade(){
        if(getAPIContext().widgets().query().group(335).textContains("Accept").results().first() != null){
            getAPIContext().widgets().query().group(335).textContains("Accept").results().first().click();
        }
        else if(getAPIContext().widgets().query().group(334).textContains("Accept").results().first() != null){
            getAPIContext().widgets().query().group(334).textContains("Accept").results().first().click();
        }
    }

    public String getOtherPlayerTrading(){
        String[] parts = getAPIContext().widgets().get(335, 31).getText().split(":");
        return parts[1].replaceFirst("\\s", "");
    }


    public int getTheirItemCount(String item){
        List<WidgetChild> slots = getAPIContext().widgets().get(335, 28).getChildren();
        for (WidgetChild slot : slots){
            if(slot.getName().equals(item)){
                return slot.getStackSize();
            }
        }return 0;

    }

    public void handleTrade(){
        if (isFirstTradeInterfaceOpen()){
            currentlyInTradeWith = getOtherPlayerTrading();
            state = "In trade";
            getAPIContext().keyboard().sendText("Buy me for a minimum of " + (currentPrice + 1) + " gp", true);
            Time.sleep(20000, ()-> otherPlayerAccepted() || !isFirstTradeInterfaceOpen());
            if(otherPlayerAccepted()){
                theirCoinsAmountInTrade = getTheirItemCount("Coins");
                System.out.println(theirCoinsAmountInTrade);
                System.out.println(currentPrice);
                if(theirCoinsAmountInTrade > currentPrice) {
                    System.out.println("Should accept trade");
                    acceptTrade();
                    Time.sleep(3000, this::isSecondTradeInterfaceOpen);
                }
            }
            if(isFirstTradeInterfaceOpen()){
                declineTrade();
                Time.sleep(2000, ()-> !isFirstTradeInterfaceOpen());
            }
        }

        if(isSecondTradeInterfaceOpen()) {
            acceptTrade();
            getAPIContext().keyboard().sendText("<3", true);
            Time.sleep(20000, () -> otherPlayerAccepted() || !getAPIContext().widgets().isInterfaceOpen());
            Time.sleep(1000);
        }
    }

    public void twerk(){
        if(!getAPIContext().tabs().isOpen(ITabsAPI.Tabs.EMOTES)){
            getAPIContext().tabs().open(ITabsAPI.Tabs.EMOTES);
            Time.sleep(2000, ()-> getAPIContext().tabs().isOpen(ITabsAPI.Tabs.EMOTES));
        }
        if(getAPIContext().tabs().isOpen(ITabsAPI.Tabs.EMOTES)){
            if(getAPIContext().widgets().query().group(216).actions("Panic").results().first() != null){
                getAPIContext().widgets().query().group(216).actions("Panic").results().first().click();
                Time.sleep(3000, ()-> !getAPIContext().localPlayer().isAnimating());
                Time.sleep(400, 800);
            }
        }
    }

    public void praiseNewBoyfriend(){
        state = "Praising new bf";
        getAPIContext().keyboard().sendText(currentBoyfriend + " you are my new daddy", true);
        Time.sleep(500,1000);
        if(getAPIContext().players().query().named(currentBoyfriend).results().nearest() != null){
            getAPIContext().players().query().named(currentBoyfriend).results().nearest().interact("Follow");
        }
        getAPIContext().keyboard().sendText("I love you " + currentBoyfriend, true);
        Time.sleep(500,1000);
        getAPIContext().keyboard().sendText("Let me twerk for you daddy", true);
        twerk();
        twerk();
        getAPIContext().keyboard().sendText("Do you like that daddy?", true);
        twerk();
    }

    public void doPublicAdvertisement(){
        state = "Public advertisement";
        if(!getAPIContext().widgets().isInterfaceOpen()){
            getAPIContext().webWalking().walkTo(grandExchangeTile);
        }
        if(!getAPIContext().widgets().isInterfaceOpen()){
            getAPIContext().keyboard().sendText(currentBoyfriend + " just bought me for " + currentPrice + " gp", true);
            Time.sleep(800, 1200);
        }
        if(!getAPIContext().widgets().isInterfaceOpen()){
            getAPIContext().keyboard().sendText("Who wants to steal me from " + currentBoyfriend + "?", true);
            Time.sleep(800, 1200);
        }

        if(!getAPIContext().widgets().isInterfaceOpen()){
            getAPIContext().keyboard().sendText("I will twerk for you if you own me", true);
            twerk();
            Time.sleep(800, 1200);
            twerk();
        }

        if(!getAPIContext().widgets().isInterfaceOpen()){
            getAPIContext().keyboard().sendText("Buy me for " + (currentPrice + 1) + " gp to steal me from my bf", true);
            Time.sleep(800, 1200);
        }
        if(!getAPIContext().widgets().isInterfaceOpen()){
            getAPIContext().keyboard().sendText("Buy me for " + (currentPrice + 1) + " and i will be your gf!", true);
            Time.sleep(800, 1200);
        }
        goPublicAdvertisement = false;
    }


    @Override
    protected int loop() {
        if(currentTarget == null){
            currentTarget = getNewTarget();
        }

        if(!getAPIContext().widgets().isInterfaceOpen()){
            if(currentTarget != null){
                if(!justGotBought){
                    if(!goPublicAdvertisement){
                        if(grandExchangeArea.contains(getAPIContext().localPlayer().getLocation())){
                            currentTarget = getNewTarget();
                            startContact(currentTarget);
                        }
                    }
                }
            }
        }

        if(getAPIContext().widgets().isInterfaceOpen()){
            handleTrade();
        }

        if(justGotBought){
            praiseNewBoyfriend();
            justGotBought = false;
            goPublicAdvertisement = true;
        }

        if(!grandExchangeArea.contains(getAPIContext().localPlayer().getLocation())){
            if(!justGotBought){
                if(!getAPIContext().widgets().isInterfaceOpen()){
                    goPublicAdvertisement = true;
                }
            }
        }

        if(goPublicAdvertisement){
            doPublicAdvertisement();
        }


        return 300;
    }



    @Override
    public boolean onStart(String... strings) {
        if (!getAPIContext().client().isLoggedIn()) {
            Time.sleep(15_000, () -> getAPIContext().client().isLoggedIn());
        }
        System.out.println("Girlfriend script has started");
        state = "Starting";
        currentBoyfriend = "scapeboy12";
        startTime = System.currentTimeMillis();
        pastTargets.add("Test");
        return true;
    }


    @Override
    protected void onChatMessage(ChatMessageEvent a){
        if(a.getMessage().getText().contains("wishes to trade with you")){
            String[] parts = a.getMessage().getText().split("wishes");
            String tradeSender = parts[0];
            String finalTradeSender = tradeSender.trim().replaceAll(new String(new char[] {(char)(160)}), " ");
            if(getAPIContext().players().query().named(finalTradeSender).results().nearest() != null) {
                getAPIContext().players().query().named(finalTradeSender).results().nearest().interact("Trade with");
                Time.sleep(2000, ()-> getAPIContext().widgets().isInterfaceOpen());
            }
        }

        if(a.getMessage().getText().contains("Accepted trade")){
            currentPrice = theirCoinsAmountInTrade;
            moneyEarned += theirCoinsAmountInTrade;
            currentBoyfriend = currentlyInTradeWith;
            justGotBought = true;
            boyfriendAmount++;
        }
    }


    @Override
    protected void onPaint(Graphics2D g, APIContext ctx) {
        if (!getAPIContext().client().isLoggedIn()) {
            Time.sleep(15_000, () -> getAPIContext().client().isLoggedIn());
        }
        if (getAPIContext().client().isLoggedIn()) {
            PaintFrame frame = new PaintFrame();
            frame.setTitle("Selling gf");
            frame.addLine("Runtime: ", Time.getFormattedRuntime(startTime));
            frame.addLine("State: ", state);
            frame.addLine("Boyfriends had: ", boyfriendAmount);
            frame.addLine("Current boyfriend: ", currentBoyfriend);
            frame.addLine("Current target: ", currentTarget);
            frame.addLine("Money made: ", moneyEarned);
            frame.addLine("", "");
            frame.draw(g, 0, 90, ctx); //drawing the actual frame.
            g.setColor(new Color(208, 189, 155, 255));
        }
    }
}

 

Edited by Pikkel Rick
  • Like 2
Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...