Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReplacePlayerDialog can now edit existing bot configs #4605

Merged
merged 7 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions megamek/docs/Bot Stuff/Princess Notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ MegaMek contains a single bot client, Princess. First, we'll go through the basi

1)
Behavior - There are 4 behaviors pre-configured with Princess:
�DEFAULT - Basic "balanced" settings.
�BERSERK - Highly aggressive. Princess will ignore danger to herself and will not run away under any circumstances.
�COWARDLY - Really doesn't want to get shot.
�ESCAPE - Not quite as fearful as cowardly but she will try to escape from her home board edge ASAP.
�DEFAULT - Basic "balanced" settings.
�BERSERK - Highly aggressive. Princess will ignore danger to herself and will not run away under any circumstances.
�COWARDLY - Really doesn't want to get shot.
�ESCAPE - Not quite as fearful as cowardly but she will try to escape from her home board edge ASAP.

You can also enter a name to save your own configurations for later games or for use with the replacePlayer command.

Verbosity - Used to set the level of logging Princess will use. DEBUG mode is very verbose. It is recommended you only use it when trying to debug something specific.

Forced Withdrawal - Used to make the Princess follow the Forced Withdrawal rules outlined in Total Warfare.

Immediate Withdrawal - Used to make Princess send her units to her home edge from the start of the game, regardless of damage level. This can be handy for Chase and Breakthrough scenarios.
Immediate Withdrawal - Used to make Princess send her units to her home edge from the start of the game, regardless of damage level. This can be handy for Chase and Breakthrough scenarios.

Auto Flee Board - (Only available when Immediate Withdrawal is in effect.) If this is checked, Princess will issue the Flee command as soon as her units reach her home edge, regardless of damage level.

Expand Down Expand Up @@ -95,7 +95,7 @@ Displays a list of available chat commands for Princess.

Replacing an Absent Player with the Princess Bot

