diff --git a/2006Redone Server/src/main/java/com/rebotted/GameConstants.java b/2006Redone Server/src/main/java/com/rebotted/GameConstants.java index f85de353..86b0180e 100644 --- a/2006Redone Server/src/main/java/com/rebotted/GameConstants.java +++ b/2006Redone Server/src/main/java/com/rebotted/GameConstants.java @@ -10,7 +10,7 @@ public class GameConstants { public final static int ITEM_LIMIT = 15000, MAXITEM_AMOUNT = Integer.MAX_VALUE, CLIENT_VERSION = 999999, WORLD = 1, IPS_ALLOWED = 250, CONNECTION_DELAY = 100, - MESSAGE_DELAY = 6000, MAX_PLAYERS = 100, REQ_AMOUNT = 150; + MESSAGE_DELAY = 6000, MAX_PLAYERS = 200, REQ_AMOUNT = 150; public final static boolean SOUND = true, GUILDS = true, WORLD_LIST_FIX = false, diff --git a/2006Redone Server/src/main/java/com/rebotted/game/bots/Bot.java b/2006Redone Server/src/main/java/com/rebotted/game/bots/Bot.java index 8c9d70b8..016bb583 100644 --- a/2006Redone Server/src/main/java/com/rebotted/game/bots/Bot.java +++ b/2006Redone Server/src/main/java/com/rebotted/game/bots/Bot.java @@ -35,7 +35,12 @@ public class Bot { loadPlayerInfo(botClient, username, "bot_password", false); + System.out.println("x is " + x); + if (x == null) { + System.out.println("Bot should be at " + botClient.getX() + ", " + botClient.getY()); + } if (x != null) { + System.out.println("Moving player to " + x + "," + y + "," + z); botClient.getPlayerAssistant().movePlayer(x, y, z); } new TradeChat().run(); diff --git a/2006Redone Server/src/main/java/com/rebotted/game/bots/BotHandler.java b/2006Redone Server/src/main/java/com/rebotted/game/bots/BotHandler.java index 4c211e82..78d81588 100644 --- a/2006Redone Server/src/main/java/com/rebotted/game/bots/BotHandler.java +++ b/2006Redone Server/src/main/java/com/rebotted/game/bots/BotHandler.java @@ -3,6 +3,7 @@ package com.rebotted.game.bots; import java.io.File; import java.security.SecureRandom; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Random; @@ -13,6 +14,8 @@ import com.rebotted.game.players.PlayerHandler; import com.rebotted.game.shops.ShopHandler; import com.rebotted.util.Misc; +import static com.rebotted.game.players.PlayerSave.loadPlayerInfo; + public class BotHandler { static final List botList = new ArrayList<>(BotConstants.MAX_BOTS); @@ -39,7 +42,18 @@ public class BotHandler { if (child.getName().startsWith("♥")) { String playerName = child.getName().split("♥")[1]; playerName = playerName.substring(0, playerName.length() - 4); - System.out.println("Loading " + playerName + " shop"); + + Client determineIfLoad = new Client(null); + determineIfLoad.playerName = getShopName(playerName); + + loadPlayerInfo(determineIfLoad, getShopName(playerName), "bot_password", false); + System.out.println(Arrays.toString(determineIfLoad.bankItemsN)); + System.out.println("Bot [" + playerName + "] has totalLevel, bankItems[0]" + determineIfLoad.getPlayerAssistant().getTotalLevel() + ", " + determineIfLoad.bankItemsN[0]); + if (determineIfLoad.getPlayerAssistant().getTotalLevel() < 50 || determineIfLoad.bankItemsN[0] == 0) { + continue; + } + System.out.println("Loading bot " + playerName); + String shopName = getShopName(playerName); Bot bot = connectBot(shopName, null, null, null); Client playerShop = bot.getBotClient(); @@ -56,6 +70,7 @@ public class BotHandler { } player.getPacketSender().sendMessage("Shop commands- ::shop, ::withdrawshop, ::closeshop"); + player.getPacketSender().sendMessage("Your shop will permanently stay if you're total level > 50!"); Client playerShop = getPlayerShop(player.playerName); @@ -81,9 +96,11 @@ public class BotHandler { i++; } // Set bot to same level as player + playerShop.combatLevel = player.combatLevel; i = 0; for (int level : player.playerLevel) { playerShop.playerLevel[i] = level; + playerShop.playerXP[i] = playerShop.getPlayerAssistant().getXPForLevel(level); playerShop.getPlayerAssistant().refreshSkill(i); i++; } diff --git a/2006Redone Server/src/main/java/com/rebotted/game/players/PlayerSave.java b/2006Redone Server/src/main/java/com/rebotted/game/players/PlayerSave.java index 5c279adb..d63aaf8b 100644 --- a/2006Redone Server/src/main/java/com/rebotted/game/players/PlayerSave.java +++ b/2006Redone Server/src/main/java/com/rebotted/game/players/PlayerSave.java @@ -27,6 +27,9 @@ public class PlayerSave { BufferedReader characterfile = null; boolean File1 = false; + if (player.playerName == null) { + System.out.println("WARNING: called loadPlayerInfo with a Client who does not have a .playerName"); + } try { characterfile = new BufferedReader(new FileReader(System.getProperty("user.dir") + "/data/characters/" + player.playerName + ".txt")); File1 = true; diff --git a/2006Redone Server/src/main/java/com/rebotted/game/shops/ShopHandler.java b/2006Redone Server/src/main/java/com/rebotted/game/shops/ShopHandler.java index 22abc1cb..c12e54da 100644 --- a/2006Redone Server/src/main/java/com/rebotted/game/shops/ShopHandler.java +++ b/2006Redone Server/src/main/java/com/rebotted/game/shops/ShopHandler.java @@ -202,7 +202,7 @@ public class ShopHandler { private static int getEmptyshop(){ for (int i = 0; i < MAX_SHOPS; i++) { - if (shopName[i] == "") return i; + if (shopName[i].equals("")) return i; } return -1; }