Welcome to TRiBot Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Bradsta

Registered
  • Content count

    1,814
  • Joined

  • Last visited

  • Feedback

    100%

Community Reputation

184 Excellent

About Bradsta

  • Rank
    Scripter
  • Birthday 07/12/1993

Personal

  • Sex
    Male

Recent Profile Visitors

4,508 profile views
  1. Just getting back into the groove of things again, it's been quite a while now! Hopefully this will help someone out that needs to track profit for their script. Features​Store prices for each item you wish to track for profitStore prices for each item you wish to track for expensesTrack counts of each surplus item & expense itemEasily calculate total profit by calling getProfit()Copy the price of one item to another itemManually set the price of an itemManually add/remove itemInitialize expenses and surplus by names upon script start. Afterwards hook to your zybez api to setup the price for each item with setupPriceMap();package scripts.org.brad.utils;import java.util.Collection;import java.util.HashMap;import org.tribot.api.General;/** * @author Bradsta**/public class ProfitManager { // Hashmaps to store item counts & prices for both expenses and surplus. private HashMap<String, Integer> expenses = new HashMap<>(); private HashMap<String, Integer> surplus = new HashMap<>(); private HashMap<String, Integer> prices = new HashMap<>(); /** * Returns our profit based on expenses & surplus items getting price * information from prices. * * @return */ public double getProfit() { double value = 0.00; if (expenses.size() > 0) { for (String expense : expenses.keySet()) { if (prices.containsKey(expense)) value -= (expenses.get(expense) * prices.get(expense)); } } if (surplus.size() > 0) { for (String item : surplus.keySet()) { if (prices.containsKey(item)) value += (surplus.get(item) * prices.get(item)); } } return value; } /** * Clear profit manager */ public void clearManager() { surplus.clear(); prices.clear(); expenses.clear(); } /** * Returns total count of surplus items * * @return */ public int getTotalSurplusCount() { int count = 0; for (String item : surplus.keySet()) { count += surplus.get(item); } return count; } /** * Returns surplus items in String[] array. * @return */ public String[] getSurplusItems() { return convertStringCollection(surplus.keySet()); } /** * Returns surplus item counts in int[] array * @return */ public int[] getSurplusCounts() { return convertIntegerCollection(surplus.values()); } /** * Updates the specified expense with the new count. * * @param name * @param count */ public void updateExpense(String name, int count) { expenses.put(name, count); } /** * Updates the specified surplus with the new count. * * @param name * @param count */ public void updateSurplus(String name, int count) { surplus.put(name, count); } /** * Copies price of item to another * @param name * @param nameToCopy */ public void copyPrice(String name, String nameToCopy) { prices.put(name, prices.get(nameToCopy)); General.println(name+" has a new price of : "+prices.get(name)); } /** * Sets the price of an item * @param name * @param price */ public void setPrice(String name, int price) { prices.put(name, price); General.println(name+ "'s price has been set to "+prices.get(name)); } /** * Initializes the expense HashMap with all the item names giving them * starting counts of 0. * * @param names */ public void intializeExpenses(String... names) { for (String name : names) { expenses.put(name, 0); } } /** * Initializes the surplus HashMap with all the item names giving them * starting counts of 0. * * @param names */ public void initalizeSurplus(String... names) { for (String name : names) { surplus.put(name, 0); } } /** * Sets up the price hashmap for all the items. * * @param expenseItems * @param surplusItems */ public void setupPriceMap() { ZybezRSItem currentItem = null; if (expenses.size() > 0) { for (String name : expenses.keySet()) { currentItem = new ZybezRSItem(name); if (currentItem != null) prices.put(name, (currentItem.getAveragePrice() + 1)); } } if (surplus.size() > 0) { for (String name : surplus.keySet()) { currentItem = new ZybezRSItem(name); if (currentItem != null) prices.put(name, (currentItem.getAveragePrice() + 1)); } } for (String item : prices.keySet()) { General.println(item + " added with a current average price of " + prices.get(item) + "gp."); } } /** * Returns the current item count of the expense if it exists. * * @param name * @return */ public int getExpenseItemCount(String name) { return expenses.containsKey(name) ? expenses.get(name) : -1; } /** * Returns the current item count of the surplus if it exists. * * @param name * @return */ public int getSurplusItemCount(String name) { return surplus.containsKey(name) ? surplus.get(name) : -1; } /** * Returns the price of the item from the price map. * @param name * @return */ public int getItemPrice(String name) { return prices.containsKey(name) ? prices.get(name) : -1; } /** * Removes specified item from list * * @param name */ public void removeItem(String name) { surplus.remove(name); General.println(name + " has been removed from ProfitManager list."); } /** * Converts integer collection to int[] array * @param coll * @return */ public int[] convertIntegerCollection(Collection<Integer> coll) { int[] collection = new int[coll.size()]; for (int index = 0; index < collection.length; index++) { collection[index] = (int) coll.toArray()[index]; } return collection; } /** * Converts String collection to String[] array * @param coll * @return */ public String[] convertStringCollection(Collection<String> coll) { String[] collection = new String[coll.size()]; for (int index = 0; index < collection.length; index++) { collection[index] = (String) coll.toArray()[index]; } return collection; }}
  2. Debug at top of your client -> Inventory Same for getting Objects.
  3. No reason it should pause, unless the built in fatigue system is forcing the script to act slowly.
  4. Thank you:). But no his username is BradstaG.
  5. PM me account info and I'll take a look. My account is banned, and I honestly don't see myself making another one.
  6. Botfarm Manager is not a copy of anyones name. That's way to generic to consider it a copy of anything.
  7. If tabs are causing problems use the main tab. I can't help things aren't working great after the update.
  8. Updated to default TB banking. Should be able to use it within 5 or so minutes of this post.
  9. Updated banking to TB default until I re-write personal methods.
  10. Make sure your viewing the correct tab. There is paintable display I believe, and the regular one. Paint only shows up on one of them.
  11. Flax picking / spinning has pretty much been the most bannable thing on RS for a very long time. Should never use this on your main mate.