If a player has become disconnected (the word "(ghost)" appears next to their name, you can replace that player with a bot. There are two methods for replacing a player. The first is the Replace Player command under the File menu. This will bring up a version of the Bot Config Dialog along with a list of players that can be replaced. The second option is to use the /replacePlayer command in the chat window:
If a player has become disconnected (the word "(ghost)" appears next to their name, you can replace that player with a bot. There are two methods for replacing a player. The first is the Edit Bots command under the File menu. This will bring up a version of the Bot Config Dialog along with a list of players that can be replaced. The second option is to use the /replacePlayer command in the chat window:

/replacePlayer -b:Princess <-c:ConfigName> <-v:VerbosityLevel> <-p:>PlayerName

Expand Down
2 changes: 1 addition & 1 deletion megamek/docs/help/en/PrincessBotDocumentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ <H2 CLASS="western"><A NAME="mozTocId779311"></A>Replacing an Absent

<P>If a player has become disconnected (the word &quot;<I>(ghost)</I>&quot;
appears next to their name, you can replace that player with a bot.&nbsp;
There are two methods for replacing a player. The first is the <i>Replace Player</i> command under the <u>File</u>
There are two methods for replacing a player. The first is the <i>Edit Bots</i> command under the <u>File</u>
menu. This will bring up a version of the Bot Config Dialog along with a list of players that can be replaced. The
second option is to use the <i>/replacePlayer</i> command in the chat window:</P>

Expand Down
26 changes: 16 additions & 10 deletions megamek/i18n/megamek/client/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ CommonMenuBar.fileBoardSaveAsImageUnits=Save As Image with Units...
CommonMenuBar.fileBoardSaveAsImageUnits.tooltip=Save the current board as a PNG image, with all units
CommonMenuBar.fileGameConnect=Connect...
CommonMenuBar.fileGameConnectBot=Connect as Bot...
CommonMenuBar.replacePlayer=Replace Player...
CommonMenuBar.editBots=Edit Bots...
CommonMenuBar.fileGameLoad=Load Game...
CommonMenuBar.fileGameSave=Save Game...
CommonMenuBar.fileGameSaveServer=Save on Server...
Expand Down Expand Up @@ -4367,15 +4367,21 @@ BotConfigDialog.saveNewPrompt=Choose a name for the preset
BotConfigDialog.saveNewTaken=That name already exists.
BotConfigDialog.previousConfig=Previous Configuration

#Replace Player Dialog
ReplacePlayersDialog.title=Replace Players with Princess Bots
ReplacePlayersDialog.princess=Princess
ReplacePlayersDialog.noReplacement=No replacement
ReplacePlayersDialog.ghostPlayerHeader=Ghost Player
ReplacePlayersDialog.configAvailableHeader=Princess Config
ReplacePlayersDialog.chooseReplacementHeader=Replace With
ReplacePlayersDialog.configAvailable=Available
ReplacePlayersDialog.config=Bot Settings...
#Edit Bots Dialog
EditBotsDialog.title=Replace Ghosts Players with Princess Bots and Edit Local Bots
EditBotsDialog.optionReplace=Replace with Princess
EditBotsDialog.optionDoNotReplace=Keep as Ghost
EditBotsDialog.optionNone=No Action
EditBotsDialog.optionEdit=Edit Bot
EditBotsDialog.optionKick=Kick Bot
EditBotsDialog.playerNameHeader=Player
EditBotsDialog.playerTypeHeader=Type
EditBotsDialog.configAvailableHeader=Saved Bot Config
EditBotsDialog.chooseActionHeader=Action
EditBotsDialog.configAvailable=Restore Saved Config
EditBotsDialog.config=Bot Settings...
EditBotsDialog.local=Local
EditBotsDialog.remote=Remote

#Point Blank Shot Dialog
StatusBarPhaseDisplay.pointblankShot=Pointblank shot from a hidden unit!
Expand Down
2 changes: 1 addition & 1 deletion megamek/i18n/megamek/client/messages_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ CommonMenuBar.fileGameQuickLoad=Schnellladen
CommonMenuBar.fileGameSaveServer=Auf dem Server speichern...
CommonMenuBar.fileUnitsSave=Speichern...
CommonMenuBar.fileUnitsBrowse=Verf�gbare Einheiten...
CommonMenuBar.replacePlayer=Spieler ersetzen...
CommonMenuBar.editBots=Spieler ersetzen...
CommonMenuBar.viewPlayerSettings=Spielereinstellungen
CommonMenuBar.viewAccessibilityWindow=Zug�nglichkeits-Fenster
CommonMenuBar.viewIncGUIScale=GUI vergr��ern
Expand Down
20 changes: 10 additions & 10 deletions megamek/i18n/megamek/client/messages_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ CommonMenuBar.fileBoardSaveAsImageUnits=Guardar como Imagen con Unidades...
CommonMenuBar.fileBoardSaveAsImageUnits.tooltip=Guarde el tablero actual como una imagen PNG, con todas las unidades
CommonMenuBar.fileGameConnect=Conectar...
CommonMenuBar.fileGameConnectBot=Conectar un Bot...
CommonMenuBar.replacePlayer=Sustituir Jugador...
CommonMenuBar.editBots=Sustituir Jugador...
CommonMenuBar.fileGameLoad=Cargar Partida...
CommonMenuBar.fileGameSave=Guardar Partida...
CommonMenuBar.fileGameSaveServer=Guardar Servidor...
Expand Down Expand Up @@ -4210,15 +4210,15 @@ BotConfigDialog.saveNewPrompt=Elija un nombre para el ajuste preestablecido
BotConfigDialog.saveNewTaken=Ese nombre ya existe.
BotConfigDialog.previousConfig=Configuración Anterior

#Replace Player Dialog
ReplacePlayersDialog.title=Reemplazar Jugadores con Princess Bots
ReplacePlayersDialog.princess=Princess
ReplacePlayersDialog.noReplacement=Sin reemplazo
ReplacePlayersDialog.ghostPlayerHeader=Jugador Fantasma
ReplacePlayersDialog.configAvailableHeader=Configuración de Princess
ReplacePlayersDialog.chooseReplacementHeader=Reemplazar con
ReplacePlayersDialog.configAvailable=Disponible
ReplacePlayersDialog.config=Configuración del Bot...
#Edit Bots Dialog
EditBotsDialog.title=Reemplazar Jugadores con Princess Bots
EditBotsDialog.optionReplace=Princess
EditBotsDialog.optionDoNotReplace=Sin reemplazo
EditBotsDialog.playerNameHeader=Jugador Fantasma
EditBotsDialog.configAvailableHeader=Configuración de Princess
EditBotsDialog.chooseActionHeader=Reemplazar con
EditBotsDialog.configAvailable=Disponible
EditBotsDialog.config=Configuración del Bot...

#Point Blank Shot Dialog
StatusBarPhaseDisplay.pointblankShot=¡Disparo a quemarropa desde una unidad oculta!
Expand Down
2 changes: 1 addition & 1 deletion megamek/i18n/megamek/client/messages_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ CommonMenuBar.fileBoardSaveAs=Сохранить как...
CommonMenuBar.fileBoardSaveAsImage=Сохранить как рисунок...
CommonMenuBar.fileGameConnect=Присоединиться...
CommonMenuBar.fileGameConnectBot=Присоединиться как бот...
CommonMenuBar.replacePlayer=Заменить игрока...
CommonMenuBar.editBots=Заменить игрока...
CommonMenuBar.fileGameNew=Новая
CommonMenuBar.fileGameOpen=Открыть...
CommonMenuBar.fileGameSave=Сохранить локально...
Expand Down
8 changes: 4 additions & 4 deletions megamek/src/megamek/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public class Client implements IClientCommandHandler {
private final UnitNameTracker unitNameTracker = new UnitNameTracker();

/** The bots controlled by the local player; maps a bot's name String to a bot's client. */
public Map<String, Client> bots = new TreeMap<>(String::compareTo);
public Map<String, Client> localBots = new TreeMap<>(String::compareTo);

// Hashtable for storing image tags containing base64Text src
private Hashtable<Integer, String> imgCache;
Expand Down Expand Up @@ -1397,7 +1397,7 @@ protected void handlePacket(Packet c) {
receivePlayerInfo(c);
break;
case PLAYER_REMOVE:
for (Iterator<Client> botIterator = bots.values().iterator(); botIterator.hasNext(); ) {
for (Iterator<Client> botIterator = localBots.values().iterator(); botIterator.hasNext(); ) {
Client bot = botIterator.next();
if (bot.localPlayerNumber == c.getIntValue(0)) {
botIterator.remove();
Expand Down Expand Up @@ -1880,14 +1880,14 @@ public void setCurrentHex(Coords hex) {

/** Returns true when the player is a bot added/controlled by this client. */
public boolean isLocalBot(Player player) {
return bots.containsKey(player.getName());
return localBots.containsKey(player.getName());
}

/**
* Returns the Client associated with the given local bot player. If
* the player is not a local bot, returns null.
*/
public Client getBotClient(Player player) {
return bots.get(player.getName());
return localBots.get(player.getName());
}
}
Loading