Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts.Merchanter;
- import java.awt.BasicStroke;
- import java.awt.Color;
- import java.awt.Dimension;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Toolkit;
- import org.tribot.api.General;
- import org.tribot.api.Timing;
- import org.tribot.api.input.Keyboard;
- import org.tribot.api.input.Mouse;
- import org.tribot.api2007.Camera;
- import org.tribot.api2007.GameTab;
- import org.tribot.api2007.GameTab.TABS;
- import org.tribot.api2007.Interfaces;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.Login;
- import org.tribot.api2007.Login.STATE;
- import org.tribot.api2007.Player;
- import org.tribot.api2007.Walking;
- import org.tribot.api2007.types.RSInterfaceChild;
- import org.tribot.api2007.types.RSItem;
- import org.tribot.api2007.types.RSTile;
- import org.tribot.script.Script;
- import org.tribot.script.ScriptManifest;
- import org.tribot.script.interfaces.Painting;
- @ScriptManifest(authors = { "JoeDezzy" }, category = "Merchanting", name = "REloaded 4.oh")
- public class mercherFinal12_20_2013 extends Script implements Runnable, Painting{
- public String merchantingItem;
- public int buyingPrice;
- public int sellingPrice;
- public int itemID;
- public int itemIDNoted;
- public String buyingMessage;
- public int startSellingSwitch;
- public String sellingMessage;
- public int DelayTo;
- public int DelayFrom;
- public int itemsSold = 0;
- public boolean GUI_COMPLETE;
- public boolean Selling;
- public boolean Buying;
- public RSTile OriginalTile;
- public static int Coins = Inventory.getCount(995);
- public long Profit;
- public int InitialCoins;
- public int NextGoldAmount;
- public int Exchanges;
- public String BuyingOrSelling;
- public String Status;
- public long StartTime;
- @Override
- public void run() {
- setLoginBotState(false);
- GUIOPEN();
- println("Welcome to JDezzy's Flawless Merchanter");
- println("You are merchanting item: " + merchantingItem);
- println("For a price of: " + buyingPrice + " to " + sellingPrice);
- GetInitialValues();
- Mouse.setSpeed(General.random(80,95));
- StartTime = System.currentTimeMillis();
- DetermineStartAction();
- }
- private void DetermineStartAction() {
- if (WeNeedToBuy())
- { println("We've switched to buying");
- BuyingOrSelling = "Buying";
- Buying(); }
- else if (!WeNeedToBuy())
- { println("We've switched to selling");
- BuyingOrSelling = "Selling";
- Selling(); }
- }
- private boolean WeNeedToBuy() {
- int Coins1 = Inventory.getCount(995);
- RSItem[] Item = Inventory.find(itemID);
- RSItem[] ItemNoted = Inventory.find(itemIDNoted);
- if(Coins1 >= buyingPrice && (Item.length + ItemNoted.length == 0))
- return true;
- else if(Coins1 <= startSellingSwitch)
- return false;
- else return false;
- }
- private void GetInitialValues() {
- if(Inventory.find(995) != null)
- InitialCoins = Inventory.getCount(995);
- else
- InitialCoins = 0;
- OriginalTile = Player.getRSPlayer().getPosition();
- Exchanges = 0;
- Profit = 0;
- BuyingOrSelling = "Waiting...";
- }
- private void Selling() { //complete
- if(WeNeedToBuy())
- Buying();
- AntiBan1();
- OriginalTileCheck();
- BuyingOrSelling = "Selling";
- Status = "Advertising";
- Advertise("selling");
- FirstTradeScreen("selling");
- WaitForAcceptance("selling");
- if(SCpresent())
- SecondTradeScreenSelling();
- if(!FCpresent() && !SCpresent())
- { OriginalTileCheck();
- Selling();}
- }
- private void TwistCamera() {
- int antibanstart = General.random(1, 50);
- int antibanstart2 = General.random(1, 300);
- if(antibanstart == 5 || antibanstart == 33 || antibanstart == 27)
- Camera.setCameraRotation(General.random(10, 300));
- else if(antibanstart2 == General.random(1, 200))
- { GameTab.open(TABS.FRIENDS);
- sleep(800, 1000);
- GameTab.open(TABS.INVENTORY); }
- }
- private void TypeMessageAndCheckForTradeBuying(){
- Thread TradeCheck = new Thread(new TradeRequestCheck());
- TradeCheck.start();
- if(WeCanType())
- Keyboard.typeSend(buyingMessage);
- Thread TradeCheck2 = new Thread(new TradeRequestCheck());
- TradeCheck2.start();
- Keyboard.pressEnter();
- }
- private boolean WeCanType() {
- RSInterfaceChild chatboxinterface = Interfaces.get(137, 1);
- if((!chatboxinterface.getText().contains("white") &&
- !chatboxinterface.getText().contains("cyan") &&
- !chatboxinterface.getText().contains("red") &&
- !chatboxinterface.getText().contains("glow") &&
- !chatboxinterface.getText().contains("green")))
- return true;
- else return false;
- }
- private void TypeMessageAndCheckForTradeSelling() {
- Thread TradeCheck = new Thread(new TradeRequestCheck());
- TradeCheck.start();
- if(WeCanType())
- Keyboard.typeSend(sellingMessage);
- Thread TradeCheck2 = new Thread(new TradeRequestCheck());
- TradeCheck2.start();
- Keyboard.pressEnter();
- }
- private void CheckForError() {
- if(Interfaces.isInterfaceValid(241))
- { RSInterfaceChild RandomEvent = Interfaces.get(241, 3);
- RandomEvent.click(); }
- if(Interfaces.isInterfaceValid(240))
- { RSInterfaceChild RandomEvent = Interfaces.get(240, 3);
- RandomEvent.click(); }
- if(Login.getLoginState() == STATE.LOGINSCREEN)
- { setLoginBotState(true);
- while(Login.getLoginState() == STATE.LOGINSCREEN)
- { sleep(300); }
- }
- if(GameTab.getOpen() != TABS.INVENTORY)
- GameTab.open(TABS.INVENTORY);
- }
- private void Buying(){//complete
- if(!WeNeedToBuy())
- Selling();
- OriginalTileCheck();
- AntiBan2();
- BuyingOrSelling = "Buying";
- Status = "Advertising";
- Advertise("buying");
- FirstTradeScreen("buying");
- WaitForAcceptance("buying");
- if(SCpresent())
- SecondTradeScreenBuying();
- else
- { OriginalTileCheck();
- Buying(); }
- OriginalTileCheck();
- Buying();
- }
- private void FirstTradeScreen(String action) {
- switch(action){
- case "buying":
- if (FCpresent())
- { Status = "First Screen";
- WaitForOffer();
- OfferCoinsOrDecline(); }//sleep to wait for interface 137 to pop up
- else
- DetermineStartAction();
- case "selling":
- if (FCpresent())
- { Status = "First Screen";
- WaitForOffer();
- OfferItemOrDecline(); }
- else
- DetermineStartAction();
- }
- }
- private void OfferItemOrDecline() {
- if(FCpresent())
- if(FirstTradeScreen.CheckForOffer(Coins, Coins))
- FirstTradeScreen.OfferItem(itemID, itemIDNoted);
- else
- TradeScreenHandeler.DeclineFirstScreen();
- }
- private boolean SCpresent() {
- if(Interfaces.isInterfaceValid(334))
- return true;
- else return false;
- }
- private void WaitForAcceptance(String action) {
- println("Waiting for them to accept");
- AcceptFC();
- if(FCpresent())
- while(FCpresent())
- switch(action)
- {
- case "buying":
- if(FirstTradeScreen.CheckForOffer(itemID, itemIDNoted))
- { TradeScreenHandeler.AcceptFirstScreen();
- sleep(2000,3000);}
- else
- sleep(5000,7000);
- if(FCpresent() && !FirstTradeScreen.CheckForOffer(Coins, Coins))
- TradeScreenHandeler.DeclineFirstScreen();
- case "selling":
- if(FirstTradeScreen.CheckForOffer(Coins, Coins))
- { TradeScreenHandeler.AcceptFirstScreen();
- sleep(2000,3000); }
- else
- sleep(5000,7000);
- if(FCpresent() && !FirstTradeScreen.CheckForOffer(Coins, Coins))
- TradeScreenHandeler.DeclineFirstScreen();
- }
- else
- DetermineStartAction();
- }
- private void AcceptFC() {
- Mouse.setSpeed(General.random(100,115));
- TradeScreenHandeler.AcceptFirstScreen();
- Mouse.setSpeed(General.random(80,95));
- sleep(2000,3000);
- }
- private void OfferCoinsOrDecline() {
- if(Interfaces.isInterfaceValid(335) && FirstTradeScreen.CheckForOffer(itemID, itemIDNoted)) //offers coins if what we want is present
- { println("Offering coins");
- FirstTradeScreen.OfferCoins();
- sleep(1500,3000);
- TypeAmount();}
- else
- { if(!FirstTradeScreen.CheckForOffer(itemID, itemIDNoted))//if not what we want, declines
- TradeScreenHandeler.DeclineFirstScreen();
- OriginalTileCheck();
- Buying(); }
- }
- private void TypeAmount() {
- if(FCpresent() && Interfaces.isInterfaceValid(137))
- { //Enters price you wanna buy
- String BuyingPrice = Integer.toString(buyingPrice);
- Keyboard.typeSend(BuyingPrice); }
- else
- if(FCpresent() && FirstTradeScreen.CheckForOffer(itemID, itemIDNoted))
- { println("Re-offering coins");
- FirstTradeScreen.OfferCoins();
- sleep(2000,3000);
- TypeAmount(); }
- else
- { if(FCpresent())
- { TradeScreenHandeler.DeclineFirstScreen();
- sleep(1000,1660); }
- OriginalTileCheck();
- Buying(); //Re-loops to buying if none of the above is true
- }
- }
- private boolean FCpresent() {
- if(Interfaces.isInterfaceValid(335))
- return true;
- else return false;
- }
- private void WaitForOffer() {
- while(FCpresent() && !FirstTradeScreen.CheckForAnOffer()) //when in trade. sleep until they offer
- sleep(300);
- }
- private void Advertise(String action) {
- if(action.equals("buying"))
- while(!Interfaces.isInterfaceValid(335) && !Interfaces.isInterfaceValid(334))
- { //complete. Loops Advert. message until traded
- OriginalTileCheck();
- CheckForError();
- TypeMessageAndCheckForTradeBuying();
- OriginalTileCheck();
- TwistCamera();
- OriginalTileCheck();
- sleep(DelayTo, DelayFrom); }
- else if(action.equals("selling"))
- while(!Interfaces.isInterfaceValid(335) && !Interfaces.isInterfaceValid(334))
- { OriginalTileCheck();
- CheckForError();
- TypeMessageAndCheckForTradeSelling();
- OriginalTileCheck();
- TwistCamera();
- sleep(DelayTo, DelayFrom); }
- }
- private void SecondTradeScreenBuying() { //complete
- Status = "Checking trade";
- if(Interfaces.isInterfaceValid(334))
- if(SecondTradeScreen.CheckForCorrectItem(merchantingItem))
- { TradeScreenHandeler.AcceptSecondScreen();
- while(Interfaces.isInterfaceValid(334))
- { Mouse.click(1);
- sleep(3000,4000); }
- SuccessMesage();
- Buying(); }
- else
- { if(Interfaces.isInterfaceValid(334))
- { TradeScreenHandeler.DeclineSecondScreen();
- ScammerMessage(); }
- Buying(); }
- }
- private void ScammerMessage() {
- println("Scammer");
- String [] ScammerMessages = {"nope","wtf","lol kid","??", "nice", "almost got me lol", "You're cool dude"};
- Keyboard.typeSend(ScammerMessages[General.random(0,4)]);
- sleep(4000,5000);
- }
- private void SuccessMesage() {
- println("Successful trade");
- String[] ThankMessages = {"ty", "thanks", "ty:)", ":)", "ty dude", "tyyyy"};
- Keyboard.typeSend(ThankMessages[General.random(0,5)]);
- Exchanges = Exchanges + 1;
- }
- private void SecondTradeScreenSelling() { //complete
- String CoinAmount = GetSecondScreenText();
- Status = "Checking trade";
- if(SCpresent())
- if(SecondTradeScreen.CheckForCorrectItem(CoinAmount))
- { TradeScreenHandeler.AcceptSecondScreen();
- while(Interfaces.isInterfaceValid(334))
- { Mouse.click(1);
- sleep(3000,4000); }
- SuccessMesage();
- SoldAnItem();
- Selling();
- } else
- if(SCpresent())
- TradeScreenHandeler.DeclineSecondScreen();
- ScammerMessage();
- Selling();
- }
- private String GetSecondScreenText() {
- String CoinAmount = Integer.toString(sellingPrice);
- if(CoinAmount.length() == 5){
- StringBuffer sub1 = new StringBuffer(CoinAmount);
- CoinAmount = sub1.insert(2, ",").toString();
- }
- else if (CoinAmount.length() == 6){
- StringBuffer sub1 = new StringBuffer(CoinAmount);
- CoinAmount = sub1.insert(3, ",").toString();
- }
- else if (CoinAmount.length() == 7){
- StringBuffer sub1 = new StringBuffer(CoinAmount);
- String sub2 = sub1.insert(1, ",").toString();
- StringBuffer sub3 = new StringBuffer(sub2);
- String sub4 = sub3.insert(5, ",").toString();
- CoinAmount = sub4;
- }
- return CoinAmount;
- }
- private void SoldAnItem() {
- itemsSold = itemsSold + 1;
- NextGoldAmount = Inventory.getCount(995);
- Profit = NextGoldAmount - InitialCoins;
- Exchanges = Exchanges + 1;
- }
- private void OriginalTileCheck() {//Complete. It keeps saying wrong area but its wrong. check this
- if (!Player.getRSPlayer().getPosition().equals(OriginalTile))
- { Walking.walkTo(OriginalTile);
- sleep(General.random(1403,3064)); }
- }
- private void AntiBan1() {//complete
- int antibanstart = General.random(1, 10);
- if(antibanstart == 3 || antibanstart == 7 || antibanstart == 8)
- { println("AntiBan 1 Initiated");
- Camera.setCameraAngle(General.random(0,100));
- Camera.setCameraRotation(General.random(0,300));
- Mouse.click(General.random(25, 495), General.random(37, 301), 3);
- sleep(General.random(500,1500));
- Mouse.move(General.random(564, 721), General.random(211, 451)); }
- }
- private void AntiBan2(){//complete
- int antibanstart = General.random(1, 10);
- if(antibanstart == 3 || antibanstart == 7 || antibanstart == 8)
- { println("AntiBan 2 Initiated");
- GameTab.open(TABS.STATS);
- Mouse.move(General.random(565,720), General.random(227,411));
- sleep(1350, 2406);
- GameTab.open(TABS.INVENTORY); }
- }
- public void GUIOPEN(){//complete
- GUI1 GUI = new GUI1();
- Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize();
- int screenW = (screensize.width) / 2;
- int screenH = (screensize.height) / 2;
- GUI.setVisible(true);
- GUI.setLocation((screenW / 2), (screenH / 2));
- while (!GUI_COMPLETE)
- sleep(300);
- }
- public class GUI1 extends javax.swing.JFrame {//complete
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public GUI1() {
- initComponents();
- }
- private void initComponents() {
- MerchantingItem = new javax.swing.JTextField();
- ItemID = new javax.swing.JTextField();
- jLabel7 = new javax.swing.JLabel();
- BuyingPrice = new javax.swing.JTextField();
- SellingPrice = new javax.swing.JTextField();
- StartButton = new javax.swing.JToggleButton();
- jLabel13 = new javax.swing.JLabel();
- jLabel14 = new javax.swing.JLabel();
- jLabel15 = new javax.swing.JLabel();
- jLabel16 = new javax.swing.JLabel();
- jLabel17 = new javax.swing.JLabel();
- BuyingMessage = new javax.swing.JTextField();
- delayFrom = new javax.swing.JTextField();
- SellingMessage = new javax.swing.JTextField();
- jLabel18 = new javax.swing.JLabel();
- jLabel19 = new javax.swing.JLabel();
- jLabel20 = new javax.swing.JLabel();
- jLabel21 = new javax.swing.JLabel();
- jLabel22 = new javax.swing.JLabel();
- jSeparator1 = new javax.swing.JSeparator();
- delayTo = new javax.swing.JTextField();
- jLabel23 = new javax.swing.JLabel();
- jLabel24 = new javax.swing.JLabel();
- jLabel26 = new javax.swing.JLabel();
- ItemIDNoted = new javax.swing.JTextField();
- jLabel1 = new javax.swing.JLabel();
- SwitchToSellAmount = new javax.swing.JTextField();
- jLabel2 = new javax.swing.JLabel();
- jSeparator2 = new javax.swing.JSeparator();
- setAutoRequestFocus(false);
- setBackground(new java.awt.Color(0, 153, 204));
- setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
- MerchantingItem.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
- MerchantingItem.setName(""); // NOI18N
- MerchantingItem.setText("Abyssal whip");
- MerchantingItem.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- }
- });
- ItemID.setText("4151");
- ItemID.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- }
- });
- jLabel7.setFont(new java.awt.Font("Rosewood Std Regular", 0, 36)); // NOI18N
- jLabel7.setText("JoeDezzy's AutoMErch GUI:");
- jLabel7.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
- BuyingPrice.setText("1630000");
- BuyingPrice.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- }
- });
- SellingPrice.setText("1670000");
- SellingPrice.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- }
- });
- StartButton.setText("Get Rich");
- StartButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- StartButtonActionPerformed(evt);
- }
- });
- jLabel13.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
- jLabel13.setText("Enter your customized messages here. Include effects with semicolons.");
- jLabel14.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
- jLabel14.setText("Message Delay (0 to 1 if no delay)");
- jLabel15.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
- jLabel15.setText("Buying Message:");
- jLabel16.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
- jLabel16.setText("Selling Message:");
- jLabel17.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
- jLabel17.setText("From:");
- BuyingMessage.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
- BuyingMessage.setName(""); // NOI18N
- BuyingMessage.setText("cyan:shake:buying whip 1630k!! - prods");
- BuyingMessage.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- }
- });
- delayFrom.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
- delayFrom.setName(""); // NOI18N
- delayFrom.setText("4000");
- delayFrom.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- }
- });
- SellingMessage.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
- SellingMessage.setName(""); // NOI18N
- SellingMessage.setText("white:wave:selling whip 1670k!! - prods");
- SellingMessage.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- }
- });
- jLabel18.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
- jLabel18.setText("Item to merchant:");
- jLabel19.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
- jLabel19.setText("Buying price:");
- jLabel20.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
- jLabel20.setText("Selling price:");
- jLabel21.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
- jLabel21.setText("Item ID:");
- jLabel22.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
- jLabel22.setText("Enter your item attributes here.");
- delayTo.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
- delayTo.setName(""); // NOI18N
- delayTo.setText("3002");
- delayTo.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- }
- });
- jLabel23.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
- jLabel23.setText("To:");
- jLabel24.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
- jLabel24.setText("Milliseconds");
- jLabel26.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
- jLabel26.setText("Noted:");
- ItemIDNoted.setText("4152");
- ItemIDNoted.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- }
- });
- jLabel1.setText("Start to sell at:");
- SwitchToSellAmount.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
- SwitchToSellAmount.setName(""); // NOI18N
- SwitchToSellAmount.setText("1629999");
- SwitchToSellAmount.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- }
- });
- jLabel2.setText("GP left over");
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGap(96, 96, 96)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(jLabel18)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(MerchantingItem, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jLabel21)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(ItemID, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel26)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(ItemIDNoted, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(128, 128, 128))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(jLabel19)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(BuyingPrice, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 47, Short.MAX_VALUE)
- .addComponent(jLabel20)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(SellingPrice, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(126, 126, 126))
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(16, 16, 16)
- .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 408, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 468, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(130, 130, 130)
- .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 408, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(layout.createSequentialGroup()
- .addGap(129, 129, 129)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jLabel15)
- .addComponent(jLabel16))
- .addGap(8, 8, 8)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(BuyingMessage)
- .addComponent(SellingMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 326, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGap(22, 22, 22)
- .addComponent(jLabel14)
- .addGap(15, 15, 15))
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabel17)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(delayFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jLabel23)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(delayTo, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(StartButton, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabel1)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(SwitchToSellAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jLabel2))))))
- .addGap(0, 0, Short.MAX_VALUE))
- .addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.TRAILING)
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel22)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(ItemID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(ItemIDNoted, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGap(11, 11, 11)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(MerchantingItem, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(BuyingPrice, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(SellingPrice, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGap(16, 16, 16)
- .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel13)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(BuyingMessage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(SellingMessage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(delayFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(delayTo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(2, 2, 2)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(SwitchToSellAmount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel1)
- .addComponent(jLabel2))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(StartButton)
- .addContainerGap(21, Short.MAX_VALUE))
- );
- pack();
- }// </editor-fold>
- private void StartButtonActionPerformed(java.awt.event.ActionEvent evt) {
- merchantingItem = MerchantingItem.getText().toString();
- buyingPrice = Integer.parseInt(BuyingPrice.getText().toString());
- sellingPrice = Integer.parseInt(SellingPrice.getText().toString());
- itemID = Integer.parseInt(ItemID.getText().toString());
- itemIDNoted = Integer.parseInt(ItemIDNoted.getText().toString());
- buyingMessage = BuyingMessage.getText().toString();
- sellingMessage = SellingMessage.getText().toString();
- DelayTo = Integer.parseInt(delayTo.getText().toString());
- DelayFrom = Integer.parseInt(delayFrom.getText().toString());
- startSellingSwitch = Integer.parseInt(SwitchToSellAmount.getText().toString());
- GUI_COMPLETE = true;
- }
- // Variables declaration - do not modify
- private javax.swing.JTextField BuyingMessage;
- private javax.swing.JTextField BuyingPrice;
- private javax.swing.JTextField ItemID;
- private javax.swing.JTextField ItemIDNoted;
- private javax.swing.JTextField MerchantingItem;
- private javax.swing.JTextField SellingMessage;
- private javax.swing.JTextField SellingPrice;
- private javax.swing.JToggleButton StartButton;
- private javax.swing.JTextField SwitchToSellAmount;
- private javax.swing.JTextField delayFrom;
- private javax.swing.JTextField delayTo;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JLabel jLabel13;
- private javax.swing.JLabel jLabel14;
- private javax.swing.JLabel jLabel15;
- private javax.swing.JLabel jLabel16;
- private javax.swing.JLabel jLabel17;
- private javax.swing.JLabel jLabel18;
- private javax.swing.JLabel jLabel19;
- private javax.swing.JLabel jLabel2;
- private javax.swing.JLabel jLabel20;
- private javax.swing.JLabel jLabel21;
- private javax.swing.JLabel jLabel22;
- private javax.swing.JLabel jLabel23;
- private javax.swing.JLabel jLabel24;
- private javax.swing.JLabel jLabel26;
- private javax.swing.JLabel jLabel7;
- private javax.swing.JSeparator jSeparator1;
- private javax.swing.JSeparator jSeparator2;
- // End of variables declaration
- }
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(204, 204, 204);
- private final Color color3 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 12);
- private final Font font2 = new Font("BatangChe", 1, 23);
- @Override
- public void onPaint(Graphics g1) {
- Profit = (sellingPrice - buyingPrice) * itemsSold;
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(260, 333, 279, 124);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRect(260, 333, 279, 124);
- g.setFont(font1);
- g.setColor(color3);
- g.drawString("Item: " + merchantingItem, 267, 354);
- g.drawString("Buying Price: " + buyingPrice, 267, 368);
- g.drawString("Selling Price: " + sellingPrice, 267, 384);
- g.drawString("Currently: " + BuyingOrSelling, 267, 398);
- g.drawString("Profit: " + Profit, 268, 412);
- g.drawString("Exchanges: " + Exchanges, 268, 427);
- long timeRan = System.currentTimeMillis() - StartTime;
- g.drawString("Time running: " + Timing.msToString(timeRan), 269, 445);
- g.setFont(font2);
- g.setColor(color1);
- g.drawString("STATUS: " + Status, 13, 368);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment