Examples of BotClient


Examples of megamek.client.bot.BotClient

        server.calculatePlayerBVs();

        // setup any bots
        for (int x = 0; x < pa.length; x++) {
            if (sd.playerTypes[x] == ScenarioDialog.T_BOT) {
                BotClient c = new TestBot(pa[x].getName(), "localhost", hd.port); //$NON-NLS-1$
                c.game.addGameListener(new BotGUI(c));
                if (!c.connect()) {
                }
                c.retrieveServerInfo();
            }
        }

        // If he didn't have a name when hasSlot was set, then the host should
        // be an observer.
View Full Code Here

Examples of megamek.client.bot.BotClient

        server.calculatePlayerBVs();

        // setup any bots
        for (int x = 0; x < pa.length; x++) {
            if (sd.playerTypes[x] == ScenarioDialog.T_BOT) {
                BotClient c = new TestBot(pa[x].getName(), "localhost", hd.port); //$NON-NLS-1$
                c.game.addGameListener(new BotGUI(c));

                if (!c.connect()) {
                }

                c.retrieveServerInfo();
            }
        }

        // If he didn't have a name when hasSlot was set, then the host should
        // be
View Full Code Here

Examples of megamek.client.bot.BotClient

            if (p.getText().trim().equals("")) { //$NON-NLS-1$
                name = "Bot" + lisPlayerInfo.getItemCount(); //$NON-NLS-1$
            } else {
                name = p.getText();
            }
            BotClient c = new TestBot(name, client.getHost(), client.getPort());
            c.game.addGameListener(new BotGUI(c));
            try {
                c.connect();
            } catch (Exception e) {
                clientgui
                        .doAlertDialog(
                                Messages.getString("ChatLounge.AlertBot.title"), Messages.getString("ChatLounge.AlertBot.message")); //$NON-NLS-1$ //$NON-NLS-2$
            }
            c.retrieveServerInfo();
            clientgui.getBots().put(name, c);
        } else if (ev.getSource() == butRemoveBot) {
            Client c = getPlayerListSelected(lisPlayerInfo);
            if ((c == null) || (c == client)) {
                clientgui
                        .doAlertDialog(
                                Messages
                                        .getString("ChatLounge.ImproperCommand"), Messages.getString("ChatLounge.SelectBo")); //$NON-NLS-1$ //$NON-NLS-2$
                return;
            }
            c.die();
            clientgui.getBots().remove(c.getName());
        } else if (ev.getSource() == butConditions) {
            // Display the game options dialog.
            clientgui.getPlanetaryConditionsDialog().update(client.game.getPlanetaryConditions());
            clientgui.getPlanetaryConditionsDialog().setVisible(true);
        }
View Full Code Here

Examples of megamek.client.bot.BotClient

        if (l.getSelectedIndex() == -1) {
            return client;
        }
        String name = l.getSelectedItem().substring(0,
                Math.max(0, l.getSelectedItem().indexOf(" :"))); //$NON-NLS-1$
        BotClient c = (BotClient) clientgui.getBots().get(name);
        if ((c == null) && client.getName().equals(name)) {
            return client;
        }
        return c;
    }
View Full Code Here

Examples of megamek.client.bot.BotClient

        if (lisPlayerInfo.getSelectedIndex() == -1) {
            return client;
        }
        String name = lisPlayerInfo.getSelectedItem().substring(0,
                Math.max(0, lisPlayerInfo.getSelectedItem().indexOf(" :"))); //$NON-NLS-1$
        BotClient c = (BotClient) clientgui.getBots().get(name);
        if ((c == null) && client.getName().equals(name)) {
            return client;
        }
        return c;
    }
View Full Code Here

Examples of megamek.client.bot.BotClient

            }
            if ("".equals(name.trim())) {
                name = "Bot" + lisPlayerInfo.getModel().getSize(); //$NON-NLS-1$
            }

            BotClient c = new TestBot(name, client.getHost(), client.getPort());
            c.game.addGameListener(new BotGUI(c));
            try {
                c.connect();
            } catch (Exception e) {
                clientgui
                        .doAlertDialog(
                                Messages.getString("ChatLounge.AlertBot.title"), Messages.getString("ChatLounge.AlertBot.message")); //$NON-NLS-1$ //$NON-NLS-2$
            }
            c.retrieveServerInfo();
            clientgui.getBots().put(name, c);
        } else if (ev.getSource().equals(butRemoveBot)) {
            Client c = getPlayerListSelected(lisPlayerInfo);
            if ((c == null) || c.equals(client)) {
                clientgui
                        .doAlertDialog(
                                Messages
                                        .getString("ChatLounge.ImproperCommand"), Messages.getString("ChatLounge.SelectBo")); //$NON-NLS-1$ //$NON-NLS-2$
                return;
            }
            c.die();
            clientgui.getBots().remove(c.getName());
        } else if (ev.getSource() == butConditions) {
            // Display the game options dialog.
            clientgui.getPlanetaryConditionsDialog().update(
                    client.game.getPlanetaryConditions());
            clientgui.getPlanetaryConditionsDialog().setVisible(true);
View Full Code Here

Examples of megamek.client.bot.BotClient

        if (l.getSelectedIndex() == -1) {
            return client;
        }
        String name = ((String) l.getSelectedValue()).substring(0, Math.max(0,
                ((String) l.getSelectedValue()).indexOf(" :"))); //$NON-NLS-1$
        BotClient c = (BotClient) clientgui.getBots().get(name);
        if ((c == null) && client.getName().equals(name)) {
            return client;
        }
        return c;
    }
View Full Code Here

Examples of megamek.client.bot.BotClient

            return client;
        }
        String name = ((String) lisPlayerInfo.getSelectedValue()).substring(0,
                Math.max(0, ((String) lisPlayerInfo.getSelectedValue())
                        .indexOf(" :"))); //$NON-NLS-1$
        BotClient c = (BotClient) clientgui.getBots().get(name);
        if ((c == null) && client.getName().equals(name)) {
            return client;
        }
        return c;
    }
View Full Code Here

Examples of megamek.client.bot.BotClient

                    + "'.");
            return;
        }

        if (target.isGhost()) {
            BotClient c = new TestBot(target.getName(), server.getHost(),
                    server.getPort());
            c.game.addGameListener(new BotGUI(c));
            try {
                c.connect();
            } catch (Exception e) {
                server.sendServerChat(connId, "Bot failed to connect.");
            }
            c.retrieveServerInfo();
            server.sendServerChat("Bot has replaced " + target.getName() + ".");
            return;
        }

        server.sendServerChat(connId, "Player " + target.getName()
View Full Code Here

Examples of megamek.client.bot.BotClient

        if (target == null) {
            return "No player with the name '" + args[1] + "'.";
        }

        if (target.isGhost()) {
            BotClient c = new TestBot(target.getName(), client.getHost(),
                    client.getPort());
            c.game.addGameListener(new BotGUI(c));
            try {
                c.connect();
            } catch (Exception e) {
                return "Bot failed to connect.";
            }
            c.retrieveServerInfo();
            return "Bot has replaced " + target.getName() + ".";
        }

        return "Player " + target.getName() + " is not a ghost.";
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.